sinatra-pages 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/spec/pages_spec.rb +9 -10
- metadata +1 -1
data/spec/pages_spec.rb
CHANGED
@@ -18,15 +18,14 @@ describe Sinatra::Pages do
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
21
|
before :all do
|
23
22
|
FileUtils.mkdir 'views'
|
24
23
|
PAGES.each{|page| create_file_for.(page)}
|
25
24
|
end
|
26
25
|
|
27
|
-
context "
|
28
|
-
context "
|
29
|
-
it "should render the Home page
|
26
|
+
context "uses HTTP GET request method" do
|
27
|
+
context "with no Layout file" do
|
28
|
+
it "should render just the Home page if the given route is either empty or root." do
|
30
29
|
File.exist?("views/#{file_of.('Home')}.haml").should be_true
|
31
30
|
|
32
31
|
['/', ''].each do |route|
|
@@ -37,7 +36,7 @@ describe Sinatra::Pages do
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
it "should render an existing page
|
39
|
+
it "should render just an existing page if the given route match the '/:page' pattern." do
|
41
40
|
PAGES.each do |page|
|
42
41
|
File.exist?("views/#{file_of.(page)}.haml").should be_true
|
43
42
|
|
@@ -48,7 +47,7 @@ describe Sinatra::Pages do
|
|
48
47
|
end
|
49
48
|
end
|
50
49
|
|
51
|
-
it "should render the Not Found page
|
50
|
+
it "should render just the Not Found page if a given route can't find its static page on 'views/'." do
|
52
51
|
File.exist?("views/#{file_of.('Do Not Exist')}.haml").should be_false
|
53
52
|
|
54
53
|
get "/#{file_of.('Do Not Exist')}"
|
@@ -58,12 +57,12 @@ describe Sinatra::Pages do
|
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
|
-
context "
|
60
|
+
context "with a Layout file" do
|
62
61
|
before :all do
|
63
62
|
create_file_for.('Layout', ['Layout', '= yield'])
|
64
63
|
end
|
65
64
|
|
66
|
-
it "should render the Layout and Home page if the given route is either empty or root." do
|
65
|
+
it "should render both the Layout and Home page if the given route is either empty or root." do
|
67
66
|
File.exist?("views/#{file_of.('Layout')}.haml").should be_true
|
68
67
|
File.exist?("views/#{file_of.('Home')}.haml").should be_true
|
69
68
|
|
@@ -76,7 +75,7 @@ describe Sinatra::Pages do
|
|
76
75
|
end
|
77
76
|
end
|
78
77
|
|
79
|
-
it "should render the Layout and an existing page if the given route match the '/:page' pattern." do
|
78
|
+
it "should render both the Layout and an existing page if the given route match the '/:page' pattern." do
|
80
79
|
PAGES.each do |page|
|
81
80
|
File.exist?("views/#{file_of.('Layout')}.haml").should be_true
|
82
81
|
File.exist?("views/#{file_of.(page)}.haml").should be_true
|
@@ -89,7 +88,7 @@ describe Sinatra::Pages do
|
|
89
88
|
end
|
90
89
|
end
|
91
90
|
|
92
|
-
it "should render the Layout and the Not Found page if a given route can't find its static page on 'views/'." do
|
91
|
+
it "should render both the Layout and the Not Found page if a given route can't find its static page on 'views/'." do
|
93
92
|
File.exist?("views/#{file_of.('Layout')}.haml").should be_true
|
94
93
|
File.exist?("views/#{file_of.('Do Not Exist')}.haml").should be_false
|
95
94
|
|