Skip to content

Commit

Permalink
test for raw hash value accecss (issue #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
olegantonyan committed May 29, 2017
1 parent f085e78 commit 8003871
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/translateable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,21 @@
expect(Translateable.translateable_attribute_by_name(:title)).to eq 'title_translateable'
end
end

describe 'raw hash access' do
it 'allows to access raw JSONB value as hash' do
I18n.config.available_locales = %i(en ru de it)

I18n.locale = :en
object = TestModel.create!(title: 'Hello World')
I18n.locale = :de
object.title = 'Hallo Welt'

%i(en ru de it).each do |locale|
I18n.with_locale(locale) do
expect(object[:title]).to eq('en' => 'Hello World', 'de' => 'Hallo Welt')
end
end
end
end
end

0 comments on commit 8003871

Please sign in to comment.