Permalink
Browse files

Fix an error on 1.8.7.

  • Loading branch information...
1 parent 392df0f commit b1ae796284850e29d5ad0fc769e55ed4a43676a4 @josevalim josevalim committed Sep 29, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_dispatch/testing/integration.rb
View
2 actionpack/lib/action_dispatch/testing/integration.rb
@@ -171,7 +171,7 @@ def cookies
# Create and initialize a new Session instance.
def initialize(app)
- super
+ super()
@app = app
# If the app is a Rails app, make url_helpers available on the session

4 comments on commit b1ae796

@KieranP

Wow. Really? 0_o This works fine in the version of Ruby 1.8.7 I have installed.

irb(main):001> class A
irb(main):002>   def initialize; puts 'a'; end
irb(main):003> end
irb(main):004> class B < A
irb(main):005>   def initialize; super; puts 'b'; end
irb(main):006> end
irb(main):007> B.new
a
b
@josevalim
Ruby on Rails member

To reproduce the error:

class A
  def initialize
    puts :A
  end
end

class B < A
  def initialize(v)
   super
   puts :B
 end
end

B.new(1) #=> ArgumentError: wrong number of arguments (1 for 0)
@KieranP

Ah, I see. Thanks for explaining.

@jdunphy

KieranP: With no parens present, it's attempting to call super(app).

Change your example to call class B; def initialize(foo); etc. Then try it.

Please sign in to comment.