Sha256: c14996e45b251895aebc370ad07f852eb6bb00b24410224286254d65aa601694

Contents?: true

Size: 888 Bytes

Versions: 3

Compression:

Stored size: 888 Bytes

Contents

require 'support/test_data_builder'

describe "Creating a pacticipant" do
  let(:path) { "/pacticipants" }
  let(:headers) { {'CONTENT_TYPE' => 'application/json'} }
  let(:response_body) { JSON.parse(last_response.body, symbolize_names: true)}
  let(:pacticipant_hash) { {name: 'Foo Thing'}}

  subject { post path, pacticipant_hash.to_json, headers; last_response }

  it "returns a 201 response" do
    subject
    expect(last_response.status).to be 201
  end

  it "returns the Location header" do
    subject
    expect(last_response.headers['Location']).to eq 'http://example.org/pacticpants/Foo%20Thing'
  end

  it "returns a JSON Content Type" do
    subject
    expect(last_response.headers['Content-Type']).to eq 'application/hal+json;charset=utf-8'
  end

  it "returns the newly created webhook" do
    subject
    expect(response_body).to include pacticipant_hash
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pact_broker-2.7.0.beta.2 spec/features/create_pacticipant_spec.rb
pact_broker-2.7.0.beta.1 spec/features/create_pacticipant_spec.rb
pact_broker-2.6.0 spec/features/create_pacticipant_spec.rb