Sha256: a0c8d76b6dd13da88530f3d0e981eaf0e2b3638e351e453d58931eec9903f88c

Contents?: true

Size: 405 Bytes

Versions: 3

Compression:

Stored size: 405 Bytes

Contents

require 'spec/spec_helper'

describe "Basic object", "conversions" do
  it "should run conversions" do
    
    test = Class.new do 
      include Hashify
      attr_accessor :prop1
      hash_convert :prop1 => [proc{|x| x.to_i}, proc{|x| Time.at(x)}]
    end
    
    t = test.from_hash(:prop1 => 12345)
    
    t.prop1.should == Time.at(12345)
    
    t.to_hash.should == {:prop1 => 12345}
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hashify-0.0.3 spec/convert_spec.rb
hashify-0.0.2 spec/convert_spec.rb
hashify-0.0.1 spec/convert_spec.rb