Sha256: 00d2db4afde5ee588672fd7d5960949e672160fe47b237e6bcc88ebf9abe0f01

Contents?: true

Size: 971 Bytes

Versions: 40

Compression:

Stored size: 971 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;charset=utf-8'
  end
end

RSpec::Matchers.define :be_a_json_response do
  match do | actual |
    expect(actual.headers['Content-Type']).to eq 'application/json;charset=utf-8'
  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;charset=utf-8'
    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

40 entries across 40 versions & 1 rubygems

Version Path
pact_broker-2.6.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.5.1 spec/support/shared_examples_for_responses.rb
pact_broker-2.5.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.4.2 spec/support/shared_examples_for_responses.rb
pact_broker-2.4.1 spec/support/shared_examples_for_responses.rb
pact_broker-2.4.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.3.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.2.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.1.1 spec/support/shared_examples_for_responses.rb
pact_broker-2.1.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.5 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.4 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.3 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.2 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.1 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.0 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.0.beta.8 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.0.beta.7 spec/support/shared_examples_for_responses.rb
pact_broker-2.0.0.beta.6 spec/support/shared_examples_for_responses.rb
pact_broker-1.18.0 spec/support/shared_examples_for_responses.rb