mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 10:08:40 -05:00
Use expect_json helper method for determining JSON response status
This commit is contained in:
parent
add88c7bba
commit
2d514f53bf
3 changed files with 61 additions and 132 deletions
14
spec/helpers.rb
Normal file
14
spec/helpers.rb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
def expect_json(
|
||||
ok = true,
|
||||
http = 200
|
||||
)
|
||||
expect(last_response.header['Content-Type']).to eq('application/json')
|
||||
|
||||
if (ok == true) then
|
||||
expect(JSON.parse(last_response.body)['ok']).to eq(true)
|
||||
else
|
||||
expect(JSON.parse(last_response.body)['ok']).to eq(false)
|
||||
end
|
||||
|
||||
expect(last_response.status).to eq(http)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue