Sha256: 09d002e2c1be074a571ac5c18c3667c5f6957c277d1e7e11527af120c9867164

Contents?: true

Size: 1020 Bytes

Versions: 23

Compression:

Stored size: 1020 Bytes

Contents

require 'spec_helper'

RSpec.describe MagicLocales::Locale, type: :model do
  
  describe 'should have usual attributes' do
    
    it { should respond_to :iso_code }
    it { should respond_to :name }
    
    it { should respond_to :translations }
    
    it { should respond_to :locale_state }
    
    it { should respond_to :translations }
    # it { should respond_to :translations_attributes }
    
  end
  
  describe 'validations' do 
    it { should validate_presence_of :iso_code }
    it { should validate_length_of(:iso_code).is_at_least(2) }
    it { should validate_length_of(:iso_code).is_at_most(6) }
    
    it { should_not allow_value('fiz').for(:iso_code) }
    it { should_not allow_value('Foo').for(:iso_code) }
    it { should_not allow_value('english').for(:iso_code) }
    it { should allow_value('en').for(:iso_code) }
    it { should allow_value('de').for(:iso_code) }
    it { should allow_value('de-DE').for(:iso_code) }
    it { should allow_value('dE-dE').for(:iso_code) }
  end
  
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
magic_locales-0.0.21 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.20 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.19 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.18 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.17 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.17.beta2 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.17.beta1 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.16 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.15 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.14 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.13 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.12 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.11 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.10 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.9 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.8 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.7 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.6 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.5 spec/models/magic_locales/locale_spec.rb
magic_locales-0.0.4 spec/models/magic_locales/locale_spec.rb