Skip to content

Commit

Permalink
submit_benefits_intake_claim.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
wayne-weibel committed Oct 24, 2024
1 parent ce9d008 commit d892092
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/sidekiq/lighthouse/submit_benefits_intake_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def check_zipcode(address)
def send_confirmation_email
@claim.respond_to?(:send_confirmation_email) && @claim.send_confirmation_email

if %w[21P-530V2 21P-530].include?(claim&.form_id)
if %w[21P-530V2 21P-530].include?(@claim&.form_id)

Check failure on line 187 in app/sidekiq/lighthouse/submit_benefits_intake_claim.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Style/IfUnlessModifier: Favor modifier `if` usage when having a single-line body. Another good alternative is the usage of control flow `&&`/`||`.
Burials::NotificationEmail.new(@claim).deliver(:confirmation)
end
rescue => e
Expand Down
8 changes: 7 additions & 1 deletion spec/sidekiq/lighthouse/submit_benefits_intake_claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
let(:response) { double('response') }
let(:pdf_path) { 'random/path/to/pdf' }
let(:location) { 'test_location' }
let(:notification) { double('notification') }

before do
job.instance_variable_set(:@claim, claim)
Expand All @@ -23,6 +24,9 @@
allow(BenefitsIntakeService::Service).to receive(:new).and_return(service)
allow(service).to receive(:uuid)
allow(service).to receive_messages(location:, upload_doc: response)

allow(Burials::NotificationEmail).to receive(:new).and_return(notification)
allow(notification).to receive(:deliver)
end

it 'submits the saved claim successfully' do
Expand All @@ -32,7 +36,9 @@
expect(job).to receive(:create_form_submission_attempt)
expect(job).to receive(:generate_metadata).once
expect(service).to receive(:upload_doc)
expect(claim).to receive(:send_confirmation_email)

# burials only
expect(notification).to receive(:deliver).with(:confirmation)

expect(StatsD).to receive(:increment).with('worker.lighthouse.submit_benefits_intake_claim.success')

Expand Down

0 comments on commit d892092

Please sign in to comment.