Sha256: e7da4f388a6905dca1d43eeb0137a6688f9b72f041eef002913867a625bc0711

Contents?: true

Size: 880 Bytes

Versions: 22

Compression:

Stored size: 880 Bytes

Contents

require 'rails_helper'

describe I18n do
  let(:translation) { Apiv1::Translation.new locale: "en", key: "dog", value: "dog" }

  context 'validity' do
    before { translation.valid? }
    subject { translation.errors }
    specify { should be_blank }
  end
  context 'saving' do
    subject { -> { translation.save! } }
    specify { should change(Apiv1::Translation, :count).by 1 }
  end
  context 'translation' do
    before { translation.save! }
    subject { I18n.t :dog }
    specify { should eq "dog" }
  end
  context 'memoization' do
    before { @tl = Apiv1::Translation.create! locale: "en", key: "some_sort_of_key", value: "some sort of key" }
    before { expect(Apiv1::Translation).to receive(:lookup).exactly(1).times.and_return([@tl]) }
    subject { I18n.t(:some_sort_of_key); I18n.t(:some_sort_of_key) }
    specify { should eq "some sort of key" }
  end
  
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
cloudrider-0.3.23 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.3.22 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.3.21 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.3.20 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.3.0 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.18 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.15 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.14 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.12 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.11 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.10 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.9 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.8 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.7 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.6 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.5 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.4 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.3 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.2 generica/spec/models/i18n/backend/active_record_spec.rb
cloudrider-0.2.1 generica/spec/models/i18n/backend/active_record_spec.rb