开发者

Rails, Cucumber and localized messages

开发者_开发知识库

I'm writing an application and I'm using localization everywhere I can. The problem is that I would like to test it using cucumber. I don't want to update the tests everytime the translation is changed. Is it possible to make cucumber understand something like that:

When I am logged in
Then I should see t(:login_ok)


Not tested, but I believe something like this should work:

Then /I should see t\(:?([^\)]*)\)/ do |text|
  Then "I should see #{I18n.translate(text)}"
end

This should be in features/step_definitions/???_steps.rb

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜