Add coverage for StatusTrend.allowed method (#39239)
This commit is contained in:
parent
facb552c9c
commit
78932fe567
@ -9,4 +9,23 @@ RSpec.describe StatusTrend do
|
||||
it { is_expected.to belong_to(:account).required }
|
||||
it { is_expected.to belong_to(:status).required }
|
||||
end
|
||||
|
||||
describe 'Scopes' do
|
||||
describe '.allowed' do
|
||||
context 'with multiple trends per account' do
|
||||
let(:account) { Fabricate :account }
|
||||
let!(:allowed_high_score) { Fabricate :status_trend, allowed: true, score: 10, account: }
|
||||
|
||||
before do
|
||||
Fabricate :status_trend, allowed: false, score: 25
|
||||
Fabricate :status_trend, allowed: true, score: 2, account:
|
||||
end
|
||||
|
||||
it 'returns allowed records with account grouped max scores' do
|
||||
expect(described_class.allowed)
|
||||
.to contain_exactly(eq(allowed_high_score).and(have_attributes(score: 10)))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user