Fix flakiness in Follows::UpdatePointsWorker (#12614)
* Fix flakiness in Follows::UpdatePointsWorker * Trigger Travis CI
This commit is contained in:
parent
67850d93ea
commit
844c038bc4
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue