Sha256: f3bc66d8269793a8b236d3fb9adf7c7321f6f859cbbf689375912ca7dc8ca0b7

Contents?: true

Size: 868 Bytes

Versions: 26

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

require 'timezone/lookup/test'
require 'timezone'
require 'minitest/autorun'

class TestTest < ::Minitest::Test
  parallelize_me!

  def lookup
    Timezone::Lookup::Test.new(OpenStruct.new)
  end

  def test_simple_stub
    mine = lookup
    mine.stub(-10, 10, 'America/Los_Angeles')

    assert_equal 'America/Los_Angeles', mine.lookup(-10, 10)
  end

  def test_simple_unstub
    mine = lookup
    mine.stub(-10, 10, nil)

    assert_nil mine.lookup(-10, 10)

    mine.unstub(-10, 10)
    assert_raises(::Timezone::Error::Test) do
      mine.lookup(-10, 10)
    end
  end

  def test_missing_stub
    assert_raises(::Timezone::Error::Test) do
      lookup.lookup(100, 100)
    end
  end

  def test_default_stub
    mine = lookup
    mine.default('America/Toronto')

    assert_equal 'America/Toronto', mine.lookup(-12, 12)
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
timezone-1.3.25 test/timezone/lookup/test_test.rb
timezone-1.3.24 test/timezone/lookup/test_test.rb
timezone-1.3.23 test/timezone/lookup/test_test.rb
timezone-1.3.22 test/timezone/lookup/test_test.rb
timezone-1.3.21 test/timezone/lookup/test_test.rb
timezone-1.3.20 test/timezone/lookup/test_test.rb
timezone-1.3.19 test/timezone/lookup/test_test.rb
timezone-1.3.18 test/timezone/lookup/test_test.rb
timezone-1.3.17 test/timezone/lookup/test_test.rb
timezone-1.3.16 test/timezone/lookup/test_test.rb
timezone-1.3.15 test/timezone/lookup/test_test.rb
timezone-1.3.14 test/timezone/lookup/test_test.rb
timezone-1.3.13 test/timezone/lookup/test_test.rb
timezone-1.3.12 test/timezone/lookup/test_test.rb
timezone-1.3.11 test/timezone/lookup/test_test.rb
timezone-1.3.10 test/timezone/lookup/test_test.rb
timezone-1.3.9 test/timezone/lookup/test_test.rb
timezone-1.3.8 test/timezone/lookup/test_test.rb
timezone-1.3.7 test/timezone/lookup/test_test.rb
timezone-1.3.6 test/timezone/lookup/test_test.rb