Sha256: c360281899832fb9070fed2a8cb10c913b6d4614c3a51065911c37bf705dce41
Contents?: true
Size: 809 Bytes
Versions: 2
Compression:
Stored size: 809 Bytes
Contents
require 'spec_helper' describe Structure do context "when `structure/json' is required" do let(:person) { Person.new(:name => 'Joe', :age => 28, :website => 'http://example.com') } let(:json) { '{"json_class":"Person","name":"Joe","age":28,"website":"http://example.com","friends":[]}' } 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 them into their corresponding structures" do json = person.to_json JSON.parse(json).friends.first.should be_a Person end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
structure-0.7.1 | spec/structure/json_spec.rb |
structure-0.7.0 | spec/structure/json_spec.rb |