class HttpStub::Server::Memory::InitialState

Public Class Methods

new(configurator_state) click to toggle source
# File lib/http_stub/server/memory/initial_state.rb, line 7
def initialize(configurator_state)
  @configurator_state = configurator_state
end

Public Instance Methods

load_scenarios() click to toggle source
# File lib/http_stub/server/memory/initial_state.rb, line 11
def load_scenarios
  @configurator_state.scenario_hashes.map { |hash| HttpStub::Server::Scenario.create(hash) }
end
load_stubs(scenario_registry) click to toggle source
# File lib/http_stub/server/memory/initial_state.rb, line 15
def load_stubs(scenario_registry)
  initial_stubs   = @configurator_state.stub_hashes.map { |hash| HttpStub::Server::Stub.create(hash) }
  activated_stubs = scenario_registry.find_all(&:initially_activated?).map do |activated_scenario|
    scenario_registry.stubs_activated_by(activated_scenario, HttpStub::Server::StdoutLogger)
  end.flatten
  initial_stubs + activated_stubs
end