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