Permalink
Browse files

Make the generated spec_helper less surprising

Having the two options 'run_all_when_everything_filtered' and
'filter_run' default to true and :focus (respecively) does not follow
the principle of least surprise. It is a more suitable default that
these options remain unset.

Fixes #796
  • Loading branch information...
1 parent eecd635 commit 45bfe2bf16d1acc9f06ff7fe6bae334dce6f7578 @jasonkarns committed Feb 19, 2013
Showing with 12 additions and 2 deletions.
  1. +2 −2 lib/rspec/core/project_initializer.rb
  2. +10 −0 spec/rspec/core/project_initializer_spec.rb
@@ -49,8 +49,8 @@ def create_spec_helper_file
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
- config.run_all_when_everything_filtered = true
- config.filter_run :focus
+ # config.run_all_when_everything_filtered = true
+ # config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
@@ -49,6 +49,16 @@ module RSpec::Core
command_line_config.run
expect(File.read('spec/spec_helper.rb')).to match /RSpec\.configure do \|config\|/m
end
+
+ it "leaves 'run_all_when_everything_filtered' commented out" do
+ command_line_config.run
+ expect(File.read('spec/spec_helper.rb')).to match /^\s\s# config\.run_all_when_everything_filtered = true/m
+ end
+
+ it "leaves 'filter_run' commented out" do
+ command_line_config.run
+ expect(File.read('spec/spec_helper.rb')).to match /^\s\s# config\.filter_run :focus/m
+ end
end
context "with a spec/spec_helper.rb file" do

0 comments on commit 45bfe2b

Please sign in to comment.