module Pact

@public Used by Pact Provider Verifier

TODO move this to the pact broker client

To create a rake pact:verify:<something> task

Pact::VerificationTask.new(:head) do | pact |

pact.uri 'http://master.cd.vpc.realestate.com.au/browse/BIQ-MAS/latestSuccessful/artifact/JOB2/Pacts/mas-contract_transaction_service.json'
 pact.uri 'http://master.cd.vpc.realestate.com.au/browse/BIQ-IMAGINARY-CONSUMER/latestSuccessful/artifact/JOB2/Pacts/imaginary_consumer-contract_transaction_service.json'

end

The pact.uri may be a local file system path or a remote URL.

To run a pact:verify:xxx task you need to define a pact_helper.rb, ideally in spec/service_consumers. It should contain your service_provider definition, and load any provider state definition files. It should also load all your app’s dependencies (eg by calling out to spec_helper)

Eg.

require ‘spec_helper’ require ‘provider_states_for_my_consumer’

Pact.service_provider “My Provider” do

app { TestApp.new }

end

Can’t use refinements because of Travelling Ruby

Remember to bump pact-provider-proxy when this changes major version

Constants

VERSION

Public Class Methods

clear_consumer_world() click to toggle source

internal api, for testing only

# File lib/pact/consumer/world.rb, line 8
def self.clear_consumer_world
  @consumer_world = nil
end
clear_provider_world() click to toggle source

internal api, for testing only

# File lib/pact/provider/world.rb, line 10
def self.clear_provider_world
  @world = nil
end
consumer_world() click to toggle source
# File lib/pact/consumer/world.rb, line 3
def self.consumer_world
  @consumer_world ||= Pact::Consumer::World.new
end
project_root() click to toggle source
# File lib/pact/project_root.rb, line 4
def self.project_root
  @project_root ||= Pathname.new(File.expand_path('../../../',__FILE__)).freeze
end
provider_world() click to toggle source
# File lib/pact/provider/world.rb, line 5
def self.provider_world
  @world ||= Pact::Provider::World.new
end