Sha256: 57ba571384b09671640bd102ec923122eccc7c5ab4784b18c7127722f7a7887d

Contents?: true

Size: 506 Bytes

Versions: 14

Compression:

Stored size: 506 Bytes

Contents

require 'minitest_helper'

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

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

end

Version data entries

14 entries across 14 versions & 1 rubygems

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