Sha256: bea1138e9af93e0b32cb8c695155a3f0f98fd05a5e5c60082c192591fa41c6eb

Contents?: true

Size: 811 Bytes

Versions: 54

Compression:

Stored size: 811 Bytes

Contents

require 'spec_helper'

describe Locomotive::Steam::Liquid::Filters::Translate do

  include Locomotive::Steam::Liquid::Filters::Translate

  let(:services)      { Locomotive::Steam::Services.build_instance }
  let(:translator)    { services.translator }
  let(:context)       { instance_double('Context', registers: { services: services }) }

  before { @context = context }

  describe '#translate' do

    before { allow(translator).to receive(:translate).and_return(translation) }

    let(:input)       { 'example_text' }
    let(:translation) { 'Example text' }

    subject { translate(input) }

    it { is_expected.to eq 'Example text' }

    describe 'no translation found, displays the key itself' do

      let(:translation) { nil }
      it { is_expected.to eq 'example_text' }

    end

  end

end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
locomotivecms_steam-1.8.0.alpha2 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.8.0.alpha1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.7.1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.7.0 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.6.1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.6.0 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.6.0.rc1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.6.0.beta1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.3 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.2 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0.rc1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0.rc0 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0.beta3 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0.beta2 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.5.0.beta1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.4.1 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.4.0 spec/unit/liquid/filters/translate_spec.rb
locomotivecms_steam-1.4.0.rc2 spec/unit/liquid/filters/translate_spec.rb