Skip to content

Commit

Permalink
Add extra test with 2 ids
Browse files Browse the repository at this point in the history
  • Loading branch information
straleyb committed Jun 27, 2016
1 parent 2231381 commit 1ceb385
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/actors/curation_concerns/actors/apply_order_actor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ def sync_members(ordered_member_ids)
work = ::ActiveFedora::Base.find(old_id)
curation_concern.ordered_members.delete(work)
end
curation_concern.save

(ordered_member_ids - existing_members_ids).each do |work_id|
work = ::ActiveFedora::Base.find(work_id)
curation_concern.ordered_members << work
end
curation_concern.save
true
end

Expand Down
31 changes: 31 additions & 0 deletions spec/actors/curation_concerns/apply_order_actor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,35 @@
end
end
end

describe '#update' do
let(:curation_concern) { create(:work_with_two_children, user: user) }

let(:user) { create(:user) }

before do
allow(described_class).to receive(:update).with(attributes)
end

subject do
CurationConcerns::Actors::ActorStack.new(curation_concern,
user,
[described_class,
CurationConcerns::Actors::GenericWorkActor])
end

context 'with in_works_ids' do
let(:attributes) { { ordered_member_ids: ["Blah", "Blah2"] } }
let(:root_actor) { double }
before do
allow(CurationConcerns::Actors::RootActor).to receive(:new).and_return(root_actor)
allow(root_actor).to receive(:update).with({}).and_return(true)
curation_concern.apply_depositor_metadata(user.user_key)
curation_concern.save!
end
it "attaches the parent" do
expect(subject.update(attributes)).to be true
end
end
end
end

0 comments on commit 1ceb385

Please sign in to comment.