Sha256: f9c848457871a1a006677fd666b1fe7c2cf85e88f8965bacfb5231791aacd2e4

Contents?: true

Size: 481 Bytes

Versions: 4

Compression:

Stored size: 481 Bytes

Contents

require 'minitest_helper'

describe Rasti::Types::String do

  ['text', :symbol, true, false, 100, Time.now, [1,2], {a: 1, b: 2}, Object.new].each do |value|
    it "#{value.inspect} -> \"#{value.to_s}\"" do
      Rasti::Types::String.cast(value).must_equal value.to_s
    end
  end

  it 'nil -> CastError' do
    error = proc { Rasti::Types::String.cast(nil) }.must_raise Rasti::Types::CastError
    error.message.must_equal 'Invalid cast: nil -> Rasti::Types::String'
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

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