我正在学习 Hartl 的 Rails 教程 (http://ruby.railstutorial.org/chapters/sign-in-sign-out#sec:cucumber)。
我完成了第 9 章,然后决定回去做第 8.3 章中可选的 Cucumber 部分。
我在 Gemfile 中添加了 cucumber-rails 和 database_cleaner:
group :test do
gem 'capybara', '1.1.2'
gem 'rb-fsevent', '0.4.3.1', :require = false
gem 'growl', '1.0.3'
gem 'factory_girl_rails', '1.4.0'
gem 'cucumber-rails', '1.2.1', require: false
gem 'database_cleaner', '0.7.0'
end
在终端中,我运行了以下命令:
bundle install
rails generate cucumber:install
一切似乎都安装得很好。然后我将文件“signing_in.feature”添加到“features/”目录中。
Feature: Signing in
Scenario: Unsuccessful signin
Given a user visits the signin page
When he submits invalid signin information
Then he should see an error message
Scenario: Successful signin
Given a user visits the signin page
And the user has an account
And the user submits valid signin information
Then he should see his profile page
And he should see a signout link
然后我运行了这个:
bundle exec cucumber features/
这是终端的结果:
Using the default profile...
Feature: Signing in
0 scenarios
0 steps
0m0.000s
我想我预计会有 2 个场景和 2 个失败。有没有我遗漏的步骤?我在第 9 章中添加的任何内容会干扰这一点吗?
谢谢你。