Sha256: ad17d25203b2999562c819ea2bdca63ee5bb0dfc868c1d6eac7f3d72a26494e6

Contents?: true

Size: 761 Bytes

Versions: 14

Compression:

Stored size: 761 Bytes

Contents

require 'minitest_helper'

describe Rasti::Form::Types::UUID do

  ['f09b7716-81a9-11e6-a549-bb8f165bcf02', '12345678-1234-1234-1234-123456789123'].each do |value|
    it "#{value.inspect} -> #{value.to_s}" do
      Rasti::Form::Types::UUID.cast(value).must_equal value.to_s
    end
  end

  [nil, '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'].each do |value|
    it "#{value.inspect} -> CastError" do
      error = proc { Rasti::Form::Types::UUID.cast(value) }.must_raise Rasti::Form::CastError
      error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Form::Types::UUID"
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rasti-form-3.1.2 spec/types/uuid_spec.rb
rasti-form-3.1.1 spec/types/uuid_spec.rb
rasti-form-3.1.0 spec/types/uuid_spec.rb
rasti-form-3.0.0 spec/types/uuid_spec.rb
rasti-form-2.2.0 spec/types/uuid_spec.rb
rasti-form-2.1.0 spec/types/uuid_spec.rb
rasti-form-2.0.0 spec/types/uuid_spec.rb
rasti-form-1.1.1 spec/types/uuid_spec.rb
rasti-form-1.1.0 spec/types/uuid_spec.rb
rasti-form-1.0.3 spec/types/uuid_spec.rb
rasti-form-1.0.2 spec/types/uuid_spec.rb
rasti-form-1.0.1 spec/types/uuid_spec.rb
rasti-form-1.0.0 spec/types/uuid_spec.rb
rasti-form-0.1.0 spec/types/uuid_spec.rb