2019-05-13 09:55:44 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-08 01:25:11 +08:00
|
|
|
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({})
|
|
|
|
|
2019-05-23 05:23:45 +08:00
|
|
|
expect(Reviewable.min_score_for_priority(:low)).to eq(0.0)
|
|
|
|
expect(Reviewable.min_score_for_priority(:medium)).to eq(3.0)
|
2019-05-08 01:25:11 +08:00
|
|
|
expect(Reviewable.min_score_for_priority('medium')).to eq(3.0)
|
2019-05-23 05:23:45 +08:00
|
|
|
expect(Reviewable.min_score_for_priority(:high)).to eq(6.0)
|
2019-05-08 01:25:11 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "will return 0 if no reviewables exist" do
|
|
|
|
Jobs::ReviewablePriorities.new.execute({})
|
|
|
|
|
2019-05-23 05:23:45 +08:00
|
|
|
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)
|
2019-05-08 01:25:11 +08:00
|
|
|
end
|
|
|
|
end
|