Sha256: bcfe3fcabbcdef21557fc8ba76c552e2e38d140b462ac280385169fe2e6684e5

Contents?: true

Size: 520 Bytes

Versions: 14

Compression:

Stored size: 520 Bytes

Contents

require 'minitest_helper'

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

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

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rasti-form-3.1.2 spec/types/symbol_spec.rb
rasti-form-3.1.1 spec/types/symbol_spec.rb
rasti-form-3.1.0 spec/types/symbol_spec.rb
rasti-form-3.0.0 spec/types/symbol_spec.rb
rasti-form-2.2.0 spec/types/symbol_spec.rb
rasti-form-2.1.0 spec/types/symbol_spec.rb
rasti-form-2.0.0 spec/types/symbol_spec.rb
rasti-form-1.1.1 spec/types/symbol_spec.rb
rasti-form-1.1.0 spec/types/symbol_spec.rb
rasti-form-1.0.3 spec/types/symbol_spec.rb
rasti-form-1.0.2 spec/types/symbol_spec.rb
rasti-form-1.0.1 spec/types/symbol_spec.rb
rasti-form-1.0.0 spec/types/symbol_spec.rb
rasti-form-0.1.0 spec/types/symbol_spec.rb