aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/isolation/abstract_unit.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/test/isolation/abstract_unit.rb')
-rw-r--r--railties/test/isolation/abstract_unit.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/railties/test/isolation/abstract_unit.rb b/railties/test/isolation/abstract_unit.rb
index 69208ce4c3..685d1b154b 100644
--- a/railties/test/isolation/abstract_unit.rb
+++ b/railties/test/isolation/abstract_unit.rb
@@ -91,6 +91,9 @@ module TestHelpers
module Generation
# Build an application by invoking the generator and going through the whole stack.
def build_app(options = {})
+ @prev_rails_env = ENV['RAILS_ENV']
+ ENV['RAILS_ENV'] = 'development'
+
FileUtils.rm_rf(app_path)
FileUtils.cp_r(tmp_path('app_template'), app_path)
@@ -115,6 +118,10 @@ module TestHelpers
add_to_config 'config.secret_token = "3b7cd727ee24e8444053437c36cc66c4"; config.session_store :cookie_store, :key => "_myapp_session"; config.active_support.deprecation = :log'
end
+ def teardown_app
+ ENV['RAILS_ENV'] = @prev_rails_env if @prev_rails_env
+ end
+
# Make a very basic app, without creating the whole directory structure.
# This is faster and simpler than the method above.
def make_basic_app
@@ -231,6 +238,10 @@ module TestHelpers
end
end
+ def remove_file(path)
+ FileUtils.rm_rf "#{app_path}/#{path}"
+ end
+
def controller(name, contents)
app_file("app/controllers/#{name}_controller.rb", contents)
end
@@ -280,4 +291,4 @@ Module.new do
end
f.puts "require 'rails/all'"
end
-end
+end unless defined?(RAILS_ISOLATED_ENGINE)