Sha256: 165311788c7b698c62de899b2ff6c643c81dab07082402bb1f25558174fb887a
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
module APISpecHelper shared_examples 'TestRackApplication 200 OK' do it 'should return 200 OK' do expect(last_response.status).to eq 200 expect(last_response.body).to be_blank expect(last_response.header).to be_blank end end shared_examples 'API 401 UnAuthorized' do it 'should return 401 Unauthorized' do expect(last_response.status).to eq 401 expect(last_response.header).not_to be_blank expect(last_response.header['Content-Length']).to eq last_response.body.bytesize.to_s expect(last_response.header['Content-Type']).to eq "application/json; charset=utf-8" expect(last_response.body).not_to be_blank parsed_body = JSON.parse(last_response.body) expect(parsed_body["error"]["code"]).to match /^Invalid.*/ end end shared_examples 'API 500 InternalServerError' do it 'should return 500' do expect(last_response.status).to eq 500 expect(last_response.header).not_to be_blank expect(last_response.header['Content-Length']).to eq last_response.body.bytesize.to_s expect(last_response.body).not_to be_blank end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
twimock-0.0.2 | spec/support/api_spec_helper.rb |
twimock-0.0.1 | spec/support/api_spec_helper.rb |