Skip to content

Commit

Permalink
Fix failing specs
Browse files Browse the repository at this point in the history
  • Loading branch information
tpharrison committed Sep 4, 2024
1 parent a7ff979 commit 5bf828e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
2 changes: 1 addition & 1 deletion spec/factories/form_submissions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
created_at { '2024-03-12' }
end

trait :with_form_not_allowlisted do
trait :with_form_blocked do
user_account_id { '' }
form_type { 'NOT-WHITELISTED' }
benefits_intake_uuid { '84dd8902-0744-4b1a-ab3f-6b4ec3e5dd3c' }
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/forms/submission_statuses/report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
before do
create(:form_submission, :with_form214142, user_account_id: user_account.id)
create(:form_submission, :with_form210966, user_account_id: user_account.id)
create(:form_submission, :with_form_not_allowlisted, user_account_id: user_account.id)
create(:form_submission, :with_form_blocked, user_account_id: user_account.id)
end

context 'has statuses' do
Expand Down
31 changes: 6 additions & 25 deletions spec/requests/v0/my_va/submission_statuses_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
require 'forms/submission_statuses/gateway'

RSpec.describe 'V0::MyVA::SubmissionStatuses', type: :request do
let(:user_account_id) { '43134f0c-a772-4afa-857a-e5dedf8ea65a' }
let(:user) { build(:user, :loa3, :with_terms_of_use_agreement) }

before do
sign_in_as(build(:user, :loa3))

allow_any_instance_of(User).to receive(:user_account).and_return(
OpenStruct.new(user_account_id:)
)
sign_in_as(user)
end

context 'when feature flag disabled' do
Expand All @@ -36,24 +32,9 @@

context 'when user has submissions' do
before do
allow_any_instance_of(Forms::SubmissionStatuses::Gateway).to receive(:submissions).and_return(
[
OpenStruct.new(
id: 1,
form_type: '21-4142',
benefits_intake_uuid: '4b846069-e496-4f83-8587-42b570f24483',
user_account_id:,
created_at: '2024-03-08'
),
OpenStruct.new(
id: 2,
form_type: '21-0966',
benefits_intake_uuid: 'd0c6cea6-9885-4e2f-8e0c-708d5933833a',
user_account_id:,
created_at: '2024-03-13'
)
]
)
create(:form_submission, :with_form214142, user_account_id: user.user_account_uuid)
create(:form_submission, :with_form210966, user_account_id: user.user_account_uuid)
create(:form_submission, :with_form_blocked, user_account_id: user.user_account_uuid)
end

it 'returns submission statuses' do
Expand All @@ -64,7 +45,7 @@
expect(response).to have_http_status(:ok)

results = JSON.parse(response.body)['data']
expect(results.size).to eq(3)
expect(results.size).to eq(2)
end

it 'returns all fields' do
Expand Down

0 comments on commit 5bf828e

Please sign in to comment.