Skip to content

Commit

Permalink
Work in progress for behavior change
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelong00 committed Nov 27, 2024
1 parent 1e9247b commit 7568b84
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@
end

let(:email_instance) { instance_double(IvcChampva::Email) }
#let(:email_instance) { instance_double(IvcChampva::Email).as_null_object }

Check failure on line 165 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.
#let(:email_instance) { double(IvcChampva::Email) }

Check failure on line 166 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.

context 'with valid payload and status of Not Processed' do
before do
Expand All @@ -170,7 +172,7 @@
allow(email_instance).to receive(:send_email).and_return(true)
end

it 'returns HTTP status 200 with same form_uuid but not all files and sends failure email' do
it 'returns HTTP status 200 with same form_uuid but not all files and sends no email' do
IvcChampvaForm.delete_all
IvcChampvaForm.create!(
form_uuid: '12345678-1234-5678-1234-567812345678',
Expand Down Expand Up @@ -211,11 +213,12 @@
email_sent: false
)

# an email should be sent using the failure template that corresponds to the form number
expect(IvcChampva::Email).to receive(:new).with(hash_including(
form_number: '10-10D',
template_id: '10-10D-FAILURE'
))
# an email should not be sent
#expect(IvcChampva::Email).to receive(:new).twice

Check failure on line 217 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.
#expect(IvcChampva::Email).to receive(:new).exactly(0).times

Check failure on line 218 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.
expect(IvcChampva::Email).not_to receive(:new)
#expect(email_instance).to receive(:send_email).twice

Check failure on line 220 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.
#expect(email_instance).not_to receive(:send_email)

Check failure on line 221 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.

post '/ivc_champva/v1/forms/status_updates', params: valid_payload_with_status_of_not_processed

Expand All @@ -227,7 +230,7 @@
# only 2/3 should be updated
expect(status_array.flatten.compact!).to eq(['Not Processed', 'Not Processed'])
expect(case_id_array.flatten.compact!).to eq(%w[ABC-1234 ABC-1234])
expect(email_sent_array.flatten).to eq([true, true, true])
#expect(email_sent_array.flatten).to eq([true, true, true])

Check failure on line 233 in modules/ivc_champva/spec/requests/ivc_champva/v1/forms/status_updates_spec.rb

View workflow job for this annotation

GitHub Actions / Linting and Security

Layout/LeadingCommentSpace: Missing space after `#`.
expect(response).to have_http_status(:ok)
end
end
Expand Down Expand Up @@ -298,8 +301,8 @@
email_sent: false
)

# with the toggle disabled, we should not see template_id being populated
expect(IvcChampva::Email).to receive(:new).with(hash_excluding(:template_id))
# with the toggle disabled, we should see an email sent
expect(IvcChampva::Email).to receive(:new).once

post '/ivc_champva/v1/forms/status_updates', params: valid_payload_with_status_of_not_processed
end
Expand Down

0 comments on commit 7568b84

Please sign in to comment.