Sha256: 2da47f802de9e9b3ff7f5d7b0f9fa70c45154d70babf00a855c583babbfd18ed

Contents?: true

Size: 1.91 KB

Versions: 9

Compression:

Stored size: 1.91 KB

Contents

$: << File.expand_path("../../../", __FILE__)

require "spec/support/simplecov"
require "pact/provider/rspec"
require "db"
require "tasks/database"
require "pact_broker/db"
PactBroker::DB.connection = PactBroker::Database.database = DB::PACT_BROKER_DB
PactBroker.configuration.seed_example_data = false
require "spec/support/database_cleaner"
require "pact_broker"
require "pact_broker/app"

require_relative "hal_relation_proxy_app"

Dir.glob(File.join(File.dirname(__FILE__), "provider_states_for*.rb")).each do | path |
  require path
end

PactBroker.configuration.base_urls = ["http://example.org"]

pact_broker = PactBroker::App.new { |c| c.database_connection = DB::PACT_BROKER_DB }
app_to_verify = HalRelationProxyApp.new(pact_broker)

module Rack
  module PactBroker
    class DatabaseTransaction
      def do_not_rollback? _response
        # Dodgey hack to stop exceptions raising a Rollback error while verifying
        # Otherwise the provider states that deliberately raise exceptions
        # end up raising exceptions that break the verification tests
        true
      end
    end
  end
end

Pact.configuration.logger.level = Logger::DEBUG

Pact.service_provider "Pact Broker" do

  app { HalRelationProxyApp.new(app_to_verify) }
  app_version ENV["GIT_SHA"] if ENV["GIT_SHA"]
  app_version_tags [ENV["GIT_BRANCH"]] if ENV["GIT_BRANCH"]
  publish_verification_results ENV["CI"] == "true"

  if ENV.fetch("PACTFLOW_PACT_OSS_TOKEN", "") != ""
    honours_pacts_from_pact_broker do
      pact_broker_base_url "https://pact-oss.pactflow.io", token: ENV["PACTFLOW_PACT_OSS_TOKEN"]
      consumer_version_selectors [
          { tag: "master", latest: true }
        ]
      enable_pending true
      include_wip_pacts_since "2000-01-01"
    end
  end

  honours_pact_with "Pact Broker Client" do
    pact_uri "https://raw.githubusercontent.com/pact-foundation/pact_broker-client/master/spec/pacts/pact_broker_client-pact_broker.json"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pact_broker-2.89.1 spec/service_consumers/pact_helper.rb
pact_broker-2.89.0 spec/service_consumers/pact_helper.rb
pact_broker-2.88.0 spec/service_consumers/pact_helper.rb
pact_broker-2.87.0 spec/service_consumers/pact_helper.rb
pact_broker-2.86.0 spec/service_consumers/pact_helper.rb
pact_broker-2.85.1 spec/service_consumers/pact_helper.rb
pact_broker-2.85.0 spec/service_consumers/pact_helper.rb
pact_broker-2.84.0 spec/service_consumers/pact_helper.rb
pact_broker-2.83.0 spec/service_consumers/pact_helper.rb