Sha256: c2a8a1c16d268d26b157f8460870d1b70352d1f9897e79d5685ccfd8e973d693
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require "spec_helper" describe AwesomeTranslations::Handlers::ModelHandler do # rubocop:disable RSpec/MultipleMemoizedHelpers let(:model_handler) { AwesomeTranslations::Handlers::ModelHandler.new } let(:groups) { model_handler.groups.to_a } let(:user_group) { model_handler.groups.detect { |group| group.name == "User" } } let(:role_group) { model_handler.groups.detect { |group| group.name == "Role" } } let(:translation_keys) { user_group.translations.map(&:key).to_a } let(:role_translation_keys) { role_group.translations.map(&:key).to_a } it "#groups" do expect(groups.length).to eq 5 end describe "#translations_for_group" do # rubocop:disable RSpec/MultipleMemoizedHelpers it "finds the right number of translations" do expect(user_group.translations.to_a.length).to eq 7 end it "finds the model translations" do expect(translation_keys).to include "activerecord.models.user.other" end it "finds the attribute translations" do expect(translation_keys).to include "activerecord.attributes.user.age" end it "finds the has_many association translations" do expect(translation_keys).to include "activerecord.attributes.user.roles" end it "finds money-rails translations" do expect(role_translation_keys).to include "activerecord.attributes.role.price" end end it "finds globalize translations" do expect(role_translation_keys).to include "activerecord.attributes.role.name" end end
Version data entries
3 entries across 3 versions & 1 rubygems