Sha256: af8105cdb0d929c5c8d61f956d2aa14197deab8b7cf18c4164999a821f956a49

Contents?: true

Size: 594 Bytes

Versions: 3

Compression:

Stored size: 594 Bytes

Contents

shared_examples_for "a proper translator" do
  it "#field must return a translation" do
    I18n.with_locale(:en) do
      expect(@user.first_name).to eq 'Jon'
    end
  end

  context "when the translation data doesn't contain the desired language" do
    it "#field must return nil" do
      I18n.with_locale(:de) do
        expect(@user.first_name).to be_nil
      end
    end
  end

  context "when the translation data doesn't contain the desired field" do
    it "#field must return nil" do
      I18n.with_locale(:en) do
        expect(@user.title).to be_nil
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lost_in_translations-1.4.0 spec/support/shared_examples/proper_translator.rb
lost_in_translations-1.3.2 spec/support/shared_examples/proper_translator.rb
lost_in_translations-1.3.1 spec/support/shared_examples/proper_translator.rb