Skip to content

Commit

Permalink
Ruby 3: KwArgs fix for CareGiversAssistanceClaimSpec (#11929)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericboehs authored Mar 2, 2023
1 parent a2db775 commit 720f5c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/models/saved_claim/caregivers_assistance_claim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def process_attachments!
def to_pdf(filename = nil, **fill_options)
# We never save the claim, so we don't have an id to provide for the filename.
# Instead we'll create a filename with this format "10-10cg_{uuid}"
PdfFill::Filler.fill_form(self, filename || guid, fill_options)
PdfFill::Filler.fill_form(self, filename || guid, **fill_options)
end

# SavedClaims require regional_office to be defined, CaregiversAssistanceClaim has no purpose for it.
Expand Down
29 changes: 21 additions & 8 deletions spec/models/saved_claim/caregivers_assistance_claim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,31 @@
end

it 'calls PdfFill::Filler#fill_form' do
expect(PdfFill::Filler).to receive(:fill_form).with(claim, claim.guid, {}).once.and_return(:expected_file_paths)
if RUBY_VERSION =~ /2.7/
expect(PdfFill::Filler).to receive(:fill_form).with(claim, claim.guid, {}).once.and_return(:expected_file_paths)
else
expect(PdfFill::Filler).to receive(:fill_form).with(claim, claim.guid).once.and_return(:expected_file_paths)
end
expect(claim.to_pdf).to eq(:expected_file_paths)
end

it 'passes arguments to PdfFill::Filler#fill_form' do
expect(PdfFill::Filler).to receive(
:fill_form
).with(
claim,
'my_other_filename',
{}
).once.and_return(:expected_file_paths)
if RUBY_VERSION =~ /2.7/
expect(PdfFill::Filler).to receive(
:fill_form
).with(
claim,
'my_other_filename',
{}
).once.and_return(:expected_file_paths)
else
expect(PdfFill::Filler).to receive(
:fill_form
).with(
claim,
'my_other_filename'
).once.and_return(:expected_file_paths)
end

# Calling with only filename
claim.to_pdf('my_other_filename')
Expand Down

0 comments on commit 720f5c7

Please sign in to comment.