Nov 23
Using Cucumber to test a multilingual app
Save this in features/support/i18n_support.rb and you are done :)
# allows using translations in cucumber:
# When I follow ":helpers.record.new"
# When I follow ":helpers.record.new{:resource_name => Company.model_name.human}"
Transform /^:.+$/ do |key|
if key =~ /\{.*\}/
args = eval($~.to_s)
key = key.sub(/\{.*\}/, '')
else
args = {}
end
I18n.t(key[1..-1], args)
end
I am Bojan Mihelac and this blog is dedicated to share code, thoughts, tools and advices I came up with while working at 
blog comments powered by Disqus