Apply suggestions

This commit is contained in:
Bianca Nenciu 2024-12-24 11:06:34 +02:00
parent 4029a2e870
commit d26251628d
No known key found for this signature in database
GPG Key ID: 07E83B117A6B844D
1 changed files with 2 additions and 2 deletions

View File

@ -4,11 +4,11 @@ RSpec.describe Jobs::GrantBadge do
subject(:job) { described_class.new } subject(:job) { described_class.new }
it "schedules a EnsureBadgeConsistency job" do it "schedules a EnsureBadgeConsistency job" do
# Keep only 2 enabled badges to be fast # Keep the test fast by only enabling 2 badges
badge_ids = Badge.enabled.limit(2).pluck(:id) badge_ids = Badge.enabled.limit(2).pluck(:id)
Badge.where.not(id: badge_ids).update_all(enabled: false) Badge.where.not(id: badge_ids).update_all(enabled: false)
# Ensures it starts a new batch of `GrantBadge` jobs # Ensures it starts a new batch of GrantBadge jobs
Jobs::GrantAllBadges.new.execute({}) Jobs::GrantAllBadges.new.execute({})
expect(Jobs::GrantBadge.jobs.map { |job| job["args"][0]["badge_id"] }).to eq(badge_ids) expect(Jobs::GrantBadge.jobs.map { |job| job["args"][0]["badge_id"] }).to eq(badge_ids)