Class: Pact::Cli::SpecCriteria

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/cli/spec_criteria.rb

Class Method Summary collapse

Class Method Details

.call(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pact/cli/spec_criteria.rb', line 5

def self.call options
  criteria = {}

  criteria[:description] = Regexp.new(options[:description]) if options[:description]
  criteria[:_id] = options[:pact_broker_interaction_id] if options[:pact_broker_interaction_id]
  criteria[:index] = options[:interaction_index] if options[:interaction_index]

  provider_state = options[: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