Sha256: af2524280c9e57c1bf7fba9db0d4121a7c9f6e27cc6317bdd7293ad90ae842fa
Contents?: true
Size: 847 Bytes
Versions: 63
Compression:
Stored size: 847 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
63 entries across 63 versions & 1 rubygems