Sha256: 2c5668affff0ea65fef24ca92d9ea32b72d256a803dbd90630f885116bfca61b

Contents?: true

Size: 1016 Bytes

Versions: 3

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe Alephant::Renderer::I18n::LocaleComponentYaml do
  let(:template_path) { File.join(File.dirname(__FILE__), 'fixtures') }
  let(:locale) { 'en' }
  let(:namespace) { 'my_namespace' }

  subject { described_class.new(locale, namespace, template_path) }

  describe 'Performs a translation' do
    it 'should return a translated string in 1 locale' do
      expect(subject.t(:some_string)).to eq('some string')
    end
  end

  describe 'Overridding parameters' do
    it 'should return a translation from a different locale/component' do
      params = {
        locale: 'cy',
        scope:  'other_namespace',
        count:  1
      }
      expect(subject.t(:some_string, params)).to eq('another string')
    end

    it 'should return a pluralized translation with variable substitution' do
      params = {
        locale: 'cy',
        scope:  'other_namespace',
        count:  2
      }
      expect(subject.t(:some_string, params)).to eq('another 2 strings')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alephant-renderer-3.2.0 spec/integration/i18n_locale_component_yaml_spec.rb
alephant-renderer-3.1.0 spec/integration/i18n_locale_component_yaml_spec.rb
alephant-renderer-3.0.0 spec/integration/i18n_locale_component_yaml_spec.rb