3

我遇到了模棱两可的步骤定义错误。以下场景存在于不同的功能文件中,并且具有相同的步骤: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
4

1 回答 1

4

为什么不只保留 authentication_steps.rb 中的那个?我认为您可以使用任何功能文件中的所有步骤

于 2012-10-03T13:34:23.327 回答