我正在使用以下:
minitest 5.3.5
cucumber 1.3.15
capybara 2.3.0
capybara_minitest_spec 1.0.2
rails 4.1.1
cucumber-rails 1.4.1
和我的黄瓜/水豚代码
Then(/^I should see "(.*?)"$/) do |string|
page.has_content?(string)
end
与任何字符串无关,是在页面上还是返回true。我尝试使用capybara_minitest_spec gem,我的代码成为
Then(/^I should see "(.*?)"$/) do |string|
page.must_have_content(string)
end
然后我有错误
Then I should see "Test" # features/step_definitions/pages_steps.rb:9
undefined method `assert_page_has_content' for nil:NilClass (NoMethodError)
(eval):4:in `must_have_content'
./features/step_definitions/pages_steps.rb:10:in `/^I should see "(.*?)"$/'
features/can_access_home.feature:7:in `Then I should see "Test"'
这么奇怪。使用save_and_open_page我可以看到我的页面,而没有任何问题。您能帮我解决一下吗?
PS:我使用的是minitest而不是rspec
我已解决以下问题
Then(/^I should see "(.*?)"$/) do |string|
assert page.has_content?(string)
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句