Fix flakiness in Follows::UpdatePointsWorker (#12614)

* Fix flakiness in Follows::UpdatePointsWorker

* Trigger Travis CI
This commit is contained in:
rhymes 2021-02-09 12:41:24 +01:00 committed by GitHub
parent 67850d93ea
commit 844c038bc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,15 +16,18 @@ RSpec.describe Follows::UpdatePointsWorker, type: :worker do
let(:page_view) { create(:page_view, user: user, article: article, time_tracked_in_seconds: 100) }
before do
page_view
user.follow(second_tag)
user.follow(tag)
end
it "calculates scores" do
it "calculates scores", :aggregate_failures do
follow = Follow.last
follow.update_column(:explicit_points, 2.2)
worker.perform(reaction.reactable_id, reaction.user_id)
follow.reload
expect(follow.implicit_points).to be > 0
expect(follow.reload.points.round(2)).to eq (follow.implicit_points + follow.explicit_points).round(2)
end
@ -39,6 +42,7 @@ RSpec.describe Follows::UpdatePointsWorker, type: :worker do
worker.perform(reaction.reactable_id, reaction.user_id)
follow.reload
expect(follow.implicit_points).to be > first_implicit_score
end
@ -52,12 +56,14 @@ RSpec.describe Follows::UpdatePointsWorker, type: :worker do
worker.perform(reaction.reactable_id, reaction.user_id)
follow.reload
expect(follow.implicit_points).to be > first_implicit_score
end
it "bumps down tag follow points not included in this calc" do
follow = Follow.first
worker.perform(reaction.reactable_id, reaction.user_id)
expect(follow.reload.points.round(2)).to eq(0.98)
end