0
votes

I've recently upgraded to Rails 3 and I'm trying to get my Cucumber tests to run.

When I run the tests, I'm getting the following error:

wrong number of arguments (2 for 1) (ArgumentError)
./features/step_definitions/user_steps.rb:24:in `/^I am logged in$/'
features/account.feature:8:in `Given I am logged in'

This test does nothing more than opening my login page. When I don't include the @javascript flag at the top of my feature file, it runs fine. When I do include it, I get the error and Selenium (I think) opens an instance of Firefox but nothing happens in the browser.

EDIT:

My I am logged in step looks like this:

Given /^I am logged in$/ do
  @user = Factory(:user, :email => "[email protected]")
  @user.activate
  visit path_to("the login page")
end
1
What does your I am logged in step look like?MrDanA
I've pasted my I am logged in step into the question. I've also tried that with path_to("the login page") replaced with "/login"blim8183
Could it be a problem with your factory? It's the only thing you're passing 2 arguments to. What's the :user factory look like?MrDanA
I don't think so. When I run the feature with the @javascript flag off, it runs fine. I think it has something to do with opening firefox when I'm using the webdriver.blim8183

1 Answers

0
votes

I tracked down a similar problem using pry.

[1] pry(#<Cucumber::Rails::World>)> step %{I go to login}
ArgumentError: wrong number of arguments (2 for 1)
from ~/.rvm/gems/ruby-1.8.7-p352/gems/multi_json-1.0.4/lib/multi_json/engines/json_common.rb:9:in 'parse'

Which was fixed with gem 'json', :require => 'json/pure' ahead of bson in my Gemfile.

Edit: Look like it was also necessary to force use of 1.9.2 (rvm --rvmrc --create 1.9.2).