Sha256: d814a95fa87c3db9e2fd12853e17481698e72f964118ed650401fb5efcfafd1a

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 Bytes

Contents

module Pact
  module TaskHelper

    extend self

    def handle_verification_failure
      exit_status = yield
      abort if exit_status != 0
    end

    def spec_criteria defaults = {description: nil, provider_state: nil}
      criteria = {}

      description = ENV.fetch("PACT_DESCRIPTION", defaults[:description])
      criteria[:description] = Regexp.new(description) if description

      provider_state = ENV.fetch("PACT_PROVIDER_STATE", defaults[:provider_state])
      if provider_state
        if provider_state.length == 0
          criteria[:provider_state] = nil #Allow PACT_PROVIDER_STATE="" to mean no provider state
        else
          criteria[:provider_state] = Regexp.new(provider_state)
        end
      end

      criteria
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pact-1.1.0 lib/pact/tasks/task_helper.rb
pact-1.1.0.rc5 lib/pact/tasks/task_helper.rb
pact-1.1.0.rc4 lib/pact/tasks/task_helper.rb
pact-1.1.0.rc3 lib/pact/tasks/task_helper.rb
pact-1.0.39 lib/pact/tasks/task_helper.rb
pact-1.1.0.rc2 lib/pact/tasks/task_helper.rb
pact-1.0.38 lib/pact/tasks/task_helper.rb