Given I am not logged in
And the following user exists:
| login | email | password | confirmation |
| user50 | user50@mydomain.com | secret50 | secret 50 |
....
引发以下错误:
Undefined step: "the following user exists:" (Cucumber::Undefined exception)
/home/user/RubymineProjects/project/features/sign_in.feature:9:in `And the following user exists:
You can implement step definitions for undefined steps with these snippets:
And /^the following user exists:$/ do |table|
# table is a Cucumber::Ast::Table
pending # express the regexp above with the code you wish you had
end
我已经安装了factory_girl_rails(甚至RubyMine的代码补全功能也与Factory Girl步骤兼容...)
#Gemfile
group :test do
gem "cucumber-rails", ">= 0.3.2"
gem "factory_girl_rails"
end
#features/support/env.rb
require 'factory_girl'
require 'factory_girl/step_definitions'
有什么想法吗?谢谢
更新:感谢 @sj26 和 @twmills,我意识到我忘记使用Factory Girl创建了一个名为:user的工厂。一旦我创建了它,一切都正常了。