Sha256: b00975f23086713b626e5358be51d246a1cbe98cac01926871d6c478697299a4
Contents?: true
Size: 596 Bytes
Versions: 14
Compression:
Stored size: 596 Bytes
Contents
require 'minitest_helper' describe Rasti::Form::Types::Integer do [100, '200', Time.now, 2.1, "12.5"].each do |value| it "#{value.inspect} -> #{value.to_i}" do Rasti::Form::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::Form::Types::Integer.cast(value) }.must_raise Rasti::Form::CastError error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Form::Types::Integer" end end end
Version data entries
14 entries across 14 versions & 1 rubygems