Skip to content

Commit

Permalink
fix: typo when rendering created webhook for old webhooks path
Browse files Browse the repository at this point in the history
Fixes: #356
  • Loading branch information
bethesque committed Oct 15, 2020
1 parent 0f08984 commit 1e6a06a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact_broker/api/resources/pact_webhooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def post_is_create?

def from_json
saved_webhook = webhook_service.create next_uuid, webhook, consumer, provider
response.body = Decorators::WebhookDecorator.new(saved_webhook).to_json(decoractor_options)
response.body = Decorators::WebhookDecorator.new(saved_webhook).to_json(decorator_options)
end

def to_json
Expand Down
18 changes: 18 additions & 0 deletions spec/features/create_webhook_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,22 @@
expect(PactBroker::Webhooks::Webhook.first.provider).to_not be nil
end
end

context "with the old path" do
let(:path) { "/pacts/provider/Some%20Provider/consumer/Some%20Consumer/webhooks" }

its(:status) { is_expected.to be 201 }

it "returns the Location header" do
expect(subject.headers['Location']).to match(%r{http://example.org/webhooks/.+})
end

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

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

0 comments on commit 1e6a06a

Please sign in to comment.