Sha256: 9e2d27d23824a6db2951a17f39842f3fdc66f8e391f74adc4c16a167dc8b5d2e
Contents?: true
Size: 1.02 KB
Versions: 3
Compression:
Stored size: 1.02 KB
Contents
require 'spec_helper' shared_examples 'with_related_works' do let(:user) { FactoryGirl.create(:user) } let(:person) { FactoryGirl.create(:person) } let(:work) { FactoryGirl.create(:generic_work, user: user, title:"My Fabulous Work") } let(:dataset) { FactoryGirl.create(:dataset, user: user, title:"Records from that Kiki") } before do subject.apply_depositor_metadata(user.user_key) subject.contributors << person subject.save! end it "should track relations to other works" do subject.related_works << dataset subject.save subject.reload subject.related_works.should == [dataset] subject.related_work_ids.should == [dataset.pid] subject.related_works << work subject.related_works.should == [dataset, work] subject.related_works = [work] # Deleting via nested_attributes isn't currently supported by AF. If it was, you could do this: #subject.update_attributes(related_works_attributes:[{id:dataset.pid, _delete:true}]) subject.related_works.should == [work] end end
Version data entries
3 entries across 3 versions & 1 rubygems