0

I am upgrading cucumber-rails-0.3.2 to cucumber-rails-1.3.1 and here is my Gemfile

group :development, :test do
  gem "cucumber-rails", "1.3.1", :require => false
  gem "database_cleaner"
  gem "rspec-rails", ">= 2.8.1"
  gem "webrat"
end

I have login scenario, here it is

Scenario: Navigating to the login page
    Given an unauthenticated visitor

    When visitor goes to the home page
    And clicks on 'Login'

    Then visitor should see the people login page

and corresponding step definitions is

Given "an unauthenticated visitor" do
  request.session.delete if request && request.session
end

OR

something like this

request.session[:user_id].should == Person.find_by_username(user).id

in this stage, I am getting wrong number of arguments calling request (0 for 1) (ArgumentError)

I setup cucumber environments as per cucumber-rails-1.3.1 and I am using Mocks (RSpec::Mocks).

any ideas or help on this welcome and appreciated.

4

1 回答 1

0

request.session对象实际上只是一个散列,而delete(doc)需要 1 个参数(要删除的键)。

这是您的步骤定义应如下所示:

Given "an unauthenticated visitor" do
  Capybara.reset_sessions!
end
于 2013-06-18T19:46:17.900 回答