forked from postrank-labs/goliath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder_spec.rb
More file actions
40 lines (30 loc) · 823 Bytes
/
Copy pathbuilder_spec.rb
File metadata and controls
40 lines (30 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# encoding: utf-8
require 'spec_helper'
describe Goliath::Rack::Builder do
SimpleMiddleware = Class.new
NestedMiddleware = Class.new
class NestedClassApi < Goliath::API
use NestedMiddleware, 'class'
end
class NestedBlockApi < Goliath::API
use NestedMiddleware, 'block'
end
class SimpleRouter < Goliath::API
use SimpleMiddleware
map "/class", NestedClassApi
map "/block" do
run NestedBlockApi.new
end
end
let(:router) { SimpleRouter.new }
describe '.build' do
it "builds rack app for api" do
Rack::Builder.should_receive(:app)
Goliath::Rack::Builder.build(router.class, router)
end
it "loads rack/goliath middlewares" do
SimpleMiddleware.should_receive(:new)
Goliath::Rack::Builder.build(router.class, router)
end
end
end