Sha256: d023022ae9aaa4e7421107ade2f8dec8d5b755aaa1029de117f5de8fa351963e

Contents?: true

Size: 1.27 KB

Versions: 48

Compression:

Stored size: 1.27 KB

Contents

require 'rails_helper'

RSpec.describe 'Translations', type: :model do
  {
    Cmor::Files::Folder     => {},
    Cmor::Files::FileDetail => {},
  }.each do |model, options|
    I18n.available_locales.each do |locale|
      I18n.locale = locale

      describe "for locale #{locale}:" do
        describe "#{model} translations" do
          it 'include one' do
            I18n.locale = locale
            i18n_key = ['activerecord', 'models', model.name.underscore].join('.')
            i18n_options = {}
            expect(I18n.translate!(i18n_key, options)[:one]).to be_a(String)
          end

          it 'include other' do
            I18n.locale = locale
            i18n_key = ['activerecord', 'models', model.name.underscore].join('.')
            i18n_options = {}
            expect(I18n.translate!(i18n_key, options)[:other]).to be_a(String)
          end

          describe 'for attributes' do

            model.column_names.each do |column_name|
              it "include #{column_name}" do
                I18n.locale = locale
                i18n_key = ['activerecord', 'attributes', model.name.underscore, column_name].join('.')
                expect(I18n.translate!(i18n_key)).to be_a(String)
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
cmor_files-0.0.29.pre spec/models/i18n_spec.rb
cmor_files-0.0.28.pre spec/models/i18n_spec.rb
cmor_files-0.0.27.pre spec/models/i18n_spec.rb
cmor_files-0.0.26.pre spec/models/i18n_spec.rb
cmor_files-0.0.25.pre spec/models/i18n_spec.rb
cmor_files-0.0.24.pre spec/models/i18n_spec.rb
cmor_files-0.0.22.pre spec/models/i18n_spec.rb
cmor_files-0.0.21.pre spec/models/i18n_spec.rb
cmor_files-0.0.20.pre spec/models/i18n_spec.rb
cmor_files-0.0.19.pre spec/models/i18n_spec.rb
cmor_files-0.0.18.pre spec/models/i18n_spec.rb
cmor_files-0.0.17.pre spec/models/i18n_spec.rb
cmor_files-0.0.16.pre spec/models/i18n_spec.rb
cmor_files-0.0.15.pre spec/models/i18n_spec.rb
cmor_files-0.0.14.pre spec/models/i18n_spec.rb
cmor_files-0.0.13.pre spec/models/i18n_spec.rb
cmor_files-0.0.12.pre spec/models/i18n_spec.rb
cmor_files-0.0.11.pre spec/models/i18n_spec.rb
cmor_files-0.0.10.pre spec/models/i18n_spec.rb
cmor_files-0.0.9.pre spec/models/i18n_spec.rb