Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

simpler --tag TAG[:VALUE] parsing and remove small duplication #511

Merged
merged 2 commits into from

2 participants

@AlexKVal

No description provided.

@dchelimsky dchelimsky merged commit a94414f into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 28, 2011
  1. simpler --tag TAG[:VALUE] parsing

    Sasha authored
  2. remove duplication

    Sasha authored
This page is out of date. Refresh to see the latest.
View
9 lib/rspec/core/option_parser.rb
@@ -154,14 +154,7 @@ def parser(options)
name = name.to_sym
options[filter_type] ||= {}
- options[filter_type][name] = case value
- when /^(true|false|nil)$/
- eval(value)
- when nil
- true
- else
- value
- end
+ options[filter_type][name] = value.nil? ? true : eval(value) rescue value
end
parser.on('--default_path PATH', 'Set the default path where RSpec looks for examples.',
View
6 spec/rspec/core/configuration_options_spec.rb
@@ -140,9 +140,9 @@
describe "--format, -f" do
it "sets :formatter" do
- parse_options('--format', 'd').should include(:formatters => [['d']])
- parse_options('-f', 'd').should include(:formatters => [['d']])
- parse_options('-fd').should include(:formatters => [['d']])
+ [['--format', 'd'], ['-f', 'd'], '-fd'].each do |args|
+ parse_options(*args).should include(:formatters => [['d']])
+ end
end
example "can accept a class name" do
View
5 spec/rspec/core/option_parser_spec.rb
@@ -109,6 +109,11 @@ module RSpec::Core
options = Parser.parse!([option, 'foo:false', option, 'bar:true', option, 'foo:true'])
options[:inclusion_filter].should eq(:foo => true, :bar => true)
end
+
+ it "treats 'any_string' as 'any_string'" do
+ options = Parser.parse!([option, 'foo:any_string'])
+ options[:inclusion_filter].should eq(:foo => 'any_string')
+ end
end
context "with ~" do
Something went wrong with that request. Please try again.