Sha256: 524d3352d8225bc7f3a728fc4721283358e9414ed0e64583b871a2260d6a4dc6

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

require 'rails_helper'

module Dorsale
  RSpec.describe Address, :type => :model do
    it {should validate_presence_of :city}
    it {should belong_to :addressable}
    describe '#one_line' do
      it 'should build a one line address' do
        address = Address.create(street: '3 Rue Marx Dormoy', 
                                 street_bis: 'L\'atelier',
                                 zip: '13004',
                                 city: 'Marseille', 
                                 country: 'France')
        expect(address.one_line).to eq('3 Rue Marx Dormoy, L\'atelier, 13004 Marseille, France')
      end

      it 'should remove useless commas' do
        address = Address.create(street: '3 Rue Marx Dormoy', 
                                 street_bis: '',
                                 zip: '13004',
                                 city: 'Marseille', 
                                 country: '')
        expect(address.one_line).to eq('3 Rue Marx Dormoy, 13004 Marseille')
      end

      it 'should remove useless commas' do
        address = Address.create(street: '3 Rue Marx Dormoy', 
                                 street_bis: '',
                                 zip: '',
                                 city: 'Marseille', 
                                 country: '')
        expect(address.one_line).to eq('3 Rue Marx Dormoy, Marseille')
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dorsale-1.1.4 spec/models/dorsale/address_spec.rb
dorsale-1.1.3 spec/models/dorsale/address_spec.rb
dorsale-1.1.2 spec/models/dorsale/address_spec.rb
dorsale-1.1.1 spec/models/dorsale/address_spec.rb
dorsale-1.1.0 spec/models/dorsale/address_spec.rb
dorsale-1.0.4 spec/models/dorsale/address_spec.rb
dorsale-1.0.3 spec/models/dorsale/address_spec.rb
dorsale-1.0.2 spec/models/dorsale/address_spec.rb
dorsale-1.0.1 spec/models/dorsale/address_spec.rb
dorsale-1.0.0 spec/models/dorsale/address_spec.rb