Sha256: 3c614311ced174b24e4e17b6e99aea8cd65898924c20d94b38acd68c20f1222b

Contents?: true

Size: 1.71 KB

Versions: 77

Compression:

Stored size: 1.71 KB

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), 'test_utils')

include TZInfo

class TCCountryIndexDefinition < Minitest::Test

  module CountriesTest1     
    include CountryIndexDefinition
    
    country 'ZZ', 'Country One' do |c|
      c.timezone 'Test/Zone/1', 3, 2, 41,20
    end
    
    country 'AA', 'Aland' do |c|
      c.timezone 'Test/Zone/3', 71,30, 358, 15
      c.timezone 'Test/Zone/2', 41, 20, 211, 30
    end
    
    country 'TE', 'Three'    
  end
  
  module CountriesTest2
    include CountryIndexDefinition
    
    country 'CO', 'First Country' do |c|
    end
  end
  
  def test_module_1
    hash = CountriesTest1.countries
    assert_equal(3, hash.length)
    assert_equal(true, hash.frozen?)
    
    zz = hash['ZZ']
    aa = hash['AA']
    te = hash['TE']
    
    assert_kind_of(RubyCountryInfo, zz)
    assert_equal('ZZ', zz.code)
    assert_equal('Country One', zz.name)
    assert_equal(1, zz.zones.length)
    assert_equal('Test/Zone/1', zz.zones[0].identifier)
    
    assert_kind_of(RubyCountryInfo, aa)
    assert_equal('AA', aa.code)
    assert_equal('Aland', aa.name)
    assert_equal(2, aa.zones.length)
    assert_equal('Test/Zone/3', aa.zones[0].identifier)
    assert_equal('Test/Zone/2', aa.zones[1].identifier)
    
    assert_kind_of(RubyCountryInfo, te)
    assert_equal('TE', te.code)
    assert_equal('Three', te.name)
    assert_equal(0, te.zones.length)    
  end
  
  def test_module_2
    hash = CountriesTest2.countries
    assert_equal(1, hash.length)
    assert_equal(true, hash.frozen?)
    
    co = hash['CO']
    
    assert_kind_of(RubyCountryInfo, co)
    assert_equal('CO', co.code)
    assert_equal('First Country', co.name)
    assert_equal(0, co.zones.length)
  end  
end

Version data entries

77 entries across 73 versions & 27 rubygems

Version Path
mumukit-content-type-1.12.1 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.11/test/tc_country_index_definition.rb
mumukit-content-type-1.12.0 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.11/test/tc_country_index_definition.rb
tzinfo-1.2.11 test/tc_country_index_definition.rb
tzinfo-1.2.10 test/tc_country_index_definition.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.9/test/tc_country_index_definition.rb
tzinfo-1.2.9 test/tc_country_index_definition.rb
tzinfo-1.2.8 test/tc_country_index_definition.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.6/test/tc_country_index_definition.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.7/test/tc_country_index_definition.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb
tzinfo-1.2.7 test/tc_country_index_definition.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.6/test/tc_country_index_definition.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/tzinfo-1.2.6/test/tc_country_index_definition.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/tzinfo-1.2.6/test/tc_country_index_definition.rb
tzinfo-1.2.6 test/tc_country_index_definition.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/tzinfo-1.2.5/test/tc_country_index_definition.rb