diff options
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/console_test.rb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/railties/test/application/console_test.rb b/railties/test/application/console_test.rb index 793e73556c..5ae6323345 100644 --- a/railties/test/application/console_test.rb +++ b/railties/test/application/console_test.rb @@ -8,9 +8,9 @@ class ConsoleTest < Test::Unit::TestCase boot_rails end - def load_environment + def load_environment(sandbox = false) require "#{rails_root}/config/environment" - Rails.application.load_console + Rails.application.load_console(sandbox) end def test_app_method_should_return_integration_session @@ -73,6 +73,20 @@ class ConsoleTest < Test::Unit::TestCase helper.truncate('Once upon a time in a world far far away') end + def test_with_sandbox + require 'rails/all' + value = false + + Class.new(Rails::Railtie) do + console do |sandbox| + value = sandbox + end + end + + load_environment(true) + assert value + end + def test_active_record_does_not_panic_when_referencing_an_observed_constant add_to_config "config.active_record.observers = :user_observer" |