Sha256: aeee1deac1b6ef11df1c8405a0fc4cc4f65cd4b614226bdb111343391a6a6ca0
Contents?: true
Size: 835 Bytes
Versions: 10
Compression:
Stored size: 835 Bytes
Contents
require 'spec_helper' describe Resource::Parser::Embeddable do context "when it embeds one" do before do class ExampleChild < Resource property :id end end let(:value) {{id: "7000"}} subject {Resource::Embeddable.new(:example_child, many: false, start_key: "")} it "parses child" do child = subject.parse(value) child.id.should == "7000" end end context "when it embeds many" do before do class ExampleChild < Resource property :id end end let(:value) {{example_children: [{id: "7000"}, {id: "7001"}]}} subject {Resource::Embeddable.new(:example_children, many: true)} it "parses children" do children = subject.parse(value) children[0].id.should == "7000" children[1].id.should == "7001" end end end
Version data entries
10 entries across 10 versions & 1 rubygems