diff options
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 |