Permalink
Browse files

Prefer SPEC_OPTS to cli

- Closes #276.
  • Loading branch information...
1 parent 258bd20 commit ba03fc82b477b9b4f471e245fbbebd1f9a08de1c @iromeo iromeo committed with dchelimsky Jan 13, 2011
Showing with 6 additions and 7 deletions.
  1. +1 −1 lib/rspec/core/configuration_options.rb
  2. +5 −6 spec/rspec/core/configuration_options_spec.rb
@@ -68,8 +68,8 @@ def parse_options
options_to_merge << global_options
options_to_merge << local_options
end
- options_to_merge << env_options
options_to_merge << command_line_options
+ options_to_merge << env_options
options_to_merge.inject do |merged, options|
merged.merge(options)
@@ -272,7 +272,7 @@ def parse_options(*args)
end
end
- describe "sources: ~/.rspec, ./.rspec, custom, SPEC_OPTS, and CLI" do
+ describe "sources: ~/.rspec, ./.rspec, custom, CLI, and SPEC_OPTS" do
let(:local_options_file) { File.join(Dir.tmpdir, ".rspec-local") }
let(:global_options_file) { File.join(Dir.tmpdir, ".rspec-global") }
let(:custom_options_file) { File.join(Dir.tmpdir, "custom.options") }
@@ -313,16 +313,15 @@ def write_options(scope, options)
options[:drb].should be_true
end
- it "prefers CLI over SPEC_OPTS" do
+ it "prefers SPEC_OPTS over CLI" do
ENV["SPEC_OPTS"] = "--format spec_opts"
- parse_options("--format", "cli")[:formatters].should eq([['cli']])
+ parse_options("--format", "cli")[:formatters].should eq([['spec_opts']])
end
- it "prefers SPEC_OPTS over file options" do
+ it "prefers CLI over file options" do
write_options(:local, "--format local")
write_options(:global, "--format global")
- ENV["SPEC_OPTS"] = "--format spec_opts"
- parse_options[:formatters].should eq([['spec_opts']])
+ parse_options("--format", "cli")[:formatters].should eq([['cli']])
end
it "prefers local file options over global" do

0 comments on commit ba03fc8

Please sign in to comment.