Sha256: 1850dd627ae1cef66b1027291ef0853b7046221902c7a1bed2368134b6ad8685

Contents?: true

Size: 1.07 KB

Versions: 62

Compression:

Stored size: 1.07 KB

Contents

require 'test_helper'

module Workarea
  class AddressesHelperTest < ViewTest
    setup :set_config
    teardown :reset_config

    def set_config
      @current_countries = Workarea.config.countries
      Workarea.config.countries = [Country['US'], Country['CA']]
    end

    def reset_config
      Workarea.config.countries = @current_countries
    end

    def test_country_options
      assert_equal(
        [['United States of America', 'US'], ['Canada', 'CA']],
        country_options
      )
    end

    def test_region_options
      regions = region_options.first.last
      nb = regions.find_index { |name, id| name == 'Nebraska' }
      nd = regions.find_index { |name, id| name == 'North Dakota' }

      assert_includes(regions, ['Pennsylvania', 'PA'])
      refute_nil(nb)
      refute_nil(nd)
      assert_operator(nb, :<, nd)
    end

    def test_region_options_with_nonexistent_names
      Workarea.config.countries = [Country['GB']]
      regions = region_options.first.last

      assert_includes(regions, ['Armagh, Banbridge and Craigavon', 'ABC'])
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.26 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.45 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.25 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.23 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.44 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.22 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.43 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.21 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.42 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.20 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.41 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.19 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.40 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.18 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.39 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.17 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.38 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.16 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.37 test/helpers/workarea/addresses_helper_test.rb