RoR: Wrong Number of Arguments
I am trying to call a method in my Rails 3 code but am getting:
Failure/Error: integration_sign_in wrong_user ArgumentError: wrong number of arguments (0 for 1)
Here is the calling code (in an RSpec helper):
before(:each) do
wrong_user = Factory(:user, :email => "test@test.com", :password=>"hellohello", :password_confirmation => "hellohello")
integration_sign_in wrong_user
end
So it is clearly passing one argument. If the argument is null for some reason, would that make it consider it not a parameter?
RELEVANT BACKSTORY: For testing, I just switched from webrat to capybara. As suggested in Railscast 257, I also installed the launchy and database_cleaner gems. When I was using webrat, the code above worked as expected, but now (I believe related to database_cleaner) something is going wrong.
Possibly relevant开发者_JAVA技巧: In my spec_helper.rb I changed to:
config.use_transactional_fixtures = false
(even though 'true' has the same problem)
Any ideas? Thanks.
It looks like the argument error was not actually in this function (even though the top of the stack makes it look like it is. The actual error is inside of the integration_sign_in function:
def integration_sign_in(user)
visit signin_path
fill_in :email, :with => user.email
fill_in :password, :with => user.password
click_button
end
It looks like click_button
needs an argument in capybara, but it does not in webrat.
integration_sign_in(wrong_user)
精彩评论