Sha256: 2025c11bb245b0910da4d7b0397a2d3406f7cf52e3912c30fcd43c8f5e765ed7
Contents?: true
Size: 645 Bytes
Versions: 2
Compression:
Stored size: 645 Bytes
Contents
require 'minitest_helper' describe Rasti::Types::Integer do it 'nil -> nil' do Rasti::Types::Integer.cast(nil).must_equal nil end [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 ['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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rasti-types-2.0.1 | spec/integer_spec.rb |
rasti-types-2.0.0 | spec/integer_spec.rb |