Skip to content
This repository has been archived by the owner on Oct 27, 2021. It is now read-only.

.rspec options file support has been added #40

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/spec/example/example_group_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions lib/spec/runner/option_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
" ",
Expand Down Expand Up @@ -163,7 +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') && [email protected]? {|a| a =~ /^\-/}

if options_file.nil? &&
File.exist?('spec/spec.opts') &&
[email protected]?{|a| a =~ /^\-/ }
Expand All @@ -179,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

Expand Down
8 changes: 5 additions & 3 deletions lib/spec/runner/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand Down Expand Up @@ -294,7 +296,7 @@ def dry_run?
def drb_port
@drb_port.to_i if defined?(@drb_port)
end

protected

def define_predicate_matchers
Expand Down