Sha256: 9ef6132b33b023bebf4e662eeaf420370ed9e17c6ac3927a467d3d6573c4af05

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

require 'pact/doc/generate'

module Pact
  module Consumer
    class SpecHooks

      def before_all
        Pact::Consumer::AppManager.instance.spawn_all
        FileUtils.mkdir_p Pact.configuration.pact_dir
      end

      def before_each 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

      def after_each 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

      def after_suite
        Pact::Doc::Generate.call
        Pact::Consumer::AppManager.instance.kill_all
        Pact::Consumer::AppManager.instance.clear_all
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pact-1.1.1 lib/pact/consumer/spec_hooks.rb
pact-1.1.0 lib/pact/consumer/spec_hooks.rb
pact-1.1.0.rc5 lib/pact/consumer/spec_hooks.rb
pact-1.1.0.rc4 lib/pact/consumer/spec_hooks.rb
pact-1.1.0.rc3 lib/pact/consumer/spec_hooks.rb