From f7c6274135fc1bb89b502ee9dc3e2fefa9f5d3bc Mon Sep 17 00:00:00 2001 From: ddemaree Date: Wed, 24 Dec 2008 09:50:02 -0600 Subject: [PATCH] Fixed bug where calling app method from console would raise ArgumentError --- .gitignore | 2 +- railties/lib/console_app.rb | 3 ++- railties/test/console_app_test.rb | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 6e869a0..ce4ef7e 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ railties/pkg railties/test/500.html railties/doc/guides/html/images railties/doc/guides/html/stylesheets -*.rbc +*.rbc \ No newline at end of file diff --git a/railties/lib/console_app.rb b/railties/lib/console_app.rb index 96bf311..6440309 100644 --- a/railties/lib/console_app.rb +++ b/railties/lib/console_app.rb @@ -16,7 +16,8 @@ end # create a new session. If a block is given, the new session will be yielded # to the block before being returned. def new_session - session = ActionController::Integration::Session.new + app = ActionController::Dispatcher.new + session = ActionController::Integration::Session.new(app) yield session if block_given? session end diff --git a/railties/test/console_app_test.rb b/railties/test/console_app_test.rb index cbaf230..109563a 100644 --- a/railties/test/console_app_test.rb +++ b/railties/test/console_app_test.rb @@ -14,6 +14,17 @@ require 'console_app' Test::Unit.run = false class ConsoleAppTest < Test::Unit::TestCase + + def test_app_method_should_return_integration_session + assert_nothing_thrown do + console_session = app + + assert_not_nil console_session + assert_instance_of ActionController::Integration::Session, + console_session + end + end + uses_mocha 'console reload test' do def test_reload_should_fire_preparation_callbacks a = b = c = nil -- 1.6.0.3