Sha256: f067bce5b9733f754a2b28359d33e2de60057fc8167ecd42eaa7198a583c669b
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'spec_helper' describe CurationConcern::CollectionModel do before do class EssentialCollection < ActiveFedora::Base include CurationConcern::CollectionModel def members; @members ||= []; end def save; true; end end end after do Object.send(:remove_const, :EssentialCollection) end context '.add_member' do let(:collectible?) { nil } let(:proposed_collectible) { double(collections: []) } subject { EssentialCollection.new } before(:each) { proposed_collectible.stub(:can_be_member_of_collection?).with(subject).and_return(collectible?) proposed_collectible.stub(:save).and_return(true) } context 'with itself' do it 'does not add it to the collection\'s members' do expect { subject.add_member(subject) }.to_not change{ subject.members.size } end end context 'with a non-collectible object' do let(:collectible?) { false } it 'does not add it to the collection\'s members' do expect { subject.add_member(proposed_collectible) }.to_not change{ subject.members.size } end end context 'with a collectible object' do let(:collectible?) { true } it 'adds it to the collection\'s members' do expect { subject.add_member(proposed_collectible) }.to change{ subject.members.size }.by(1) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
worthwhile-0.0.1 | spec/models/curation_concern/collection_model_spec.rb |