Module: HttpStub::Server::Application::Routes::Scenario

Included in:
Application
Defined in:
lib/http_stub/server/application/routes/scenario.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(application) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/http_stub/server/application/routes/scenario.rb', line 13

def self.included(application)
  application.instance_eval do

    namespace "/http_stub/scenarios" do

      get do
        pass unless http_stub_request.parameters[:name]
        haml :scenario, {}, scenario: @scenario_controller.find(http_stub_request, logger)
      end

      get do
        haml :scenarios, {}, scenarios: @scenario_controller.find_all
      end

      post "/activate" do
        response = @scenario_controller.activate(http_stub_request, logger)
        response.serve_on(self)
      end

    end

  end
end

Instance Method Details

#initializeObject


8
9
10
11
# File 'lib/http_stub/server/application/routes/scenario.rb', line 8

def initialize
  super()
  @scenario_controller = HttpStub::Server::Scenario::Controller.new(@server_memory)
end