【发布时间】:2012-10-03 13:14:08
【问题描述】:
我遇到了模棱两可的步骤定义错误。以下场景存在于不同的功能文件中,并且具有相同的步骤:Then I should see my profile page。如何避免这种情况发生?
# authentication.feature
Scenario: Successful sign in
Given I visit the sign in page
When I submit valid sign in information
Then I should see my profile page
# signing_up.feature
Scenario: Successful sign up
Given I visit the sign up page
When I submit valid information
Then I should see my profile page
# authentication_steps.rb
...
Then /^I should see my profile page$/ do
page.current_path.should == user_path(@user)
end
# signing_up.feature
...
Then /^I should see my profile page$/ do
page.current_path.should == user_path(@user)
end
我也遇到了这个错误消息的问题:
Scenario: Unsuccessful sign up
...
Then I should see an error message
Scenario: Unsuccessful login
...
Then I should see an error message
【问题讨论】:
-
请显示这些步骤定义。如果它们相同,您只需要一个。如果他们做不同的事情,那么他们应该有不同的名字
-
@IsmaelAbreu,我添加了步骤定义!
标签: ruby-on-rails ruby testing cucumber bdd