Sha256: a114a4ef7bf106d1cfbb4c8fb3d924e87cbf54fcf563ce1006b2d86fc2f59e34

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 KB

Contents

require "spec_helper"

describe AwesomeTranslations::Handlers::ValidationsHandler do
  let(:validations_handler) { AwesomeTranslations::Handlers::ValidationsHandler.new }
  let(:user_group) { validations_handler.groups.find { |group| group.name == "User" } }
  let(:blank_email_translation) { user_group.translations.find { |translation| translation.key.include? "email.blank" } }

  it "#groups" do
    expect(validations_handler.groups.to_a.length).to eq 4
  end

  describe "#translations_for_group" do
    it "finds the right number of validation translations" do
      expect(user_group.translations.to_a.length).to eq 6
    end

    it "finds the right key" do
      expect(blank_email_translation.key).to eq "activerecord.errors.models.user.attributes.email.blank"
    end

    it "finds the right directory" do
      expect(blank_email_translation.dir).to eq "#{Rails.root}/config/locales/awesome_translations/models/user"
    end

    it "finds confirmation translations" do
      confirmation_translation = user_group.translations.find { |translation| translation.key.include? "email_confirmation" }
      expect(confirmation_translation).to_not be_blank
      expect(confirmation_translation.key).to eq "activerecord.attributes.user.email_confirmation"
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
awesome_translations-0.0.39 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.38 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.37 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.36 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.35 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.34 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.33 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.32 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.31 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.30 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.29 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.28 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.27 spec/handlers/validations_handler_spec.rb
awesome_translations-0.0.26 spec/handlers/validations_handler_spec.rb