我对 Cucumber 还很陌生,并且在这个场景的最后一步遇到了麻烦:
Scenario:
Given I am on the sign up page
When I create an account
Then a new list should be created for my account at the same time
我的模型:
User has_one :list, dependent: :destroy
List belongs_to :user
我的步骤定义(我没有第 3 步的任何内容)
Given(/^I am on the sign up page$/) do
visit new_user_registration_path
end
When(/^I create an account$/) do
fill_in 'Username', with: 'Test'
fill_in 'Email', with: 'test@example.com'
fill_in 'Password', with: 'abc12345'
fill_in 'Password confirmation', with: 'abc12345'
click_button 'Submit sign up'
end
Then(/^a new list should be created for me at the same time$/) do
pending
end
我的步骤定义应该如何查找最后一步?我基本上只是想确保在创建新用户后,同时创建他们的关联列表。
我看过pickle gem,但我对此还是很陌生,我不确定pickle_steps.rb 文件中是否有相关步骤。
谢谢!