Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic coverage for ApproveAppealService class #29333

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions spec/services/approve_appeal_service_spec.rb
Original file line number Diff line number Diff line change
@@ -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