/
sources_spec.rb
98 lines (76 loc) · 1.8 KB
/
sources_spec.rb
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/helpers/sources')
describe "Sources" do
describe "DSL methods" do
before do
@config = Sources.instance_variable_get("@r")
end
it "name should be 'sources'" do
@config[:name].should == "sources"
end
it "model should be Source" do
@config[:model].should == Source
end
it "resource should be Sources" do
@config[:resource].should == Sources
end
it "read_only should be empty" do
@config[:read_only].should == []
end
it "callbacks should be empty" do
@config[:callbacks].should == {}
end
end
describe "actions" do
before do
@actions = Sources.actions
end
describe "get" do
before do
@acts = @actions[:get]
end
it "get /?" do
@acts.should include("/?")
end
it "get /:id/?" do
@acts.should include("/:id/?")
end
it "exactly 2 actions" do
@acts.length.should == 2
end
end
describe "post" do
before do
@acts = @actions[:post]
end
it "post /?" do
@acts.should include("/?")
end
it "exactly 1 action" do
@acts.length.should == 1
end
end
describe "put" do
before do
@acts = @actions[:put]
end
it "put /:id/?" do
@acts.should include("/:id/?")
end
it "exactly 1 action" do
@acts.length.should == 1
end
end
describe "delete" do
before do
@acts = @actions[:delete]
end
it "delete /:id/?" do
@acts.should include("/:id/?")
end
it "exactly 1 action" do
@acts.length.should == 1
end
end
end
end