Skip to content

Commit

Permalink
feat: rename 'pact_publication' trigger type to 'publication'
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 9, 2018
1 parent 84e3eb9 commit 9fe0ff0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions db/migrations/20180109_migrate_trigger_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Sequel.migration do
up do
from(:triggered_webhooks).where(trigger_type: 'pact_publication').update(trigger_type: 'publication')
end

down do
from(:triggered_webhooks).where(trigger_type: 'publication').update(trigger_type: 'pact_publication')
end
end
2 changes: 1 addition & 1 deletion lib/pact_broker/webhooks/triggered_webhook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module PactBroker
module Webhooks
class TriggeredWebhook < Sequel::Model(:triggered_webhooks)

TRIGGER_TYPE_PUBLICATION = 'pact_publication'
TRIGGER_TYPE_PUBLICATION = 'publication'
TRIGGER_TYPE_USER = 'user'

STATUS_NOT_RUN = 'not_run'.freeze
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module Decorators
it "includes the triggered webhooks properties" do
expect(subject[:_embedded][:triggeredWebhooks].first).to include(
status: 'success',
triggerType: 'pact_publication',
triggerType: 'publication',
attemptsMade: 1,
attemptsRemaining: 2
)
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pact_broker/webhooks/repository_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,14 @@ module Webhooks
.create_pact
end

subject { Repository.new.create_triggered_webhook '1234', td.webhook, td.pact, 'pact_publication' }
subject { Repository.new.create_triggered_webhook '1234', td.webhook, td.pact, 'publication' }

it "creates a TriggeredWebhook" do
expect(subject.webhook_uuid ).to eq td.webhook.uuid
expect(subject.consumer).to eq td.consumer
expect(subject.provider).to eq td.provider
expect(subject.trigger_uuid).to eq '1234'
expect(subject.trigger_type).to eq 'pact_publication'
expect(subject.trigger_type).to eq 'publication'
end

it "sets the webhook" do
Expand Down

0 comments on commit 9fe0ff0

Please sign in to comment.