Sha256: 47538283f40738c46c999f7b4bcfa40b5d053ad3d2fbb83a22e7f6fef2419017

Contents?: true

Size: 1.49 KB

Versions: 62

Compression:

Stored size: 1.49 KB

Contents

require 'test_helper'

module Workarea
  class AddressEqualityTest < Workarea::TestCase
    setup do
      @address_attributes = {
        first_name: 'Ben',
        last_name: 'Crouse',
        street: '22 S. 3rd St.',
        street_2: 'Second Floor',
        city: 'Philadelphia',
        region: 'PA',
        postal_code: '19106',
        country: 'US',
        phone_number: '2159251800'
      }

      @address = Address.new(@address_attributes)
    end

    def test_equal_attributes
      equal_address = Address.new(@address_attributes)
      assert(@address.address_eql?(equal_address))
    end

    def test_empty_address
      empty_address = Address.new
      refute(@address.address_eql?(empty_address))
    end

    def test_not_equal_attributes
      not_equal_address = Address.new(
        first_name: 'Ben',
        last_name: 'Crouse',
        street: '1019 S. 47th St.',
        city: 'Philadelphia',
        region: 'PA',
        postal_code: '19143',
        country: 'US',
        phone_number: '2159251800'
      )

      refute(@address.address_eql?(not_equal_address))
    end

    def test_ignoring_whitespace
      equal_address = Address.new(
        first_name: 'ben',
        last_name: 'crouse',
        street: ' 22 s. 3rd  st.',
        street_2: 'second   floor',
        city: 'philadelphia  ',
        region: 'pa',
        postal_code: '19106',
        country: 'us',
        phone_number: '2159251800'
      )

      assert(@address.address_eql?(equal_address))
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 test/models/workarea/address_equality_test.rb
workarea-core-3.4.36 test/models/workarea/address_equality_test.rb
workarea-core-3.5.14 test/models/workarea/address_equality_test.rb
workarea-core-3.4.35 test/models/workarea/address_equality_test.rb
workarea-core-3.5.13 test/models/workarea/address_equality_test.rb
workarea-core-3.4.34 test/models/workarea/address_equality_test.rb
workarea-core-3.5.12 test/models/workarea/address_equality_test.rb
workarea-core-3.4.33 test/models/workarea/address_equality_test.rb
workarea-core-3.5.11 test/models/workarea/address_equality_test.rb
workarea-core-3.5.10 test/models/workarea/address_equality_test.rb
workarea-core-3.4.32 test/models/workarea/address_equality_test.rb
workarea-core-3.5.9 test/models/workarea/address_equality_test.rb
workarea-core-3.4.31 test/models/workarea/address_equality_test.rb
workarea-core-3.5.8 test/models/workarea/address_equality_test.rb
workarea-core-3.4.30 test/models/workarea/address_equality_test.rb
workarea-core-3.5.7 test/models/workarea/address_equality_test.rb
workarea-core-3.4.29 test/models/workarea/address_equality_test.rb
workarea-core-3.5.6 test/models/workarea/address_equality_test.rb
workarea-core-3.4.28 test/models/workarea/address_equality_test.rb
workarea-core-3.5.5 test/models/workarea/address_equality_test.rb