Sha256: 4248d168415da52159ce7bfe0b30bc33b47f6e3ece77451c6c70be1dc9f51ede

Contents?: true

Size: 556 Bytes

Versions: 5

Compression:

Stored size: 556 Bytes

Contents

require 'minitest_helper'

describe Rasti::Form::Types::IO do
  
  [StringIO.new, File.new(__FILE__)].each do |value|
    it "#{value.inspect} -> #{value}" do
      Rasti::Form::Types::IO.cast(value).must_equal value
    end
  end

  [nil, 'text', 123, :symbol, [1,2], {a: 1, b: 2}, Object.new].each do |value|
    it "#{value.inspect} -> CastError" do
      error = proc { Rasti::Form::Types::IO.cast(value) }.must_raise Rasti::Form::CastError
      error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Form::Types::IO"
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rasti-form-3.1.2 spec/types/io_spec.rb
rasti-form-3.1.1 spec/types/io_spec.rb
rasti-form-3.1.0 spec/types/io_spec.rb
rasti-form-3.0.0 spec/types/io_spec.rb
rasti-form-2.2.0 spec/types/io_spec.rb