Sha256: 7c59dbb1c1583334ba59cbd2efc7f26d3390b2fd6a77ce12ebd9963a214ac18b

Contents?: true

Size: 943 Bytes

Versions: 5

Compression:

Stored size: 943 Bytes

Contents

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

  it 'returns the correct message' do
    expect(response['message']).to eql("#{titleized_resource(resource_name)} Succesfully deleted")
  end

  it 'returns the correct status' do
    expect(response['status']).to eql('Delete Successful')
  end

  it 'returns 200 OK' do
    expect(response.code).to eql 200
  end

  it 'deletes a data transfer' do
    response
    resource_id = eval("#{resource_name}['id']")
    expect(api.public_send(resource_name, resource_id).code).to eql 404
  end

  context "when #{resource_name} not found" do

    it 'returns not found error message' do
      expect(not_found_response['message']).to eql 'Record not found'
    end

    it 'returns not found error status' do
      expect(not_found_response['status']).to eql 'Request Failed'
    end

    it 'returns 404' do
      expect(not_found_response.code).to eql 404
    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_delete_resource.rb
oi-api-ruby-0.1.4 spec/shared_examples_for_delete_resource.rb
oi-api-ruby-0.1.3 spec/shared_examples_for_delete_resource.rb
oi-api-ruby-0.1.2 spec/shared_examples_for_delete_resource.rb
oi-api-ruby-0.1.1 spec/shared_examples_for_delete_resource.rb