Skip to content

Commit

Permalink
chore: test data builder
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 16, 2018
1 parent 37a62be commit 42bfa39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions script/seed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def publish_pact params = {}
.create_label("microservice")
.create_provider("Bar")
.create_label("microservice")
.create_consumer_webhook(method: 'GET', url: 'https://www.google.com.au', event_names: ['provider_verification_published'])
.create_provider_webhook(method: 'GET', url: 'https://theage.com.au')
.create_webhook(method: 'GET', url: 'https://self-signed.badssl.com')
.create_consumer_version("1.2.100")
.publish_pact
Expand Down
6 changes: 5 additions & 1 deletion spec/support/test_data_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ def create_webhook parameters = {}
consumer = params.key?(:consumer) ? params.delete(:consumer) : @consumer
provider = params.key?(:provider) ? params.delete(:provider) : @provider
uuid = params[:uuid] || PactBroker::Webhooks::Service.next_uuid
event_params = params[:events] || [{ name: PactBroker::Webhooks::WebhookEvent::DEFAULT_EVENT_NAME }]
event_params = if params[:event_names]
params[:event_names].collect{ |event_name| {name: event_name} }
else
params[:events] || [{ name: PactBroker::Webhooks::WebhookEvent::DEFAULT_EVENT_NAME }]
end
events = event_params.collect{ |e| PactBroker::Webhooks::WebhookEvent.new(e) }
default_params = { method: 'POST', url: 'http://example.org', headers: {'Content-Type' => 'application/json'}}
request = PactBroker::Domain::WebhookRequest.new(default_params.merge(params))
Expand Down

0 comments on commit 42bfa39

Please sign in to comment.