Sha256: 434fcfaf8095197d67c4d58aabbdb146190b56c39f35b5e17b11b0961bfa9bbd
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 Bytes
Contents
require 'spec_helper' describe Structure do context "when `structure/json' is required" do let(:person) { Person.new(:name => 'Joe', :age => 28) } let(:json) { '{"json_class":"Person","name":"Joe","age":28,"friends":null}' } before do require 'structure/json' end it "dumps to JSON" do person.to_json.should eql json end it "loads from JSON" do JSON.parse(json).should == person end context "when nesting other structures" do before do person.friends = [Person.new(:name => 'Jane')] end it "loads nested structures from JSON" do json = person.to_json JSON.parse(json).friends.first.name.should eql 'Jane' end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
structure-0.2.0 | spec/structure/json_spec.rb |