Add AccountWarning#appeal_eligible?
method (#33526)
This commit is contained in:
parent
3a4aed9890
commit
54e2030146
6 changed files with 24 additions and 7 deletions
|
@ -8,4 +8,18 @@ RSpec.describe AccountWarning do
|
|||
it { is_expected.to normalize(:text).from(nil).to('') }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#appeal_eligible?' do
|
||||
context 'when created too long ago' do
|
||||
subject { Fabricate.build :account_warning, created_at: (described_class::APPEAL_WINDOW * 2).ago }
|
||||
|
||||
it { is_expected.to_not be_appeal_eligible }
|
||||
end
|
||||
|
||||
context 'when created recently' do
|
||||
subject { Fabricate.build :account_warning, created_at: (described_class::APPEAL_WINDOW - 2.days).ago }
|
||||
|
||||
it { is_expected.to be_appeal_eligible }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ RSpec.describe Appeal do
|
|||
it { is_expected.to validate_length_of(:text).is_at_most(described_class::TEXT_LENGTH_LIMIT) }
|
||||
|
||||
context 'with a strike created too long ago' do
|
||||
let(:strike) { Fabricate.build :account_warning, created_at: (described_class::MAX_STRIKE_AGE * 2).ago }
|
||||
let(:strike) { Fabricate.build :account_warning, created_at: (AccountWarning::APPEAL_WINDOW * 2).ago }
|
||||
|
||||
it { is_expected.to_not allow_values(strike).for(:strike).against(:base).on(:create) }
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue