spec/qualtrics/response_spec.rb in qualtrics-0.5.4 vs spec/qualtrics/response_spec.rb in qualtrics-0.5.5
- old
+ new
@@ -29,10 +29,11 @@
it 'has a result hash' do
raw_response = test_endpoint.get('/success')
response = Qualtrics::Response.new(raw_response)
expect(response.result).to be_kind_of(Hash)
+ expect(response.status).to eql(200)
end
it 'raises an exception when a 5xx error is received' do
raw_response = test_endpoint.get('/server_error')
expect(lambda{ Qualtrics::Response.new(raw_response)}).to raise_error(Qualtrics::ServerErrorEncountered)
@@ -40,10 +41,11 @@
it 'raises a error message when a 4xx error is received' do
raw_response = test_endpoint.get('/server_error2')
begin
- Qualtrics::Response.new(raw_response)
+ response = Qualtrics::Response.new(raw_response)
+ expect(response.status).to eql(400)
rescue Qualtrics::ServerErrorEncountered => e
expect(e.message).to eql('Invalid request. Missing or invalid parameter RecipientID.')
end
end