Sha256: 849d7816600f414966bee63dcb9a9328c9aecffe993ee9912fd418248f0e5031

Contents?: true

Size: 808 Bytes

Versions: 52

Compression:

Stored size: 808 Bytes

Contents

require "rails_helper"

# TODO : test FR + EN

RSpec.describe "i18n" do
  Rails.application.eager_load!

  ::Dorsale::ApplicationRecord.descendants.each do |model|
    next unless model.to_s.start_with?("Dorsale")

    it "should i18n #{model} model name" do
      i18n = model.model_name.human(default: "")
      expect(i18n).to be_present
    end

    model.column_names.each do |column_name|
      next if column_name.end_with?("_type")
      next if column_name.end_with?("_bak")
      next if column_name.start_with?("old_")

      # user_id => user
      column_name = column_name[0..-4] if column_name.end_with?("_id")

      it "should i18n #{model}##{column_name}" do
        i18n = model.human_attribute_name(column_name, default: "")
        expect(i18n).to be_present
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
dorsale-3.7.5 spec/models/dorsale/i18n_spec.rb
dorsale-3.7.4 spec/models/dorsale/i18n_spec.rb
dorsale-3.7.2 spec/models/dorsale/i18n_spec.rb
dorsale-3.7.1 spec/models/dorsale/i18n_spec.rb
dorsale-3.7.0 spec/models/dorsale/i18n_spec.rb
dorsale-3.6.1 spec/models/dorsale/i18n_spec.rb
dorsale-3.6.0 spec/models/dorsale/i18n_spec.rb
dorsale-3.5.2 spec/models/dorsale/i18n_spec.rb
dorsale-3.5.1 spec/models/dorsale/i18n_spec.rb
dorsale-3.5.0 spec/models/dorsale/i18n_spec.rb
dorsale-3.4.0 spec/models/dorsale/i18n_spec.rb
dorsale-3.3.0 spec/models/dorsale/i18n_spec.rb