Skip to content

Commit

Permalink
Move post calls to it blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
derekhouck committed Jan 21, 2025
1 parent 162dd7f commit 1cad288
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -391,13 +391,14 @@

before do
sign_in
post '/simple_forms_api/v1/simple_forms', params: data
end

describe 'unhandled form' do
let(:form) { 'form_with_dangerous_characters_unhandled.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
expect(response.body).to include('something has gone wrong with your form')

Expand All @@ -413,6 +414,8 @@
let(:form) { 'form_with_dangerous_characters_21_4140.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
expect(response.body).to include('unexpected token at')

Expand All @@ -431,6 +434,8 @@
let(:form) { 'form_with_dangerous_characters_21_4142.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
# 'unexpected token at' gets mangled by our scrubbing but this indicates that we're getting the right message
expect(response.body).to include('unexpected ken at')
Expand All @@ -449,6 +454,8 @@
let(:form) { 'form_with_dangerous_characters_21_10210.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
# 'unexpected token at' gets mangled by our scrubbing but this indicates that we're getting the right message
expect(response.body).to include('unexpected token t')
Expand All @@ -469,6 +476,8 @@
it 'makes the request and expects a failure' do
skip 'restore this test when we release the form to production'

post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
expect(response.body).to include('unexpected token at')

Expand All @@ -484,6 +493,8 @@
let(:form) { 'form_with_dangerous_characters_21P_0847.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
# 'unexpected token at' gets mangled by our scrubbing but this indicates that we're getting the right message
expect(response.body).to include('unexpected token t')
Expand All @@ -503,6 +514,8 @@
let(:form) { 'form_with_dangerous_characters_21_0845.json' }

it 'makes the request and expects a failure' do
post '/simple_forms_api/v1/simple_forms', params: data

expect(response).to have_http_status(:error)
# 'unexpected token at' gets mangled by our scrubbing but this indicates that we're getting the right message
expect(response.body).to include('unexpected token t')
Expand Down

0 comments on commit 1cad288

Please sign in to comment.