Sha256: 2de8141c2f31e021afd20c563331ce1b692458960e3a854117ee0aa185b7507b
Contents?: true
Size: 957 Bytes
Versions: 2
Compression:
Stored size: 957 Bytes
Contents
require 'spec_helper' describe Nation, type: :model do it 'should create a nation' do expect { Nation.make! }.not_to raise_error end it 'should require an abbr' do expect(Nation.make(abbr: nil)).to_not be_valid end it 'should validates uniqueness of abbr' do Nation.make!(abbr: 'BR') expect(Nation.make(abbr: 'BR')).to_not be_valid end it 'should have abbr as _id' do Nation.make!(abbr: 'BR') expect(Nation.first[:_id]).to eq('BR') end it 'should have abbr as id' do Nation.make!(abbr: 'BR') expect(Nation.first.id).to eq('BR') end it 'should equal by abbr' do expect(Nation.new(abbr: 'BR')).to eq(Nation.new(abbr: 'BR')) end it 'may have a localized name' do I18n.locale = :'pt-BR' n = Nation.new(name: 'Brasil') expect(n.name).to eq('Brasil') I18n.locale = :en n.name = 'Brazil' expect(n.name_translations).to eq('pt-BR' => 'Brasil', 'en' => 'Brazil') end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geopolitical-0.8.7 | spec/models/nation_spec.rb |
geopolitical-0.8.6 | spec/models/nation_spec.rb |