Sha256: 65be497e58885a2780a36f5990248de19d0d3b6417571722fc54d3c0340313f5
Contents?: true
Size: 945 Bytes
Versions: 1
Compression:
Stored size: 945 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, "2014-11-04T15:46:06Z" => DateTime }.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.1 | test/test_parse.rb |