Sha256: c3097e479a47b07ee95b44f28e37a0bd8687d485f57cf0afb175e9f29c305518
Contents?: true
Size: 850 Bytes
Versions: 10
Compression:
Stored size: 850 Bytes
Contents
module Ddr::Models RSpec.describe HasChildren do subject { FactoryGirl.create(:collection) } describe "#first_child" do describe "when the object has no children" do it "should return nil" do expect(subject.first_child).to be_nil end end describe "when the object has children" do let(:child1) { FactoryGirl.create(:item) } let(:child2) { FactoryGirl.create(:item) } before do child1.local_id = "test002" child1.save! child2.local_id = "test001" child2.save! subject.children << child1 subject.children << child2 subject.save! end it "should return the first child as sorted by local ID" do expect(subject.first_child).to eq(child2) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems