Skip to content

Commit

Permalink
Fixed bug where calling app method from console would raise ArgumentE…
Browse files Browse the repository at this point in the history
…rror [rails#1629 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
ddemaree authored and josh committed Jan 2, 2009
1 parent a1fb57a commit f90160c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 2 additions & 3 deletions actionpack/lib/action_controller/integration.rb
Expand Up @@ -81,8 +81,8 @@ class MultiPartNeededException < Exception
end

# Create and initialize a new Session instance.
def initialize(app)
@application = app
def initialize(app = nil)
@application = app || ActionController::Dispatcher.new
reset!
end

Expand Down Expand Up @@ -591,7 +591,6 @@ def reset!
# can use this method to open multiple sessions that ought to be tested
# simultaneously.
def open_session(application = nil)
application ||= ActionController::Dispatcher.new
session = Integration::Session.new(application)

# delegate the fixture accessors back to the test instance
Expand Down
9 changes: 9 additions & 0 deletions railties/test/console_app_test.rb
Expand Up @@ -14,6 +14,15 @@ class ApplicationController < ActionController::Base; end
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
Expand Down

0 comments on commit f90160c

Please sign in to comment.