1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
thoughtbot--shoulda-matchers/spec/support/i18n_faker.rb
Alan Heywood d92d548d42 Allow the use of %{attribute} or %{model} in i18n translations.
Fix a bug where shoulda was raising an exception, when a translation
in en.yml was modified to include %{attribute} or %{model}
2013-04-12 17:10:18 -04:00

10 lines
242 B
Ruby

module I18nFaker
def stub_translation(key, message)
yml = key.split('.').reverse.inject(message) { |a, n| { n => a } }
I18n.backend.store_translations(:en, yml)
end
end
RSpec.configure do |config|
config.include I18nFaker
end