Undefined Pickle step (again)
https://stackoverflow.com/questions/5282437/cucumber-pickle-factory-girl-given-a-returning-undefined-step - this post didn't help me a lot.
Gemfile:
gem 'rails' # 3.0.5
gem 'capybara' # 1.1.1
gem 'rspec-rails' # 2.6.1
gem 'cucumber-rails' # 1.0.5
gem 'database_cleaner'
gem 'factory_girl_rails' # 1.2.0
gem 'email_spec'
gem 'pickle' # 0.4.8
I do:
rails new pickle_test
bundle install
rails g cucumber:install
rails g rspec:install
rails g pickle --paths --email
rails g scaffold category title:string
rake db:migrate
rake db:test:prepare
cucumber
I have:
$ cucumber
Using the default profile...
Feature: Manage categories
Scenario: list existed categories # features/manage_categories.feature:3
Given a category exists, title: "First category ever" # features/manage_categories.feature:4
Undefined step: "a category exists, title: "First category ever"" (Cucumber::Undefined)
features/manage_categories.feature:4:in `Given a category exists, title: "First category ever"'
When I go to the categories page # features/step_definitions/web_steps.rb:48
Then I should see "First category ever" # features/step_definitions/web_steps.rb:105
1 scenario (1 undefined)
3 steps (2 skipped, 1 undefined)
0m0.127s
You can implement step definitions for undefined steps with these snippets:
Given /^a category exists, title: "([^"]*)"$/ do |arg1|
pending # express the regexp above with the code you wish you had
end
Note that I did nothing to configure this test app anyhow and I don't use factory_girl or 开发者_如何学Pythonanything rather then ActiveRecord. I'm confident it should work from there. Pickle itself is loaded (tested with puts), cucumber runs using environments/test.rb.
What I am missing?
Your step def is not using the correct phraseology.
The default Pickle steps (you should feel free to adapt them to your app/style) expect the following:
Given a category exists with title: "First category ever"
Cheers, Ian
精彩评论