spec/jobs/event_jobs_spec.rb in sufia-4.1.0 vs spec/jobs/event_jobs_spec.rb in sufia-4.2.0
- old
+ new
@@ -84,10 +84,26 @@
expect(@third_user.events.length).to eq(1)
expect(@third_user.events.first).to eq(event)
expect(@gf.events.length).to eq(1)
expect(@gf.events.first).to eq(event)
end
+ it "logs content depositor change events" do
+ # ContentDepositorChange should log the event to the proxy depositor's profile, the depositor's dashboard, followers' dashboards, and the GF
+ @third_user.follow(@another_user)
+ allow_any_instance_of(User).to receive(:can?).and_return(true)
+ allow(Time).to receive(:now).at_least(:once).and_return(1)
+ event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has transferred <a href="/files/123">Hamlet</a> to user <a href="/users/archivist1@example-dot-com">archivist1@example.com</a>', timestamp: '1' }
+ ContentDepositorChangeEventJob.new('test:123', @another_user.user_key).run
+ expect(@user.profile_events.length).to eq(1)
+ expect(@user.profile_events.first).to eq(event)
+ expect(@another_user.events.length).to eq(1)
+ expect(@another_user.events.first).to eq(event)
+ expect(@third_user.events.length).to eq(1)
+ expect(@third_user.events.first).to eq(event)
+ expect(@gf.events.length).to eq(1)
+ expect(@gf.events.first).to eq(event)
+ end
it "should log content update events" do
# ContentUpdate should log the event to the depositor's profile, followers' dashboards, and the GF
@another_user.follow(@user)
@third_user.follow(@user)
allow_any_instance_of(User).to receive(:can?).and_return(true)
@@ -186,6 +202,5 @@
expect(@third_user.events.first).to be_nil
expect(@gf.events.length).to eq(1)
expect(@gf.events.first).to eq(event)
end
end
-