Sha256: 9f3827675d024f609791692f78e0e4888ca60033d341212d22ad2076322028c1

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

require "str2duck"
require 'minitest/autorun'
describe 'StringParse' do

  specify 'parse objects into the right format' do

    {
        "2011-03-12"=>Date,
        "2007-07-20 18:59:27 +0200"=>Time,
        "2010-10-30 18:02:56 +0200"=>Time,
        "2012-09-12T14:49:50+02:00"=>DateTime,
        "123"=>Fixnum,
        "asd"=>String,
        "123.432"=>Float,
        "123,432"=>Float,
        "true"=>TrueClass,
        "false"=>FalseClass,
        "some string data"=>String,
        "{\"hello\":\"json\"}"=>Hash,
        "--- hello\n..."=>String,
        "hello: yaml"=>Hash
    }.each_pair do |str,klass|
      str.to_duck.must_be_instance_of klass
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
str2duck-1.7.0 test/test_parse.rb