Sha256: c708e7e53c0f87550714dc77dd34d857443b35f5aec095ae9fd994425439dfe8
Contents?: true
Size: 1.02 KB
Versions: 6
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
6 entries across 6 versions & 1 rubygems