Sha256: 4755df76425b1bf7322fa163d718d3779eafe8abb934e89ef1b906b1ab9419fc
Contents?: true
Size: 835 Bytes
Versions: 1
Compression:
Stored size: 835 Bytes
Contents
require 'spec_helper' describe Resource::Embeddable::Parser 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transcriber-0.0.26 | spec/unit/resource/parser/embeddable_spec.rb |