Sha256: 1f85c4b820e0f2370c837f718c7c4d6aa3e4f01386637ded8873e70a2eb05ea4
Contents?: true
Size: 1.21 KB
Versions: 30
Compression:
Stored size: 1.21 KB
Contents
# frozen_string_literal: true require 'timezone/lookup' require 'minitest/autorun' class TestLookup < ::Minitest::Test def test_test_config Timezone::Lookup.config(:test) assert_equal Timezone::Lookup::Test, Timezone::Lookup.lookup.class end def test_geonames_config Timezone::Lookup.config(:geonames) do |c| c.username = 'foo' end assert_equal Timezone::Lookup::Geonames, Timezone::Lookup.lookup.class assert_equal Timezone::NetHTTPClient, Timezone::Lookup.lookup.config.request_handler end def test_google_config Timezone::Lookup.config(:google) do |c| c.api_key = 'foo' end assert_equal Timezone::Lookup::Google, Timezone::Lookup.lookup.class assert_equal Timezone::NetHTTPClient, Timezone::Lookup.lookup.config.request_handler end def test_custom_config custom_lookup = Class.new do def initialize(config); end end Timezone::Lookup.config(custom_lookup) assert_equal custom_lookup, Timezone::Lookup.lookup.class end def test_missing_config Timezone::Lookup.instance_variable_set(:@lookup, nil) assert_raises Timezone::Error::InvalidConfig do Timezone::Lookup.lookup end end end
Version data entries
30 entries across 30 versions & 1 rubygems