Sha256: fdab75698bbfd823da54ef7f2f6d24f358d66df0b4c6c2eaa09d747b79dc1755
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
RSpec.shared_examples 'PUT resource' do |resource_name, options| it "returns the correct status" do expect(response['status']).to eql('Request Successful') end it "returns the correct message" do expect(response['message']).to eql("#{titleized_resource(resource_name)} successfully updated") end it 'returns 200 OK' do expect(response.code).to eql 200 end context 'bad request' do it 'returns 400 bad request with invalid params' do expect(bad_response.code).to eql 400 end it 'returns an error message' do expect(bad_response['message']).to eql(bad_response_message) end it 'returns an error status' do expect(bad_response['status']).to eql(bad_response_status) end end context "when #{resource_name} not found" do it 'returns 404' do expect(not_found_response.code).to eql 404 end it 'returns not found error message' do expect(not_found_response['message']).to eql "#{titleized_resource(resource_name)} not found" end it 'returns error status' do expect(not_found_response['status']).to eql 'Update Failed' end end end
Version data entries
5 entries across 5 versions & 1 rubygems