Sha256: 64dcf70d09d7c8820509036b55f57d384c9ca85e7bc2c79802516b7e1e34797c

Contents?: true

Size: 981 Bytes

Versions: 6

Compression:

Stored size: 981 Bytes

Contents

# encoding: UTF-8
require 'test_helper'

module Graticule
  class PrecisionTest < Test::Unit::TestCase
    def test_constants_exist
      %w(
        Unknown
        Country
        Region
        Locality
        PostalCode
        Street
        Address
        Premise
      ).each do |const|
        assert Precision.const_defined?(const), "Can't find #{const}"
      end
    end

    def test_can_compare_precisions
      assert Precision::Country < Precision::Region
      assert Precision::Country > Precision::Unknown
      assert Precision::Country == Precision::Country
      assert Precision::Country == Precision.new(:country)
      assert Precision::Country != Precision::Premise
    end

    def test_can_compare_against_symbols
      assert Precision::Country < :region
    end

    def test_can_compare_against_symbols
      assert_raise(ArgumentError) { Precision::Unknown > :foo }
      assert_raise(ArgumentError) { Precision::Unknown == :bar }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graticule-2.7.2 test/graticule/precision_test.rb
graticule-2.7.1 test/graticule/precision_test.rb
graticule-2.7.0 test/graticule/precision_test.rb
graticule-2.6.0 test/graticule/precision_test.rb
graticule-2.5.0 test/graticule/precision_test.rb
graticule-2.4.0 test/graticule/precision_test.rb