Class: WireMockMapper::Builders::ScenarioBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/builders/scenario_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeScenarioBuilder

Scenarios allow for stateful behavior



6
7
8
# File 'lib/builders/scenario_builder.rb', line 6

def initialize
  @options = {}
end

Instance Method Details

#in_scenario(scenario) ⇒ Object



10
11
12
13
# File 'lib/builders/scenario_builder.rb', line 10

def in_scenario(scenario)
  @options[:scenarioName] = scenario
  self
end

#to_hashObject



25
26
27
28
# File 'lib/builders/scenario_builder.rb', line 25

def to_hash(*)
  options_with_url_match = @options.merge(@url_match.to_hash) if @url_match
  options_with_url_match || @options
end

#to_jsonObject



30
31
32
# File 'lib/builders/scenario_builder.rb', line 30

def to_json(*)
  to_hash.to_json
end

#will_set_state(state) ⇒ Object



20
21
22
23
# File 'lib/builders/scenario_builder.rb', line 20

def will_set_state(state)
  @options[:newScenarioState] = state
  self
end

#with_state(state) ⇒ Object



15
16
17
18
# File 'lib/builders/scenario_builder.rb', line 15

def with_state(state)
  @options[:requiredScenarioState] = state
  self
end