Method: Alice::Adapter::Test#call

Defined in:
lib/alice/adapter/test.rb

#call(env) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/alice/adapter/test.rb', line 77

def call(env)
  if stub = stubs.match(env[:method], env[:url].path)
    status, headers, body = stub.block.call(env)
    env.update \
      :status           => status,
      :response_headers => headers,
      :body             => body
  else
    env.update \
      :status           => 404,
      :response_headers => {},
      :body             => 'no stubbed requests'
  end
  @app.call(env)
end