Sha256: 0bbf50e44d565732b254f84ab907a74118f807a41e4ed701a32a91da50a7c755
Contents?: true
Size: 706 Bytes
Versions: 1
Compression:
Stored size: 706 Bytes
Contents
require 'spec_helper' describe Hari::Entity::Serialization do describe '#to_json' do it 'serializes instance to json' do model = TestModel.new(name: 'Ze', birth: Date.new(1986, 01, 23), points: '200') model.to_json.should == '{"id":null,"created_at":null,"updated_at":null,"name":"Ze","birth":"1986-01-23","points":200}' end end describe '.from_json' do it 'desserializes instance from json' do model = TestModel.from_json('{"name":"Ze","birth":"1986-01-23","points":200}') model.name.should == 'Ze' model.birth.should == Date.new(1986, 01, 23) model.points.should == 200 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hari-0.0.1 | spec/hari/entity/serialization_spec.rb |