Sha256: f86b4b0f3b4fcbb41498d28f65249eca0c49ef8f5fcd637b5893c5c1b98d5cc1
Contents?: true
Size: 805 Bytes
Versions: 2
Compression:
Stored size: 805 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::Boolean do it 'nil -> nil' do Rasti::Types::Boolean.cast(nil).must_equal nil end [true, 'true', 'True', 'TRUE', 'T'].each do |value| it "#{value.inspect} -> true" do Rasti::Types::Boolean.cast(value).must_equal true end end [false, 'false', 'False', 'FALSE', 'F'].each do |value| it "#{value.inspect} -> false" do Rasti::Types::Boolean.cast(value).must_equal false end end ['text', 123, :false, :true, Time.now, [1,2], {a: 1, b: 2}, Object.new].each do |value| it "#{value.inspect} -> CastError" do error = proc { Rasti::Types::Boolean.cast(value) }.must_raise Rasti::Types::CastError error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Types::Boolean" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-2.0.1 | spec/boolean_spec.rb |
rasti-types-2.0.0 | spec/boolean_spec.rb |