sinatra-pages 0.5.7 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +7 -1
- data/lib/sinatra/pages.rb +2 -0
- data/spec/pages_spec.rb +9 -10
- metadata +1 -1
data/Rakefile
CHANGED
@@ -58,7 +58,13 @@ Spec::Rake::SpecTask.new(:rcov) do |task|
|
|
58
58
|
task.rcov_opts = IO.readlines('spec/opts/rcov.opts').each{|line| line.chomp!}
|
59
59
|
end
|
60
60
|
|
61
|
+
desc "Install the generated Gem into your system."
|
62
|
+
task :install => [:package] do
|
63
|
+
sh 'gem19 install pkg/*.gem'
|
64
|
+
end
|
65
|
+
|
61
66
|
desc "Deployment on Github and Gemcutter."
|
62
|
-
task :deploy => ['deployment:github', 'deployment:gemcutter'
|
67
|
+
task :deploy => ['deployment:github', 'deployment:gemcutter']
|
63
68
|
|
69
|
+
desc "Default is Functional testing with RSpec."
|
64
70
|
task :default => [:spec]
|
data/lib/sinatra/pages.rb
CHANGED
data/spec/pages_spec.rb
CHANGED
@@ -12,10 +12,9 @@ describe Sinatra::Pages do
|
|
12
12
|
file_of = ->(page){page.downcase.gsub ' ', '_'}
|
13
13
|
separate = ->(text){text.chomp.split("\n")}
|
14
14
|
create_file_for = ->(page, content=[]) do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
content << '= "#{params[:page]}"'
|
16
|
+
|
17
|
+
File.open("views/#{file_of.(page)}.haml", 'w') {|file| content.each{|line| file.puts line}}
|
19
18
|
end
|
20
19
|
|
21
20
|
before :all do
|
@@ -33,7 +32,7 @@ describe Sinatra::Pages do
|
|
33
32
|
get route
|
34
33
|
|
35
34
|
last_response.should be_ok
|
36
|
-
last_response.body.chomp.should == 'Home'
|
35
|
+
last_response.body.chomp.should == file_of.('Home')
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
@@ -45,7 +44,7 @@ describe Sinatra::Pages do
|
|
45
44
|
get "/#{file_of.(page)}"
|
46
45
|
|
47
46
|
last_response.should be_ok
|
48
|
-
last_response.body.chomp.should == page
|
47
|
+
last_response.body.chomp.should == file_of.(page)
|
49
48
|
end
|
50
49
|
end
|
51
50
|
|
@@ -56,7 +55,7 @@ describe Sinatra::Pages do
|
|
56
55
|
get "/#{file_of.('Do Not Exist')}"
|
57
56
|
|
58
57
|
last_response.should be_not_found
|
59
|
-
last_response.body.chomp.should == 'Not Found'
|
58
|
+
last_response.body.chomp.should == file_of.('Not Found')
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
@@ -74,7 +73,7 @@ describe Sinatra::Pages do
|
|
74
73
|
|
75
74
|
last_response.should be_ok
|
76
75
|
separate.(last_response.body).first.should == 'Layout'
|
77
|
-
separate.(last_response.body).last.should == 'Home'
|
76
|
+
separate.(last_response.body).last.should == file_of.('Home')
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
@@ -87,7 +86,7 @@ describe Sinatra::Pages do
|
|
87
86
|
|
88
87
|
last_response.should be_ok
|
89
88
|
separate.(last_response.body).first.should == 'Layout'
|
90
|
-
separate.(last_response.body).last.should == page
|
89
|
+
separate.(last_response.body).last.should == file_of.(page)
|
91
90
|
end
|
92
91
|
end
|
93
92
|
|
@@ -99,7 +98,7 @@ describe Sinatra::Pages do
|
|
99
98
|
|
100
99
|
last_response.should be_not_found
|
101
100
|
separate.(last_response.body).first.should == 'Layout'
|
102
|
-
separate.(last_response.body).last.should == 'Not Found'
|
101
|
+
separate.(last_response.body).last.should == file_of.('Not Found')
|
103
102
|
end
|
104
103
|
|
105
104
|
after :all do
|