Permalink
Browse files

Merge pull request #1163 from rspec/remove-warnings-from-spechelper

Remove warning configuration from spec_helper.rb
  • Loading branch information...
cupakromer committed Aug 29, 2014
2 parents 953750d + 9cf4329 commit b7b22ed319080eed0771c0092a109737624c775c
@@ -9,6 +9,7 @@ Enhancements:
* Include generator for `ActiveJob`. (Abdelkader Boudih, #1155)
* Improve support for non-ActiveRecord apps by not loading ActiveRecord related
settings in the generated `rails_helper`. (Aaron Kromer, #1150)
* Remove Ruby warnings as a suggested configuration. (Aaron Kromer, #1163)
Bug Fixes:
@@ -36,11 +36,28 @@ def generate_rspec_init(tmpdir)
:report_stream => StringIO.new
)
initializer.run
gsub_file File.join(tmpdir, 'spec', 'spec_helper.rb'),
spec_helper_path = File.join(tmpdir, 'spec', 'spec_helper.rb')
replace_generator_command(spec_helper_path)
remove_warnings_configuration(spec_helper_path)
end
def replace_generator_command(spec_helper_path)
gsub_file spec_helper_path,
'rspec --init',
'rails generate rspec:install',
:verbose => false
end
def remove_warnings_configuration(spec_helper_path)
empty_line = '^\n'
comment_line = '^\s*#.+\n'
gsub_file spec_helper_path,
/#{empty_line}(#{comment_line})+\s+config\.warnings = true\n/,
'',
:verbose => false
end
end
end
end
@@ -48,6 +48,11 @@ def use_transactional_fixtures
expect(spec_helper).to match(generator_command_notice)
end
it "does not configure warnings in the spec/spec_helper.rb" do
run_generator
expect(spec_helper).not_to match(/\bconfig.warnings\b/m)
end
context "generates spec/rails_helper.rb" do
specify "requiring respec/rails" do
run_generator

0 comments on commit b7b22ed

Please sign in to comment.