Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Properly parse `SPEC_OPTS` options. Fixes #586

  • Loading branch information...
commit 268eeb4c8c3851fdbb86c93aff388d2b00786d6c 1 parent f85d405
@justinko justinko authored
View
4 Changelog.md
@@ -7,6 +7,10 @@ Enhancements
* intended for extension libs
* restores rspec-1 behavior
+Bug fixes
+
+* Properly parse `SPEC_OPTS` options.
+
### 2.9.0 / 2012-03-17
[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0)
View
5 lib/rspec/core/configuration_options.rb
@@ -1,4 +1,5 @@
require 'erb'
+require 'shellwords'
module RSpec
module Core
@@ -16,7 +17,7 @@ def configure(config)
config.filter_manager = filter_manager
order(options.keys, :libs, :requires, :default_path, :pattern).each do |key|
- force?(key) ? config.force(key => options[key]) : config.send("#{key}=", options[key])
+ force?(key) ? config.force(key => options[key]) : config.send("#{key}=", options[key])
end
formatters.each {|pair| config.add_formatter(*pair) } if formatters
@@ -70,7 +71,7 @@ def file_options
end
def env_options
- ENV["SPEC_OPTS"] ? Parser.parse!(ENV["SPEC_OPTS"].split) : {}
+ ENV["SPEC_OPTS"] ? Parser.parse!(Shellwords.split(ENV["SPEC_OPTS"])) : {}
end
def command_line_options
View
3  spec/rspec/core/configuration_options_spec.rb
@@ -316,11 +316,12 @@
it "merges global, local, SPEC_OPTS, and CLI" do
File.open("./.rspec", "w") {|f| f << "--line 37"}
File.open("~/.rspec", "w") {|f| f << "--color"}
- ENV["SPEC_OPTS"] = "--debug"
+ ENV["SPEC_OPTS"] = "--debug --example 'foo bar'"
options = parse_options("--drb")
options[:color].should be_true
options[:line_numbers].should eq(["37"])
options[:debug].should be_true
+ options[:full_description].should eq(/foo\ bar/)
options[:drb].should be_true
end
Please sign in to comment.
Something went wrong with that request. Please try again.