forked from postrank-labs/goliath
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_spec.rb
More file actions
46 lines (36 loc) · 1.02 KB
/
Copy pathapi_spec.rb
File metadata and controls
46 lines (36 loc) · 1.02 KB
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
41
42
43
44
45
46
require 'spec_helper'
require 'goliath/api'
describe Goliath::API do
DummyApi = Class.new(Goliath::API)
describe "middlewares" do
it "doesn't change after multi calls" do
2.times { DummyApi.should have(2).middlewares }
end
it "should include all middlewares from superclasses" do
c1 = Class.new(Goliath::API) do
use Goliath::Rack::Params
end
c2 = Class.new(c1) do
use Goliath::Rack::DefaultMimeType
end
base_middlewares = DummyApi.middlewares
middlewares = c2.middlewares - base_middlewares
middlewares.size.should == 2
middlewares[0][0].should == Goliath::Rack::Params
middlewares[1][0].should == Goliath::Rack::DefaultMimeType
end
end
describe ".maps?" do
context "when not using maps" do
it "returns false" do
DummyApi.maps?.should be_false
end
end
context "when using maps" do
it "returns true" do
DummyApi.map "/foo"
DummyApi.maps?.should be_true
end
end
end
end