From 8f2f9972038d8a9d2110170e3d0c247c00b516e9 Mon Sep 17 00:00:00 2001 From: "Roman V. Babenko" Date: Sun, 18 Sep 2011 07:38:23 +0300 Subject: [PATCH 1/3] [+] .rspec options file support --- lib/spec/runner/option_parser.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/spec/runner/option_parser.rb b/lib/spec/runner/option_parser.rb index 87c9522c2..8fa1bb26e 100644 --- a/lib/spec/runner/option_parser.rb +++ b/lib/spec/runner/option_parser.rb @@ -164,6 +164,8 @@ def parse_file_options(option_name, action) end end + options_file = '.rspec' if options_file.nil? && File.exist?('.rspec') && !@argv.any? {|a| a =~ /^\-/} + if options_file.nil? && File.exist?('spec/spec.opts') && !@argv.any?{|a| a =~ /^\-/ } From 5dea848d298c7326095f745c89fd23f137276763 Mon Sep 17 00:00:00 2001 From: "Roman V. Babenko" Date: Thu, 29 Sep 2011 11:45:27 +0300 Subject: [PATCH 2/3] [^] example disabling has become more informative --- lib/spec/example/example_group_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/spec/example/example_group_methods.rb b/lib/spec/example/example_group_methods.rb index 93f459587..90e4dd99e 100644 --- a/lib/spec/example/example_group_methods.rb +++ b/lib/spec/example/example_group_methods.rb @@ -85,7 +85,7 @@ def pending_implementation # Use this to temporarily disable an example. def xexample(description=nil, opts={}, &block) - Kernel.warn("Example disabled: #{description}") + Kernel.warn("Example disabled: #{description || 'Not Specified'}\n#{caller.first}") end alias_method :xit, :xexample From defcb7b205756e695b03f791a7d3a22425908eee Mon Sep 17 00:00:00 2001 From: "Roman V. Babenko" Date: Fri, 28 Oct 2011 14:43:27 +0300 Subject: [PATCH 3/3] [^] TextMateFormatter support has been improved, comment support in options files has been added --- lib/spec/runner/option_parser.rb | 7 ++++--- lib/spec/runner/options.rb | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/spec/runner/option_parser.rb b/lib/spec/runner/option_parser.rb index 8fa1bb26e..989354e6b 100644 --- a/lib/spec/runner/option_parser.rb +++ b/lib/spec/runner/option_parser.rb @@ -52,6 +52,7 @@ def spec_command? "specdoc|s : Code example doc strings", "nested|n : Code example doc strings with nested groups indented", "html|h : A nice HTML report", + "text_mate|t : Formats backtraces so they're clickable by TextMate", "failing_examples|e : Write all failing examples - input for --example", "failing_example_groups|g : Write all failing example groups - input for --example", " ", @@ -163,9 +164,9 @@ def parse_file_options(option_name, action) options_file = @argv.delete_at(index) end end - + options_file = '.rspec' if options_file.nil? && File.exist?('.rspec') && !@argv.any? {|a| a =~ /^\-/} - + if options_file.nil? && File.exist?('spec/spec.opts') && !@argv.any?{|a| a =~ /^\-/ } @@ -181,7 +182,7 @@ def parse_file_options(option_name, action) end def parse_options_file(options_file) - option_file_args = File.readlines(options_file).map {|l| l.chomp.split " "}.flatten + option_file_args = File.readlines(options_file).reject { |l| l.strip =~ /^#/ }.map {|l| l.chomp.split " "}.flatten @argv.push(*option_file_args) end diff --git a/lib/spec/runner/options.rb b/lib/spec/runner/options.rb index 6e23da7da..a0afdfdc4 100644 --- a/lib/spec/runner/options.rb +++ b/lib/spec/runner/options.rb @@ -25,7 +25,9 @@ class Options 'g' => ['spec/runner/formatter/failing_example_groups_formatter', 'Formatter::FailingExampleGroupsFormatter'], 'profile' => ['spec/runner/formatter/profile_formatter', 'Formatter::ProfileFormatter'], 'o' => ['spec/runner/formatter/profile_formatter', 'Formatter::ProfileFormatter'], - 'textmate' => ['spec/runner/formatter/text_mate_formatter', 'Formatter::TextMateFormatter'] + 'textmate' => ['spec/runner/formatter/text_mate_formatter', 'Formatter::TextMateFormatter'], + 'text_mate' => ['spec/runner/formatter/text_mate_formatter', 'Formatter::TextMateFormatter'], + 't' => ['spec/runner/formatter/text_mate_formatter', 'Formatter::TextMateFormatter'] } attr_accessor( @@ -52,7 +54,7 @@ class Options ) attr_reader :colour, :differ_class, :files, :examples, :example_groups attr_writer :drb_port - + def initialize(error_stream, output_stream) @error_stream = error_stream @output_stream = output_stream @@ -294,7 +296,7 @@ def dry_run? def drb_port @drb_port.to_i if defined?(@drb_port) end - + protected def define_predicate_matchers