Class: HttpStub::Configurator::EndpointTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/http_stub/configurator/endpoint_template.rb

Instance Method Summary collapse

Constructor Details

#initialize(server, default_stub_template, &block) ⇒ EndpointTemplate

Returns a new instance of EndpointTemplate.


8
9
10
11
# File 'lib/http_stub/configurator/endpoint_template.rb', line 8

def initialize(server, default_stub_template, &block)
  @server        = server
  @stub_template = HttpStub::Configurator::Stub::Template.new(default_stub_template, &block)
end

Instance Method Details

#add_scenario!(name, response_overrides = {}, &block) ⇒ Object


13
14
15
# File 'lib/http_stub/configurator/endpoint_template.rb', line 13

def add_scenario!(name, response_overrides={}, &block)
  @server.add_scenario_with_one_stub!(name, self.build_stub(response_overrides), &block)
end

#add_stub!(response_overrides = {}, &block) ⇒ Object


17
18
19
# File 'lib/http_stub/configurator/endpoint_template.rb', line 17

def add_stub!(response_overrides={}, &block)
  @server.add_stub!(self.build_stub(response_overrides, &block))
end