Skip to content

Commit

Permalink
API-34202 Rename AppealsApi::AppealSubmittedJob to AppealReceivedJob
Browse files Browse the repository at this point in the history
  • Loading branch information
caseywilliams committed Apr 5, 2024
1 parent 9319afb commit be4404b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def update_status(status:, code: nil, detail: nil, raise_on_error: false)
return if auth_headers.blank? # Go no further if we've removed PII

if status == 'submitted' && email_present?
AppealsApi::AppealSubmittedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
AppealsApi::AppealReceivedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def update_status(status:, code: nil, detail: nil, raise_on_error: false)
return if auth_headers.blank? # Go no further if we've removed PII

if status == 'submitted' && email_present?
AppealsApi::AppealSubmittedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
AppealsApi::AppealReceivedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def update_status(status:, code: nil, detail: nil, raise_on_error: false)
return if auth_headers.blank? # Go no further if we've removed PII

if status == 'submitted' && email_present?
AppealsApi::AppealSubmittedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
AppealsApi::AppealReceivedJob.perform_async(id, self.class.name, appellant_local_time.iso8601)
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
require 'feature_flipper'

module AppealsApi
class AppealSubmittedJob
class AppealReceivedJob
include Sidekiq::Job
# These constants are set to match the previous version of this job, which was AppealsApi::AppealReceivedJob
STATSD_KEY_PREFIX = 'api.appeals.received'
STATSD_CLAIMANT_EMAIL_SENT = "#{STATSD_KEY_PREFIX}.claimant.email.sent".freeze

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe AppealsApi::AppealSubmittedJob, type: :job do
describe AppealsApi::AppealReceivedJob, type: :job do
let(:job) { described_class.new }
let(:appeal) { create(:higher_level_review_v2) }
let(:hlr_template_name) { 'higher_level_review_received' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,35 +71,35 @@

context "when status has updated to 'submitted' and claimant or veteran email data present" do
it 'enqueues the appeal received job' do
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
example_instance.update_status(status: 'submitted')
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 1
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 1
end
end

context "when incoming and current statuses are both 'submitted' and claimant or veteran email data present" do
before { example_instance.update(status: 'submitted') }

it 'does not enqueue the appeal received job' do
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
example_instance.update_status(status: 'submitted')
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
end
end

context "when incoming status is not 'submitted' and claimant or veteran email data present" do
it 'does not enqueue the appeal received job' do
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
example_instance.update_status(status: 'pending')
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
end
end

context 'when veteran appellant without email provided' do
it 'gets the ICN and enqueues the appeal received job' do
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
instance_without_email.update_status(status: 'submitted')
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 1
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 1
end
end

Expand All @@ -111,9 +111,9 @@
end

it 'does not enqueue the appeal received job' do
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
example_instance.update_status(status: 'submitted')
expect(AppealsApi::AppealSubmittedJob.jobs.size).to eq 0
expect(AppealsApi::AppealReceivedJob.jobs.size).to eq 0
end
end
end
Expand Down

0 comments on commit be4404b

Please sign in to comment.