Skip to content

Commit

Permalink
add specs for mobile route
Browse files Browse the repository at this point in the history
  • Loading branch information
emilykim13 committed Jan 28, 2025
1 parent f9ca9aa commit 8c47575
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions modules/mobile/spec/requests/mobile/v0/user/preferred_name_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@
end
end
end

it 'invalidates the cache for the mpi-profile-response', :aggregate_failures do
preferred_name = VAProfile::Models::PreferredName.new(text: 'Pat')
VCR.use_cassette('mobile/va_profile/post_preferred_name_success', erb: { csd: }) do
VCR.use_cassette('mobile/demographics/logingov') do
expect_any_instance_of(User).to receive(:invalidate_mpi_cache)
put('/mobile/v0/user/preferred_name', params: preferred_name.to_h, headers: sis_headers)

expect(response).to have_http_status(:no_content)
end
end
end
end

context 'when text is blank' do
Expand Down Expand Up @@ -108,6 +120,18 @@
end
end
end

it 'invalidates the cache for the mpi-profile-response', :aggregate_failures do
preferred_name = VAProfile::Models::PreferredName.new(text: 'Pat')
VCR.use_cassette('mobile/va_profile/post_preferred_name_success', erb: { csd: }) do
VCR.use_cassette('mobile/demographics/logingov') do
expect_any_instance_of(User).to receive(:invalidate_mpi_cache)
put('/mobile/v0/user/preferred_name', params: preferred_name.to_h, headers: sis_headers)

expect(response).to have_http_status(:no_content)
end
end
end
end

context 'when text is blank' do
Expand Down

0 comments on commit 8c47575

Please sign in to comment.