2010-10-26 121 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