class HttpStub::Configurator::Scenario
Public Class Methods
new(name, default_stub_template)
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 8 def initialize(name, default_stub_template) @default_stub_template = default_stub_template @hash = { name: name, activated: false, stubs: [], triggered_scenario_names: [] }.with_indifferent_access end
Public Instance Methods
activate!()
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 31 def activate! @hash[:activated] = true end
activate_scenarios!(*names)
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 27 def activate_scenarios!(*names) @hash[:triggered_scenario_names].concat(names.flatten) end
add_stub!(stub=nil, &block)
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 18 def add_stub!(stub=nil, &block) resolved_stub = stub || build_stub(&block) @hash[:stubs] << resolved_stub.to_hash end
add_stubs!(stubs)
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 23 def add_stubs!(stubs) stubs.each { |stub| add_stub!(stub) } end
to_hash()
click to toggle source
# File lib/http_stub/configurator/scenario.rb, line 35 def to_hash @hash end