Sha256: 6452a2ee79db4bca24abf1decb9eb939642d8066ea826b3d15707dc5eed5792e
Contents?: true
Size: 858 Bytes
Versions: 9
Compression:
Stored size: 858 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.identifier = ["test002"] child1.save child2.identifier = ["test001"] child2.save subject.children << child1 subject.children << child2 subject.save end it "should return the first child as sorted by identifiers" do expect(subject.first_child).to eq(child2) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems