Sha256: c868160ca24b882367f322772c3e3f41129de42bedc9d226ff8ce56ca39e3e57

Contents?: true

Size: 495 Bytes

Versions: 4

Compression:

Stored size: 495 Bytes

Contents

require 'minitest_helper'

describe Rasti::Types::Symbol 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.to_sym}\"" do
      Rasti::Types::Symbol.cast(value).must_equal value.to_s.to_sym
    end
  end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

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