Sha256: f80dca5a11dd204a4ad13d8110a11d4a943bc950b32e3accda444e443dd27cb0
Contents?: true
Size: 861 Bytes
Versions: 1
Compression:
Stored size: 861 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::UUID do it 'nil -> nil' do Rasti::Types::UUID.cast(nil).must_equal nil end ['f09b7716-81a9-11e6-a549-bb8f165bcf02', '12345678-1234-1234-1234-123456789123'].each do |value| it "#{value.inspect} -> #{value.to_s}" do Rasti::Types::UUID.cast(value).must_equal value.to_s end end ['text', :symbol, '999'.to_sym, [1,2], {a: 1, b: 2}, Object.new, 5, 'f09b7716-81a9-11e6-a549-bb16502', 'f09b7716-11e6-a549-bb8f16502', '-84a9-11e6-a549-bb8f16502', 'f09b7716-81a9-11e6-a549-bh16502', 'bab8292a-0f49-4094-8d0a-e1e0f57953e2e1e0f57953e2'].each do |value| it "#{value.inspect} -> CastError" do error = proc { Rasti::Types::UUID.cast(value) }.must_raise Rasti::Types::CastError error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Types::UUID" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-2.0.1 | spec/uuid_spec.rb |