Sha256: a18f228eabd46055f4a1c5e816606e3151937ed8385a8d9b5d7094473b314c00

Contents?: true

Size: 1.43 KB

Versions: 10

Compression:

Stored size: 1.43 KB

Contents

require_relative '../configuration'
require_relative '../consumer'
require_relative 'dsl'
require 'pact/consumer/consumer_contract_builder'

module Pact
  module Consumer
    module RSpec
      include Pact::Consumer::ConsumerContractBuilders
    end
  end
end

RSpec.configure do |config|
  config.include Pact::Consumer::RSpec, :pact => true

  config.before :all, :pact => true do
    Pact::Consumer::AppManager.instance.spawn_all
    FileUtils.mkdir_p Pact.configuration.pact_dir
  end

  config.before :each, :pact => true do | example |
    example_description = "#{example.example.example_group.description} #{example.example.description}"
    Pact.configuration.logger.info "Clearing all expectations"
    Pact::Consumer::AppManager.instance.ports_of_mock_services.each do | port |
      Pact::Consumer::MockServiceClient.clear_interactions port, example_description
    end
  end

  config.after :each, :pact => true do | example |
    example_description = "#{example.example.example_group.description} #{example.example.description}"
    Pact.configuration.logger.info "Verifying interactions for #{example_description}"
    Pact.configuration.provider_verifications.each do | provider_verification |
      provider_verification.call example_description
    end
  end

  config.after :suite do
    Pact.configuration.logger.info "After suite"
    Pact::Consumer::AppManager.instance.kill_all
    Pact::Consumer::AppManager.instance.clear_all
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pact-1.0.9 lib/pact/consumer/rspec.rb
pact-1.0.8 lib/pact/consumer/rspec.rb
pact-1.0.7 lib/pact/consumer/rspec.rb
pact-1.0.6 lib/pact/consumer/rspec.rb
pact-1.0.5 lib/pact/consumer/rspec.rb
pact-1.0.4 lib/pact/consumer/rspec.rb
pact-1.0.3 lib/pact/consumer/rspec.rb
pact-1.0.2 lib/pact/consumer/rspec.rb
pact-1.0.1 lib/pact/consumer/rspec.rb
pact-1.0.0 lib/pact/consumer/rspec.rb