samvera / hydra-pcdm

Samvera implementation of the PCDM model
Other
11 stars 10 forks source link

Tests that perform Add followed by Get should save and reload. #105

Open elrayle opened 9 years ago

elrayle commented 9 years ago

As an example, a problem with multiple objects appearing in a collection was hidden by not saving and reloading.

This passes...

it 'should allow objects to repeat' do
  Hydra::PCDM::AddObjectToCollection.call( subject, object1 )
  Hydra::PCDM::AddObjectToCollection.call( subject, object2 )
  Hydra::PCDM::AddObjectToCollection.call( subject, object1 )  
  expect( Hydra::PCDM::GetObjectsFromCollection.call( subject ) ).to eq [object1,object2,object1]
end

This fails...

it 'should allow objects to repeat' do
  Hydra::PCDM::AddObjectToCollection.call( subject, object1 )
  Hydra::PCDM::AddObjectToCollection.call( subject, object2 )
  Hydra::PCDM::AddObjectToCollection.call( subject, object1 )
  subject.save
  expect( Hydra::PCDM::GetObjectsFromCollection.call( subject.reload ) ).to eq [object1,object2,object1]
end