diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-11-18 17:10:37 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-11-19 19:09:00 -0300 |
commit | 5098302fa102441be1a93266817994a3e31be4b1 (patch) | |
tree | bcb7440e3175c75eba617f270ccc8d0c8666e03a /railties/test | |
parent | 375aaa9db1bb808f9126e3a057c80fca0c631ba6 (diff) | |
download | rails-5098302fa102441be1a93266817994a3e31be4b1.tar.gz rails-5098302fa102441be1a93266817994a3e31be4b1.tar.bz2 rails-5098302fa102441be1a93266817994a3e31be4b1.zip |
Simplify remove_from_config.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/isolation/abstract_unit.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb index 3a582f850f..c5b1cb9a80 100644 --- a/railties/test/isolation/abstract_unit.rb +++ b/railties/test/isolation/abstract_unit.rb @@ -216,14 +216,10 @@ module TestHelpers end def remove_from_config(str) - application_file = "#{app_path}/config/application.rb" - environment = File.read(application_file) - lines = File.readlines(application_file) - if environment =~ /(\n\s*end\s*end\s*)\Z/ - File.open(application_file, 'w') do |f| - lines.each {|line| f.puts(line) unless line =~ /#{str}/ } - end - end + file = "#{app_path}/config/application.rb" + contents = File.read(file) + contents.sub!(/#{str}/, "") + File.open(file, "w+") { |f| f.puts contents } end def app_file(path, contents) @@ -242,7 +238,7 @@ module TestHelpers :activemodel, :activerecord, :activeresource] - arr - remove_from_config "config.active_record" if to_remove.include? :activerecord + remove_from_config "config.active_record.identity_map = true" if to_remove.include? :activerecord $:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' } end |