Skip to content

Commit

Permalink
Merge the existing translations before testing. (#772)
Browse files Browse the repository at this point in the history
`with_translations` is used to test that a view does actually implement
a given translation. Previously, we were resetting the known
translations to only use the one under test. We now have many more
translations so this approach will fail when visiting a page because of
"missing translations".

Example: https://git.io/vywpc

This came up when merging #344.
  • Loading branch information
nickcharlton authored Mar 17, 2017
1 parent ebcf731 commit 512acae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions spec/support/i18n.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
def with_translations(locale, translations)
original_backend = I18n.backend

I18n.backend = I18n::Backend::KeyValue.new({}, true)
I18n.backend.store_translations(locale, translations)
new_backend = I18n::Backend::KeyValue.new({}, true)
new_backend.store_translations(locale, translations)

I18n.backend = I18n::Backend::Chain.new(original_backend, new_backend)

yield
ensure
Expand Down

0 comments on commit 512acae

Please sign in to comment.