spec/jobs/event_jobs_spec.rb in sufia-6.2.0 vs spec/jobs/event_jobs_spec.rb in sufia-6.3.0
- old
+ new
@@ -13,11 +13,11 @@
after do
$redis.keys('events:*').each { |key| $redis.del key }
$redis.keys('User:*').each { |key| $redis.del key }
$redis.keys('GenericFile:*').each { |key| $redis.del key }
end
- it "should log user edit profile events" do
+ it "logs user edit profile events" do
# UserEditProfile should log the event to the editor's dashboard and his/her followers' dashboards
@another_user.follow(@user)
count_user = @user.events.length
count_another = @another_user.events.length
expect(Time).to receive(:now).at_least(:once).and_return(1)
@@ -26,11 +26,11 @@
expect(@user.events.length).to eq(count_user + 1)
expect(@user.events.first).to eq(event)
expect(@another_user.events.length).to eq(count_another + 1)
expect(@another_user.events.first).to eq(event)
end
- it "should log user follow events" do
+ it "logs user follow events" do
# UserFollow should log the event to the follower's dashboard, the followee's dashboard, and followers' dashboards
@third_user.follow(@user)
expect(@user.events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
@@ -42,11 +42,11 @@
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)
end
- it "should log user unfollow events" do
+ it "logs user unfollow events" do
# UserUnfollow should log the event to the unfollower's dashboard, the unfollowee's dashboard, and followers' dashboards
@third_user.follow(@user)
@user.follow(@another_user)
expect(@user.events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
@@ -59,21 +59,21 @@
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)
end
- it "should log content deposit events" do
+ it "logs content deposit events" do
# ContentDeposit 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)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(@gf.events.length).to eq(0)
expect(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 deposited <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deposited <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
ContentDepositEventJob.new('test-123', @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)
@@ -85,111 +85,111 @@
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/test-123">Hamlet</a> to user <a href="/users/archivist1@example-dot-com">archivist1@example.com</a>', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has transferred <a href="/files/test-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
+ it "logs 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)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(@gf.events.length).to eq(0)
expect(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 updated <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
ContentUpdateEventJob.new('test-123', @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 new version events" do
+ it "logs content new version events" do
# ContentNewVersion 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)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(@gf.events.length).to eq(0)
expect(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 added a new version of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has added a new version of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
ContentNewVersionEventJob.new('test-123', @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 restored version events" do
+ it "logs content restored version events" do
# ContentRestoredVersion 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)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(@gf.events.length).to eq(0)
expect(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 restored a version \'content.0\' of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has restored a version \'content.0\' of <a href="/files/test-123">Hamlet</a>', timestamp: '1' }
ContentRestoredVersionEventJob.new('test-123', @user.user_key, 'content.0').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 delete events" do
+ it "logs content delete events" do
# ContentDelete should log the event to the depositor's profile and followers' dashboards
@another_user.follow(@user)
@third_user.follow(@user)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(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 deleted file \'test-123\'', timestamp: '1' }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has deleted file \'test-123\'', timestamp: '1' }
ContentDeleteEventJob.new('test-123', @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)
end
- it "should not log content-related jobs to followers who lack access" do
+ it "does not log content-related jobs to followers who lack access" do
# No Content-related eventjobs should log an event to a follower who does not have access to the GF
@another_user.follow(@user)
@third_user.follow(@user)
expect(@user.profile_events.length).to eq(0)
expect(@another_user.events.length).to eq(0)
expect(@third_user.events.length).to eq(0)
expect(@gf.events.length).to eq(0)
@now = Time.now
expect(Time).to receive(:now).at_least(:once).and_return(@now)
- event = {action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: @now.to_i.to_s }
+ event = { action: 'User <a href="/users/jilluser@example-dot-com">jilluser@example.com</a> has updated <a href="/files/test-123">Hamlet</a>', timestamp: @now.to_i.to_s }
ContentUpdateEventJob.new('test-123', @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(0)
expect(@another_user.events.first).to be_nil