mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 10:38:07 +01:00
Add basic coverage for ApproveAppealService
class (#29333)
This commit is contained in:
parent
ab2ef63a03
commit
d1602c017d
1 changed files with 30 additions and 0 deletions
30
spec/services/approve_appeal_service_spec.rb
Normal file
30
spec/services/approve_appeal_service_spec.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ApproveAppealService do
|
||||
describe '#call' do
|
||||
context 'with an existing appeal' do
|
||||
let(:appeal) { Fabricate(:appeal) }
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
it 'processes the appeal approval' do
|
||||
expect { subject.call(appeal, account) }
|
||||
.to mark_overruled
|
||||
.and record_approver
|
||||
end
|
||||
|
||||
def mark_overruled
|
||||
change(appeal.strike, :overruled_at)
|
||||
.from(nil)
|
||||
.to(be > 1.minute.ago)
|
||||
end
|
||||
|
||||
def record_approver
|
||||
change(appeal, :approved_by_account)
|
||||
.from(nil)
|
||||
.to(account)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue