开发者

Undefined local variable or method 'page' for Cucumber::Rails::World (NameError)

I'm running a basic featur开发者_Go百科e by following RBates RailsCasts tutorial using Rspec 2.5.0 and Cucumber-rails 0.4.1 on a cygwin environment. I am at the step where I am testing "Then I should see"

For example:

Scenario: Stores List
    Given I have stores named Pizza, Breadsticks
    When I go to the list of stores
    **Then I should see "Pizza"**

Running cucumber features gives me the following error message:

Undefined local variable or method 'page' for Cucumber::Rails::World (NameError)

Then I should See is defined in the web_steps file as follows:

 if page.respond_to? :should
    page.should have_content(text)
  else
    assert page.has_content?(text)
  end

Any guidance would be appreciated!

Thank you!


Fixed the error. I had commented out:

Capybara.default_selector = :css because of a previous issue (See: https://github.com/aslakhellesoy/cucumber-rails/issues/120). Once i included the following:

require 'capybara/rails' require 'capybara/cucumber'

It fixed the capybara issue and the page method was available.

Thanks.


I don't know much of RoR, and without seeing more code, it appears you haven't defined the variable 'page', or you defined it in an area that is outside the scope of where you're trying to use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜