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
精彩评论