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.15 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.36 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.14 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.35 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.13 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.34 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.12 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.33 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.11 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.10 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.32 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.9 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.31 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.8 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.30 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.7 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.29 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.6 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.4.28 test/helpers/workarea/addresses_helper_test.rb
workarea-core-3.5.5 test/helpers/workarea/addresses_helper_test.rb