Sha256: 748e0e1c994d66d813411c708f57a4ab933fe9e0fc5eb07923d06283c4764063

Contents?: true

Size: 928 Bytes

Versions: 11

Compression:

Stored size: 928 Bytes

Contents

shared_examples_for "a JSON 404 response" do
  it "returns a 404 Not Found" do
    subject
    expect(last_response.status).to eq 404
  end
end

shared_examples_for "a 200 JSON response" do

end

require 'rspec/expectations'

RSpec::Matchers.define :be_a_hal_json_success_response do
  match do | actual |
    expect(actual.status).to be 200
    expect(actual.headers['Content-Type']).to eq 'application/hal+json'
  end
end

RSpec::Matchers.define :be_a_json_response do
  match do | actual |
    expect(actual.headers['Content-Type']).to eq 'application/json'
  end
end

RSpec::Matchers.define :be_a_json_error_response do | message |
  match do | actual |
    expect(actual.status).to be 400
    expect(actual.headers['Content-Type']).to eq 'application/json'
    expect(actual.body).to include message
  end
end

RSpec::Matchers.define :be_a_404_response do
  match do | actual |
    expect(actual.status).to be 404
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pact_broker-1.9.1 spec/support/shared_examples_for_responses.rb
pact_broker-1.9.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.9.0.rc1 spec/support/shared_examples_for_responses.rb
pact_broker-1.8.1 spec/support/shared_examples_for_responses.rb
pact_broker-1.8.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.7.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.6.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.5.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.4.0 spec/support/shared_examples_for_responses.rb
pact_broker-1.3.2.rc1 spec/support/shared_examples_for_responses.rb
pact_broker-1.3.1 spec/support/shared_examples_for_responses.rb