ramaze 2012.12.08 → 2023.01.06
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/examples/app/whywiki/spec/whywiki.rb +22 -24
- data/examples/app/whywiki/start.rb +10 -9
- data/examples/app/whywiki/{template → view}/edit.xhtml +2 -2
- data/examples/app/whywiki/view/show.xhtml +20 -0
- data/examples/app/wikore/spec/wikore.rb +1 -1
- data/guide/AUTHORS +11 -3
- data/guide/CHANGELOG +3761 -3599
- data/guide/general/sessions.md +42 -0
- data/lib/proto/Gemfile +2 -2
- data/lib/ramaze/cache/memcache.rb +3 -3
- data/lib/ramaze/cache/moneta.rb +143 -0
- data/lib/ramaze/cache/redis.rb +8 -11
- data/lib/ramaze/cache/sequel.rb +2 -2
- data/lib/ramaze/cache.rb +1 -0
- data/lib/ramaze/files.rb +1 -1
- data/lib/ramaze/helper/paginate.rb +5 -0
- data/lib/ramaze/helper/request_accessor.rb +3 -1
- data/lib/ramaze/helper/stack.rb +1 -1
- data/lib/ramaze/helper/upload.rb +1 -1
- data/lib/ramaze/log/syslog.rb +1 -1
- data/lib/ramaze/request.rb +2 -2
- data/lib/ramaze/snippets.rb +0 -1
- data/lib/ramaze/version.rb +3 -1
- data/lib/ramaze/view/nagoro/render_partial.rb +1 -1
- data/lib/ramaze.rb +1 -1
- data/ramaze.gemspec +11 -12
- data/spec/ramaze/cache/moneta.rb +53 -0
- data/spec/ramaze/cache/redis.rb +1 -1
- data/spec/ramaze/dispatcher/directory.rb +14 -7
- data/spec/ramaze/dispatcher/file.rb +0 -5
- data/spec/ramaze/error.rb +13 -17
- data/spec/ramaze/helper/paginate.rb +25 -0
- data/spec/ramaze/log/syslog.rb +11 -2
- data/spec/ramaze/session/redis.rb +2 -2
- data/spec/ramaze/view/haml.rb +3 -3
- data/spec/ramaze/view/slim.rb +1 -1
- metadata +88 -158
- data/.gems +0 -28
- data/.gitignore +0 -14
- data/.mailmap +0 -34
- data/.rvmrc +0 -2
- data/.travis.yml +0 -16
- data/.yardopts +0 -14
- data/examples/app/blog/public/.htaccess +0 -24
- data/examples/app/whywiki/template/show.xhtml +0 -18
- data/lib/ramaze/cache/localmemcache.rb +0 -53
- data/lib/ramaze/snippets/ramaze/lru_hash.rb +0 -247
- data/spec/ramaze/cache/localmemcache.rb +0 -50
- data/spec/ramaze/session/localmemcache.rb +0 -60
data/spec/ramaze/error.rb
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
# All files in this distribution are subject to the terms of the MIT license.
|
3
3
|
|
4
4
|
require File.expand_path('../../../spec/helper', __FILE__)
|
5
|
-
require '
|
6
|
-
require 'rexml/xpath'
|
5
|
+
require 'nokogiri'
|
7
6
|
|
8
7
|
class SpecError < Ramaze::Controller
|
9
8
|
map '/'
|
@@ -40,15 +39,14 @@ describe 'Error handling' do
|
|
40
39
|
Ramaze.options.mode = :dev
|
41
40
|
|
42
41
|
it 'uses Rack::ShowException to display errors' do
|
43
|
-
got = get('/raises')
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
doc =
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
should == "Rack::ShowExceptions"
|
42
|
+
got = get('/raises', {}, {'HTTP_ACCEPT' => 'text/html'})
|
43
|
+
got.status.should == 500
|
44
|
+
got['Content-Type'].should == 'text/html'
|
45
|
+
|
46
|
+
doc = Nokogiri::HTML(got.body)
|
47
|
+
doc.at("#summary").text.should.match(/NameError at \/raises/)
|
48
|
+
doc.at("#explanation").text.strip.should ==
|
49
|
+
"You're seeing this error because you use Rack::ShowExceptions."
|
52
50
|
end
|
53
51
|
|
54
52
|
it 'uses original action_missing when no action was found' do
|
@@ -78,11 +76,9 @@ describe 'Error handling' do
|
|
78
76
|
got = get('/empty')
|
79
77
|
[got.status, got['Content-Type']].should == [404, 'text/html']
|
80
78
|
|
81
|
-
|
82
|
-
doc
|
83
|
-
|
84
|
-
|
85
|
-
REXML::XPath.first(doc, "/html/body/div[3]/p/code").text.
|
86
|
-
should == "Rack::ShowStatus"
|
79
|
+
doc = Nokogiri::HTML(got.body)
|
80
|
+
doc.at("#info").text.strip.should == "Not Found"
|
81
|
+
doc.at("#explanation").text.strip.should ==
|
82
|
+
"You're seeing this error because you use Rack::ShowStatus."
|
87
83
|
end
|
88
84
|
end
|
@@ -32,6 +32,13 @@ class SpecHelperPaginateArray < Ramaze::Controller
|
|
32
32
|
pager.each{|item| out << item }
|
33
33
|
out.inspect
|
34
34
|
end
|
35
|
+
|
36
|
+
def preserve_params
|
37
|
+
request.params['single'] = 'zero'
|
38
|
+
request.params['multiple'] = %w[ one two three ]
|
39
|
+
pager = paginate(ALPHA)
|
40
|
+
pager.navigation
|
41
|
+
end
|
35
42
|
end
|
36
43
|
|
37
44
|
describe Ramaze::Helper::Paginate do
|
@@ -275,5 +282,23 @@ describe Ramaze::Helper::Paginate do
|
|
275
282
|
|
276
283
|
end
|
277
284
|
|
285
|
+
it 'preserves single value params' do
|
286
|
+
doc = Nokogiri::HTML(get("/array/preserve_params").body)
|
287
|
+
params = doc.search("//a").first[:href].split('?').last.split('&')
|
288
|
+
params.should.include 'single=zero'
|
289
|
+
params.should.not.include 'single[]'.escape(:cgi) + '=zero'
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'preserves multi value params' do
|
293
|
+
doc = Nokogiri::HTML(get("/array/preserve_params").body)
|
294
|
+
params = doc.search("//a").first[:href].split('?').last.split('&')
|
295
|
+
params.should.not.include 'multiple=one'
|
296
|
+
params.should.not.include 'multiple=two'
|
297
|
+
params.should.not.include 'multiple=three'
|
298
|
+
params.should.include 'multiple[]'.escape(:cgi) + '=one'
|
299
|
+
params.should.include 'multiple[]'.escape(:cgi) + '=two'
|
300
|
+
params.should.include 'multiple[]'.escape(:cgi) + '=three'
|
301
|
+
end
|
302
|
+
|
278
303
|
end
|
279
304
|
end
|
data/spec/ramaze/log/syslog.rb
CHANGED
@@ -56,8 +56,17 @@ describe 'Syslog' do
|
|
56
56
|
}
|
57
57
|
logpipe[1].close
|
58
58
|
Process.waitpid(child)
|
59
|
-
|
60
|
-
|
59
|
+
label = case priority
|
60
|
+
# when 'debug', 'info', 'error'
|
61
|
+
# priority
|
62
|
+
when :dev
|
63
|
+
'debug'
|
64
|
+
when :warn
|
65
|
+
'warning'
|
66
|
+
else
|
67
|
+
priority.to_s
|
68
|
+
end
|
69
|
+
logpipe[0].gets.slice(/ramaze.*/).should == "ramaze_syslog_test[#{child}] <#{label.capitalize}>: #{msg}"
|
61
70
|
end
|
62
71
|
|
63
72
|
it 'should handle debug' do
|
@@ -2,8 +2,8 @@ require File.expand_path('../../../../spec/helper', __FILE__)
|
|
2
2
|
spec_require 'redis'
|
3
3
|
|
4
4
|
spec_precondition 'Redis is running' do
|
5
|
-
cache
|
6
|
-
cache
|
5
|
+
cache = Redis.new
|
6
|
+
"OK" == cache.set('testkey', 'testval')
|
7
7
|
end
|
8
8
|
|
9
9
|
class SpecSession < Ramaze::Controller
|
data/spec/ramaze/view/haml.rb
CHANGED
@@ -72,7 +72,7 @@ describe Ramaze::View::Haml do
|
|
72
72
|
<li>
|
73
73
|
<a href='/external'>External template</a>
|
74
74
|
</li>
|
75
|
-
</ul>"
|
75
|
+
</ul>".gsub(/\n\s+/, "\n")
|
76
76
|
end
|
77
77
|
|
78
78
|
should 'render external template' do
|
@@ -87,7 +87,7 @@ describe Ramaze::View::Haml do
|
|
87
87
|
<body>
|
88
88
|
<h1>Haml Template</h1>
|
89
89
|
</body>
|
90
|
-
</html>"
|
90
|
+
</html>".gsub(/\n\s+/, "\n")
|
91
91
|
end
|
92
92
|
|
93
93
|
should 'render external template with instance variables' do
|
@@ -97,7 +97,7 @@ describe Ramaze::View::Haml do
|
|
97
97
|
got.body.strip.should ==
|
98
98
|
"<div>
|
99
99
|
3
|
100
|
-
</div>"
|
100
|
+
</div>".gsub(/\n\s+/, "\n")
|
101
101
|
end
|
102
102
|
|
103
103
|
should 'render the wrapped view twice even with caching' do
|
data/spec/ramaze/view/slim.rb
CHANGED