【问题标题】:Cucumber: undefined step, although step should be definedCucumber:未定义的步骤,虽然应该定义步骤
【发布时间】:2010-10-26 10:58:08
【问题描述】:

我已经创建了步骤:

    Given /^the feed "([^"]*)" has an item "([^"]*)" published at "([^"]*)"$/ do |feed_name, feed_item_title, published_at|
  feed = Feed.find_by_name(feed_name)
  FeedItem.make(:feed => feed, :title => feed_item_title, :published_at => published_at)
end

我运行黄瓜测试:

Scenario: feed items should be sorted by date
    Given I am signed into an account called "GT" as a customer
    And there is a social feed called "Twitter" for the account "GT"
    And the feed Twitter has an item Majbrasa published at "2010-05-01"
    --- more follows 

黄瓜状态:

7 steps (4 skipped, 1 undefined, 2 passed)
You can implement step definitions for undefined steps with these snippets:

Given /^the feed Twitter has an item Majbrasa published at "([^"]*)"$/ do |arg1|
  pending # express the regexp above with the code you wish you had
end

我只是看不出我的步骤有什么问题。我错过了什么? 提前致谢,埃米尔

【问题讨论】:

    标签: ruby-on-rails cucumber


    【解决方案1】:

    在您的步骤中,您需要在 Twitter 周围使用“”,因此在 Majbrasa 中使用它

    Scenario: feed items should be sorted by date
        Given I am signed into an account called "GT" as a customer
        And there is a social feed called "Twitter" for the account "GT"
        And the feed "Twitter" has an item "Majbrasa" published at "2010-05-01"
    

    【讨论】:

    • 非常感谢,真不敢相信我错过了。
    • rubular.com 是一个很好的资源,可以帮助您排除与您的步骤匹配的步骤定义。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 2022-08-19
    相关资源
    最近更新 更多