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.27 test/models/workarea/address_equality_test.rb
workarea-core-3.5.26 test/models/workarea/address_equality_test.rb
workarea-core-3.4.45 test/models/workarea/address_equality_test.rb
workarea-core-3.5.25 test/models/workarea/address_equality_test.rb
workarea-core-3.5.23 test/models/workarea/address_equality_test.rb
workarea-core-3.4.44 test/models/workarea/address_equality_test.rb
workarea-core-3.5.22 test/models/workarea/address_equality_test.rb
workarea-core-3.4.43 test/models/workarea/address_equality_test.rb
workarea-core-3.5.21 test/models/workarea/address_equality_test.rb
workarea-core-3.4.42 test/models/workarea/address_equality_test.rb
workarea-core-3.5.20 test/models/workarea/address_equality_test.rb
workarea-core-3.4.41 test/models/workarea/address_equality_test.rb
workarea-core-3.5.19 test/models/workarea/address_equality_test.rb
workarea-core-3.4.40 test/models/workarea/address_equality_test.rb
workarea-core-3.5.18 test/models/workarea/address_equality_test.rb
workarea-core-3.4.39 test/models/workarea/address_equality_test.rb
workarea-core-3.5.17 test/models/workarea/address_equality_test.rb
workarea-core-3.4.38 test/models/workarea/address_equality_test.rb
workarea-core-3.5.16 test/models/workarea/address_equality_test.rb
workarea-core-3.4.37 test/models/workarea/address_equality_test.rb