Sha256: cff3b9299cda01a2b2a06d7110a070aded042f40e777d35bfaeed5fcbcc0dbee

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'spec_helper'
require 'fixtures/components/foo/models/welsh'

describe Alephant::Views::Base do
  let(:base_path) do
    File.join(
      File.dirname(__FILE__),
      'fixtures',
      'components',
      'foo'
    )
  end

  describe "t(key, param{})" do
    it "Translates a key for the default locale" do
      Alephant::Renderer.create('foo', base_path, :model)

      expect(subject.t('bar')).to eq('Translation')
    end

    it "Translates a key for an overridden locale" do
      Alephant::Renderer.create('welsh', base_path, :model)

      expect(Fixtures::Welsh.new.t('bar')).to eq('Welsh Translation')
    end

    it "Uses the translation keys value if no translation and no default set" do
      Alephant::Renderer.create('welsh', base_path, :model)

      expect(Fixtures::Welsh.new.t('non_existent')).to eq('non_existent')
    end
  end

  describe "t(key, param{:default => 'A default'})" do
    it "Uses the passed in default if translation key does not exist" do
      Alephant::Renderer.create('welsh', base_path, :model)

      expect(Fixtures::Welsh.new.t('non_existent', :default => 'A default')).to eq('A default')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alephant-renderer-0.0.10 spec/views_base_spec.rb