Sha256: 0aa7dca90c0cc3e7c3aca15cceec977e1565601f1a878794ac1826dc85023025

Contents?: true

Size: 1.11 KB

Versions: 66

Compression:

Stored size: 1.11 KB

Contents

require 'support/test_data_builder'

describe "Updating a webhook" do
  let(:webhook) do
    TestDataBuilder.new
      .create_pact_with_hierarchy("Some Consumer", "1", "Some Provider")
      .create_global_webhook
      .and_return(:webhook)
  end

  let(:headers) { {'CONTENT_TYPE' => 'application/json'} }
  let(:response_body) { JSON.parse(last_response.body, symbolize_names: true)}
  let(:webhook_json) { webhook_hash.to_json }
  let(:webhook_hash) do
    {
      description: "trigger build",
      consumer: {
        name: "Some Consumer"
      },
      enabled: false,
      events: [{
        name: 'contract_published'
      }],
      request: {
        method: 'POST',
        url: 'https://example.org',
        headers: {
          :"Content-Type" => "application/json"
        },
        body: {
          a: 'body'
        }
      }
    }
  end

  subject { put(path, webhook_json, headers) }

  let(:path) { "/webhooks/#{webhook.uuid}" }

  context "with valid attributes" do
    it "returns the newly created webhook" do
      subject
      expect(response_body).to include description: "trigger build"
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
pact_broker-2.36.1 spec/features/update_webhook_spec.rb
pact_broker-2.36.0 spec/features/update_webhook_spec.rb
pact_broker-2.35.0 spec/features/update_webhook_spec.rb
pact_broker-2.34.0 spec/features/update_webhook_spec.rb
pact_broker-2.33.0 spec/features/update_webhook_spec.rb
pact_broker-2.32.0 spec/features/update_webhook_spec.rb