Sha256: 36e9b0041b6e83a3b125fe310cd924d95fbf456dfaab1f5bdbb77051c0873c9f

Contents?: true

Size: 1.11 KB

Versions: 12

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

12 entries across 12 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/features/update_webhook_spec.rb
pact_broker-2.89.0 spec/features/update_webhook_spec.rb
pact_broker-2.88.0 spec/features/update_webhook_spec.rb
pact_broker-2.87.0 spec/features/update_webhook_spec.rb
pact_broker-2.86.0 spec/features/update_webhook_spec.rb
pact_broker-2.85.1 spec/features/update_webhook_spec.rb
pact_broker-2.85.0 spec/features/update_webhook_spec.rb
pact_broker-2.84.0 spec/features/update_webhook_spec.rb
pact_broker-2.83.0 spec/features/update_webhook_spec.rb
pact_broker-2.82.0 spec/features/update_webhook_spec.rb
pact_broker-2.81.0 spec/features/update_webhook_spec.rb
pact_broker-2.80.0 spec/features/update_webhook_spec.rb