Sha256: eb76f9451047e8353cd60811c4a51343f4a98c21db2dbd31940de7e997b077bd
Contents?: true
Size: 571 Bytes
Versions: 4
Compression:
Stored size: 571 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::Integer do [100, '200', Time.now, 2.1, "12.5"].each do |value| it "#{value.inspect} -> #{value.to_i}" do Rasti::Types::Integer.cast(value).must_equal value.to_i end end [nil, 'text', :symbol, '999'.to_sym, [1,2], {a: 1, b: 2}, Object.new].each do |value| it "#{value.inspect} -> CastError" do error = proc { Rasti::Types::Integer.cast(value) }.must_raise Rasti::Types::CastError error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Types::Integer" end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-1.1.2 | spec/integer_spec.rb |
rasti-types-1.1.1 | spec/integer_spec.rb |
rasti-types-1.1.0 | spec/integer_spec.rb |
rasti-types-1.0.0 | spec/integer_spec.rb |