Sha256: 1cde27fc762056d9cf3c36b847f5dfafe5b25ab7496294a32d143f1b071d9d59

Contents?: true

Size: 531 Bytes

Versions: 4

Compression:

Stored size: 531 Bytes

Contents

require 'minitest_helper'

describe Rasti::Types::IO do

  [StringIO.new, File.new(__FILE__)].each do |value|
    it "#{value.inspect} -> #{value}" do
      Rasti::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::Types::IO.cast(value) }.must_raise Rasti::Types::CastError
      error.message.must_equal "Invalid cast: #{as_string(value)} -> Rasti::Types::IO"
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasti-types-1.1.2 spec/io_spec.rb
rasti-types-1.1.1 spec/io_spec.rb
rasti-types-1.1.0 spec/io_spec.rb
rasti-types-1.0.0 spec/io_spec.rb