Module: Stumb

Defined in:
lib/stumb.rb,
lib/stumb/stub.rb,
lib/stumb/stamp.rb,
lib/stumb/stamp_sheet.rb

Defined Under Namespace

Classes: Stamp, StampSheet, Stub

Constant Summary collapse

Version =
'0.0.3'

Class Method Summary collapse

Class Method Details

.to_app(response, sheet_path = "/sheet", &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/stumb.rb', line 11

def to_app(response, sheet_path = "/sheet", &block)
  Rack::Builder.new {
    use Rack::ShowExceptions

    stub = Stub.new(*response)
    sheet = StampSheet.new(stub)

    map(sheet_path) { run sheet }
    yield self, stub if block_given?
    map("/") { run stub }
  }
end