2013-02-13 48 views
0

我試圖做到這一點:如何從黃瓜步驟訪問語言字符串?

Then /^I should see a message saying I have no narratives$/ do 
    page.should have_content t(:no_narratives_on_recent_activity_page) 
end 

但T()不可用。這個想法是,如果我手動輸入期望的文本,然後改變i18n字符串它會打破這一步,所以我想首先使用國際字符串測試。

如何在黃瓜步驟中訪問t()助手(或類似的東西)?

回答

0

I18n應該被加載,所以你可以簡單地直接發送方法(而不是使用傭工)

Then /^I should see a message saying I have no narratives$/ do 
    page.should have_content I18n.t(:no_narratives_on_recent_activity_page) 
end