Sha256: 6d922ae52656a45afef3fadf2f0d0fb453c6555ff3396ecf65bd1e33cf51c97e
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/helper') require 'property_sets/casting' class TestCasting < ActiveSupport::TestCase context "Casting#read" do should "return nil when given value nil regardless of type" do assert_equal nil, PropertySets::Casting.read(:string, nil) assert_equal nil, PropertySets::Casting.read(:hello, nil) end end context "Casting#write" do should "return nil when given value nil regardless of type" do assert_equal nil, PropertySets::Casting.write(:string, nil) assert_equal nil, PropertySets::Casting.write(:hello, nil) end should "convert time instances to UTC" do time = Time.now.in_time_zone("CET") assert PropertySets::Casting.write(:datetime, time) =~ /UTC$/ end should "convert integers to strings" do assert_equal "123", PropertySets::Casting.write(:integer, 123) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
property_sets-0.6.2 | test/test_casting.rb |
property_sets-0.5.8 | test/test_casting.rb |