discourse/spec/jobs/reviewable_priorities_spec.rb
Robin Ward e74cd54fc6 REFACTOR: Replace score bonuses with low/med/high priorities
We removed score from the UX so it makes more sense to have sites set
priorities instead of score bonuses.
2019-05-23 11:54:45 -04:00

25 lines
823 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe Jobs::ReviewablePriorities do
it "will set priorities based on the maximum score" do
(1..6).each { |i| Fabricate(:reviewable, score: i) }
Jobs::ReviewablePriorities.new.execute({})
expect(Reviewable.min_score_for_priority(:low)).to eq(0.0)
expect(Reviewable.min_score_for_priority(:medium)).to eq(3.0)
expect(Reviewable.min_score_for_priority('medium')).to eq(3.0)
expect(Reviewable.min_score_for_priority(:high)).to eq(6.0)
end
it "will return 0 if no reviewables exist" do
Jobs::ReviewablePriorities.new.execute({})
expect(Reviewable.min_score_for_priority(:low)).to eq(0.0)
expect(Reviewable.min_score_for_priority(:medium)).to eq(0.0)
expect(Reviewable.min_score_for_priority(:high)).to eq(0.0)
end
end