开发者

Cucumber: undefined step, although step should be defined

开发者 https://www.devze.com 2023-01-21 19:59 出处:网络
I have created the step: Given /^the feed \"([^\"]*)\" has an item \"([^\"]*)\" published at \"([^\"]*)\"$/ do |feed_name, feed_item_title, published_at|

I have created the step:

    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

And I run the cucumber test with:

Scenario: feed items should be sorted by date
   开发者_C百科 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 

Cucumber states:

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

I just can't see what's wrong with my step. What is it that I'm missing? Thanks in advance, Emil


In your step you need the " " around Twitter so use it same about 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"
0

精彩评论

暂无评论...
验证码 换一张
取 消