Sha256: 568844f2097feb9e54e4d5e37ef51604b708ab323c34810fe7f0482f29b1d1cc
Contents?: true
Size: 868 Bytes
Versions: 1
Compression:
Stored size: 868 Bytes
Contents
require 'spec_helper' RSpec.describe Item, type: :model do it_behaves_like "a DDR model" it_behaves_like "it has an association", :belongs_to, :parent, :is_member_of_collection, "Collection" it_behaves_like "it has an association", :has_many, :children, :is_part_of, "Component" it_behaves_like "a non-collection model" context "has structured children" do let!(:item) { Item.create } let!(:comp1) { Component.create(parent: item, file_use: 'master', order: 2) } let!(:comp2) { Component.create(parent: item, file_use: 'reference', order: 1) } let!(:comp3) { Component.create(parent: item, file_use: 'master', order: 1) } it "should group and order the children" do results = item.children_by_file_use expect(results['master']).to eq([ comp3, comp1 ]) expect(results['reference']).to eq([ comp2 ]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ddr-models-2.0.0.pre.1 | spec/models/item_spec.rb |