Sha256: 8588345835f85dc016e90e153043188f3a195c37428660817d989c055647034b

Contents?: true

Size: 756 Bytes

Versions: 5

Compression:

Stored size: 756 Bytes

Contents

RSpec.shared_examples 'POST resource' do |resource_name, options|

  it 'returns a success message' do
    expect(response['message']).to eql("#{titleized_resource(resource_name)} successfully created")
  end

  it 'returns a success status' do
    expect(response['status']).to eql('Request Successful')
  end

  it 'returns 201 created' do
    expect(response.code).to eql 201
  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

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
oi-api-ruby-0.1.5 spec/shared_examples_for_post_resource.rb
oi-api-ruby-0.1.4 spec/shared_examples_for_post_resource.rb
oi-api-ruby-0.1.3 spec/shared_examples_for_post_resource.rb
oi-api-ruby-0.1.2 spec/shared_examples_for_post_resource.rb
oi-api-ruby-0.1.1 spec/shared_examples_for_post_resource.rb