test/tc_timezone_proxy.rb in tzinfo-0.2.2 vs test/tc_timezone_proxy.rb in tzinfo-0.3.0

- old
+ new

@@ -47,30 +47,40 @@ assert_equal(0, real <=> proxy) assert_equal(0, proxy <=> real) end def test_equals - assert(TimezoneProxy.new('Europe/London') == TimezoneProxy.new('Europe/London')) + assert_equal(true, TimezoneProxy.new('Europe/London') == TimezoneProxy.new('Europe/London')) + assert_equal(false, TimezoneProxy.new('Europe/London') == TimezoneProxy.new('Europe/Paris')) + assert_nil(TimezoneProxy.new('Europe/London') == Object.new) end def test_compare assert_equal(0, TimezoneProxy.new('Europe/London') <=> TimezoneProxy.new('Europe/London')) assert_equal(0, Timezone.get('Europe/London') <=> TimezoneProxy.new('Europe/London')) assert_equal(0, TimezoneProxy.new('Europe/London') <=> Timezone.get('Europe/London')) - assert((TimezoneProxy.new('Europe/London') <=> TimezoneProxy.new('Europe/Paris')) < 0) - assert((Timezone.get('Europe/London') <=> TimezoneProxy.new('Europe/Paris')) < 0) - assert((TimezoneProxy.new('Europe/London') <=> Timezone.get('Europe/Paris')) < 0) - assert((TimezoneProxy.new('Europe/Paris') <=> TimezoneProxy.new('Europe/London')) > 0) - assert((Timezone.get('Europe/Paris') <=> TimezoneProxy.new('Europe/London')) > 0) - assert((TimezoneProxy.new('Europe/Paris') <=> Timezone.get('Europe/London')) > 0) - assert((TimezoneProxy.new('America/New_York') <=> TimezoneProxy.new('Europe/Paris')) < 0) - assert((Timezone.get('America/New_York') <=> TimezoneProxy.new('Europe/Paris')) < 0) - assert((TimezoneProxy.new('America/New_York') <=> Timezone.get('Europe/Paris')) < 0) - assert((TimezoneProxy.new('Europe/Paris') <=> TimezoneProxy.new('America/New_York')) > 0) - assert((Timezone.get('Europe/Paris') <=> TimezoneProxy.new('America/New_York')) > 0) - assert((TimezoneProxy.new('Europe/Paris') <=> Timezone.get('America/New_York')) > 0) + assert_equal(-1, TimezoneProxy.new('Europe/London') <=> TimezoneProxy.new('Europe/Paris')) + assert_equal(-1, Timezone.get('Europe/London') <=> TimezoneProxy.new('Europe/Paris')) + assert_equal(-1, TimezoneProxy.new('Europe/London') <=> Timezone.get('Europe/Paris')) + assert_equal(1, TimezoneProxy.new('Europe/Paris') <=> TimezoneProxy.new('Europe/London')) + assert_equal(1, Timezone.get('Europe/Paris') <=> TimezoneProxy.new('Europe/London')) + assert_equal(1, TimezoneProxy.new('Europe/Paris') <=> Timezone.get('Europe/London')) + assert_equal(-1, TimezoneProxy.new('America/New_York') <=> TimezoneProxy.new('Europe/Paris')) + assert_equal(-1, Timezone.get('America/New_York') <=> TimezoneProxy.new('Europe/Paris')) + assert_equal(-1, TimezoneProxy.new('America/New_York') <=> Timezone.get('Europe/Paris')) + assert_equal(1, TimezoneProxy.new('Europe/Paris') <=> TimezoneProxy.new('America/New_York')) + assert_equal(1, Timezone.get('Europe/Paris') <=> TimezoneProxy.new('America/New_York')) + assert_equal(1, TimezoneProxy.new('Europe/Paris') <=> Timezone.get('America/New_York')) end def test_kind assert_kind_of(Timezone, TimezoneProxy.new('America/New_York')) + end + + def test_marshal + tp = TimezoneProxy.new('Europe/London') + tp2 = Marshal.load(Marshal.dump(tp)) + + assert_kind_of(TimezoneProxy, tp2) + assert_equal('Europe/London', tp2.identifier) end end \ No newline at end of file