2010-10-26 69 views
1

我已经创建步骤:黄瓜:未定义的一步,但一个步骤应该被定义

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 

我只是看不到我的步骤有什么问题。我错过了什么? 在此先感谢,周华健

回答

2

在你的脚步,你所需要的“” 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" 
+0

多谢,无法相信我错过了。 – 2010-10-26 12:09:32

+0

http://rubular.com/是一个很好的资源,可以帮助解决与您的步骤相匹配的步骤定义。 – burtlo 2010-11-12 02:26:54