ramaze 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +20 -3
- data/bin/ramaze +1 -4
- data/doc/AUTHORS +2 -1
- data/doc/CHANGELOG +539 -32
- data/doc/LEGAL +4 -0
- data/doc/meta/announcement.txt +79 -47
- data/examples/blog/README +2 -2
- data/examples/blog/spec/blog.rb +33 -48
- data/examples/blog/src/controller.rb +15 -13
- data/examples/blog/src/model.rb +28 -10
- data/examples/blog/start.rb +0 -10
- data/examples/blog/template/edit.xhtml +1 -1
- data/examples/blog/template/index.xhtml +2 -2
- data/examples/facebook.rb +152 -0
- data/examples/linking.rb +28 -0
- data/examples/ramaise.rb +4 -11
- data/examples/rammit/spec/rammit.rb +30 -0
- data/examples/rammit/src/controller/main.rb +3 -0
- data/examples/rammit/src/controller/page.rb +16 -0
- data/examples/rammit/src/model.rb +33 -0
- data/examples/rammit/start.rb +7 -0
- data/examples/rammit/template/index.xhtml +14 -0
- data/examples/rammit/template/page/view.xhtml +4 -0
- data/examples/rapaste/Rakefile +28 -0
- data/examples/rapaste/public/css/active4d.css +114 -0
- data/examples/rapaste/public/css/all_hallows_eve.css +72 -0
- data/examples/rapaste/public/css/amy.css +147 -0
- data/examples/rapaste/public/css/blackboard.css +88 -0
- data/examples/rapaste/public/css/brilliance_black.css +605 -0
- data/examples/rapaste/public/css/brilliance_dull.css +599 -0
- data/examples/rapaste/public/css/cobalt.css +149 -0
- data/examples/rapaste/public/css/dawn.css +121 -0
- data/examples/rapaste/public/css/display.css +179 -0
- data/examples/rapaste/public/css/eiffel.css +121 -0
- data/examples/rapaste/public/css/espresso_libre.css +109 -0
- data/examples/rapaste/public/css/idle.css +62 -0
- data/examples/rapaste/public/css/iplastic.css +80 -0
- data/examples/rapaste/public/css/lazy.css +73 -0
- data/examples/rapaste/public/css/mac_classic.css +123 -0
- data/examples/rapaste/public/css/magicwb_amiga.css +104 -0
- data/examples/rapaste/public/css/pastels_on_dark.css +188 -0
- data/examples/rapaste/public/css/slush_poppies.css +85 -0
- data/examples/rapaste/public/css/spacecadet.css +51 -0
- data/examples/rapaste/public/css/sunburst.css +180 -0
- data/examples/rapaste/public/css/twilight.css +137 -0
- data/examples/rapaste/public/css/zenburnesque.css +91 -0
- data/examples/rapaste/public/js/jquery.js +11 -0
- data/examples/rapaste/rapaste.sqlite +0 -0
- data/examples/rapaste/spec/rapaste.rb +49 -0
- data/examples/rapaste/src/controller.rb +69 -0
- data/examples/rapaste/src/model.rb +61 -0
- data/examples/rapaste/start.rb +20 -0
- data/examples/rapaste/template/copy.xhtml +10 -0
- data/examples/rapaste/template/index.xhtml +9 -0
- data/examples/rapaste/template/layout.xhtml +22 -0
- data/examples/rapaste/template/list.xhtml +28 -0
- data/examples/rapaste/template/view.xhtml +37 -0
- data/examples/sourceview/sourceview.rb +3 -3
- data/examples/templates/template_amrita2.rb +1 -3
- data/examples/todolist/spec/todolist.rb +15 -18
- data/examples/whywiki/spec/whywiki.rb +15 -20
- data/examples/whywiki/start.rb +0 -1
- data/examples/wikore/spec/wikore.rb +14 -19
- data/examples/wiktacular/spec/wiktacular.rb +8 -15
- data/lib/proto/{src/controller → controller}/main.rb +4 -4
- data/lib/proto/public/css/ramaze_error.css +39 -3
- data/lib/proto/public/js/jquery.js +2039 -1020
- data/lib/proto/spec/main.rb +27 -0
- data/lib/proto/start.rb +5 -5
- data/lib/proto/view/error.xhtml +62 -0
- data/lib/proto/view/index.xhtml +34 -0
- data/lib/proto/view/page.xhtml +15 -0
- data/lib/ramaze.rb +9 -7
- data/lib/ramaze/action.rb +7 -3
- data/lib/ramaze/action/render.rb +15 -5
- data/lib/ramaze/adapter.rb +5 -5
- data/lib/ramaze/adapter/base.rb +2 -2
- data/lib/ramaze/adapter/cgi.rb +1 -1
- data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
- data/lib/ramaze/adapter/fcgi.rb +2 -2
- data/lib/ramaze/adapter/mongrel.rb +1 -1
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
- data/lib/ramaze/adapter/thin.rb +25 -0
- data/lib/ramaze/adapter/webrick.rb +1 -1
- data/lib/ramaze/cache.rb +3 -2
- data/lib/ramaze/cache/memcached.rb +1 -1
- data/lib/ramaze/cache/memory.rb +1 -1
- data/lib/ramaze/cache/yaml_store.rb +1 -1
- data/lib/ramaze/contrib.rb +1 -1
- data/lib/ramaze/contrib/auto_params.rb +12 -5
- data/lib/ramaze/contrib/auto_params/get_args.rb +1 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +168 -0
- data/lib/ramaze/contrib/gettext.rb +111 -0
- data/lib/ramaze/contrib/gettext/mo.rb +155 -0
- data/lib/ramaze/contrib/gettext/po.rb +109 -0
- data/lib/ramaze/contrib/gzip_filter.rb +1 -1
- data/lib/ramaze/contrib/route.rb +15 -5
- data/lib/ramaze/contrib/sequel/fill.rb +1 -1
- data/lib/ramaze/controller.rb +10 -4
- data/lib/ramaze/controller/error.rb +5 -13
- data/lib/ramaze/controller/main.rb +2 -0
- data/lib/ramaze/controller/resolve.rb +18 -10
- data/lib/ramaze/dispatcher.rb +1 -1
- data/lib/ramaze/dispatcher/action.rb +1 -1
- data/lib/ramaze/dispatcher/directory.rb +3 -2
- data/lib/ramaze/dispatcher/error.rb +5 -5
- data/lib/ramaze/dispatcher/file.rb +13 -2
- data/lib/ramaze/error.rb +1 -1
- data/lib/ramaze/gestalt.rb +2 -2
- data/lib/ramaze/global.rb +5 -5
- data/lib/ramaze/global/dsl.rb +1 -1
- data/lib/ramaze/global/globalstruct.rb +11 -5
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +1 -1
- data/lib/ramaze/helper/auth.rb +2 -2
- data/lib/ramaze/helper/cache.rb +1 -1
- data/lib/ramaze/helper/cgi.rb +1 -1
- data/lib/ramaze/helper/file.rb +1 -1
- data/lib/ramaze/helper/flash.rb +1 -1
- data/lib/ramaze/helper/formatting.rb +1 -1
- data/lib/ramaze/helper/identity.rb +1 -1
- data/lib/ramaze/helper/inform.rb +1 -1
- data/lib/ramaze/helper/link.rb +4 -4
- data/lib/ramaze/helper/markaby.rb +1 -1
- data/lib/ramaze/helper/nitroform.rb +1 -1
- data/lib/ramaze/helper/pager.rb +2 -1
- data/lib/ramaze/helper/partial.rb +1 -1
- data/lib/ramaze/helper/redirect.rb +6 -1
- data/lib/ramaze/helper/sequel.rb +54 -0
- data/lib/ramaze/helper/stack.rb +1 -1
- data/lib/ramaze/inform.rb +1 -1
- data/lib/ramaze/inform/analogger.rb +1 -1
- data/lib/ramaze/inform/growl.rb +1 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informer.rb +1 -1
- data/lib/ramaze/inform/informing.rb +2 -2
- data/lib/ramaze/inform/knotify.rb +1 -1
- data/lib/ramaze/inform/syslog.rb +1 -1
- data/lib/ramaze/inform/xosd.rb +1 -1
- data/lib/ramaze/snippets.rb +1 -1
- data/lib/ramaze/snippets/array/put_within.rb +1 -1
- data/lib/ramaze/snippets/blankslate.rb +7 -0
- data/lib/ramaze/snippets/dictionary.rb +6 -1
- data/lib/ramaze/snippets/divide.rb +1 -1
- data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
- data/lib/ramaze/snippets/kernel/acquire.rb +39 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -34
- data/lib/ramaze/snippets/kernel/constant.rb +1 -1
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +1 -1
- data/lib/ramaze/snippets/numeric/filesize_format.rb +1 -1
- data/lib/ramaze/snippets/object/traits.rb +1 -1
- data/lib/ramaze/snippets/ordered_set.rb +12 -7
- data/lib/ramaze/snippets/ramaze/caller_info.rb +1 -1
- data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
- data/lib/ramaze/snippets/string/camel_case.rb +1 -1
- data/lib/ramaze/snippets/string/color.rb +2 -4
- data/lib/ramaze/snippets/string/each.rb +1 -1
- data/lib/ramaze/snippets/string/ord.rb +15 -0
- data/lib/ramaze/snippets/string/snake_case.rb +1 -1
- data/lib/ramaze/snippets/struct/fill.rb +4 -2
- data/lib/ramaze/snippets/struct/values_at.rb +2 -2
- data/lib/ramaze/snippets/symbol/to_proc.rb +15 -8
- data/lib/ramaze/snippets/thread/into.rb +1 -1
- data/lib/ramaze/sourcereload.rb +4 -3
- data/lib/ramaze/spec/helper.rb +85 -32
- data/lib/ramaze/spec/helper/bacon.rb +7 -0
- data/lib/ramaze/spec/helper/browser.rb +1 -2
- data/lib/ramaze/spec/helper/mock_http.rb +1 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +70 -0
- data/lib/ramaze/spec/helper/requester.rb +1 -1
- data/lib/ramaze/spec/helper/simple_http.rb +5 -4
- data/lib/ramaze/spec/helper/snippets.rb +6 -0
- data/lib/ramaze/store/default.rb +1 -1
- data/lib/ramaze/template.rb +1 -1
- data/lib/ramaze/template/amrita2.rb +6 -5
- data/lib/ramaze/template/erubis.rb +1 -1
- data/lib/ramaze/template/ezamar.rb +1 -1
- data/lib/ramaze/template/ezamar/element.rb +1 -1
- data/lib/ramaze/template/ezamar/engine.rb +1 -1
- data/lib/ramaze/template/ezamar/morpher.rb +1 -1
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/haml.rb +1 -1
- data/lib/ramaze/template/liquid.rb +1 -1
- data/lib/ramaze/template/markaby.rb +1 -1
- data/lib/ramaze/template/nagoro.rb +4 -6
- data/lib/ramaze/template/none.rb +1 -1
- data/lib/ramaze/template/remarkably.rb +1 -1
- data/lib/ramaze/template/sass.rb +1 -1
- data/lib/ramaze/tool.rb +1 -1
- data/lib/ramaze/tool/create.rb +7 -1
- data/lib/ramaze/tool/localize.rb +7 -14
- data/lib/ramaze/tool/mime.rb +1 -1
- data/lib/ramaze/tool/record.rb +1 -1
- data/lib/ramaze/trinity.rb +1 -1
- data/lib/ramaze/trinity/request.rb +4 -2
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +7 -1
- data/lib/ramaze/version.rb +3 -3
- data/lib/vendor/bacon.rb +317 -0
- data/rake_tasks/conf.rake +1 -1
- data/rake_tasks/maintenance.rake +7 -5
- data/rake_tasks/spec.rake +54 -40
- data/spec/contrib/auto_params.rb +21 -4
- data/spec/contrib/route.rb +31 -4
- data/spec/contrib/sequel/fill.rb +3 -4
- data/spec/examples/caching.rb +5 -2
- data/spec/examples/css.rb +5 -2
- data/spec/examples/element.rb +5 -4
- data/spec/examples/hello.rb +1 -0
- data/spec/examples/linking.rb +18 -0
- data/spec/examples/simple.rb +13 -18
- data/spec/examples/templates/template_amrita2.rb +3 -2
- data/spec/examples/templates/template_erubis.rb +3 -2
- data/spec/examples/templates/template_ezamar.rb +2 -1
- data/spec/examples/templates/template_haml.rb +3 -2
- data/spec/examples/templates/template_liquid.rb +3 -2
- data/spec/examples/templates/template_markaby.rb +3 -2
- data/spec/examples/templates/template_remarkably.rb +3 -2
- data/spec/ramaze/action/basics.rb +4 -4
- data/spec/ramaze/action/cache.rb +11 -13
- data/spec/ramaze/action/layout.rb +47 -3
- data/spec/ramaze/action/render.rb +3 -3
- data/spec/ramaze/action/template/instancevars/layout.xhtml +1 -0
- data/spec/ramaze/adapter.rb +7 -7
- data/spec/ramaze/adapter/mongrel.rb +1 -1
- data/spec/ramaze/adapter/record.rb +7 -7
- data/spec/ramaze/adapter/webrick.rb +1 -1
- data/spec/ramaze/cache.rb +6 -8
- data/spec/ramaze/controller.rb +77 -65
- data/spec/ramaze/controller/resolve.rb +2 -1
- data/spec/ramaze/controller/template_resolving.rb +3 -4
- data/spec/ramaze/dispatcher.rb +3 -4
- data/spec/ramaze/dispatcher/directory.rb +35 -35
- data/spec/ramaze/dispatcher/file.rb +8 -5
- data/spec/ramaze/element.rb +4 -4
- data/spec/ramaze/error.rb +13 -11
- data/spec/ramaze/gestalt.rb +1 -1
- data/spec/ramaze/helper/aspect.rb +2 -1
- data/spec/ramaze/helper/auth.rb +4 -2
- data/spec/ramaze/helper/cache.rb +10 -9
- data/spec/ramaze/helper/cgi.rb +2 -2
- data/spec/ramaze/helper/file.rb +1 -0
- data/spec/ramaze/helper/flash.rb +5 -4
- data/spec/ramaze/helper/formatting.rb +1 -1
- data/spec/ramaze/helper/link.rb +3 -3
- data/spec/ramaze/helper/pager.rb +44 -80
- data/spec/ramaze/helper/partial.rb +2 -3
- data/spec/ramaze/helper/redirect.rb +10 -1
- data/spec/ramaze/helper/stack.rb +4 -3
- data/spec/ramaze/helper/template/loop.xhtml +2 -1
- data/spec/ramaze/inform/informer.rb +2 -2
- data/spec/ramaze/inform/syslog.rb +1 -1
- data/spec/ramaze/localize.rb +26 -26
- data/spec/ramaze/morpher.rb +6 -7
- data/spec/ramaze/params.rb +7 -8
- data/spec/ramaze/request.rb +27 -6
- data/spec/ramaze/request/mongrel.rb +1 -1
- data/spec/ramaze/request/thin.rb +9 -0
- data/spec/ramaze/session.rb +2 -1
- data/spec/ramaze/store/default.rb +14 -17
- data/spec/ramaze/template.rb +5 -7
- data/spec/ramaze/template/amrita2.rb +4 -1
- data/spec/ramaze/template/erubis.rb +2 -1
- data/spec/ramaze/template/ezamar.rb +2 -3
- data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
- data/spec/ramaze/template/haml.rb +2 -1
- data/spec/ramaze/template/liquid.rb +4 -2
- data/spec/ramaze/template/markaby.rb +4 -2
- data/spec/ramaze/template/nagoro.rb +3 -4
- data/spec/ramaze/template/remarkably.rb +4 -2
- data/spec/ramaze/template/sass.rb +3 -2
- data/spec/ramaze/template/xslt.rb +4 -7
- data/spec/ramaze/trinity/request.rb +4 -3
- data/spec/ramaze/trinity/session.rb +6 -4
- data/spec/snippets/array/put_within.rb +3 -2
- data/spec/snippets/divide.rb +1 -4
- data/spec/snippets/kernel/__dir__.rb +1 -1
- data/spec/snippets/kernel/acquire.rb +71 -0
- data/spec/snippets/kernel/constant.rb +4 -8
- data/spec/snippets/numeric/filesize_format.rb +1 -1
- data/spec/snippets/ordered_set.rb +9 -2
- data/spec/snippets/ramaze/caller_info.rb +3 -3
- data/spec/snippets/ramaze/caller_lines.rb +3 -3
- data/spec/snippets/string/camel_case.rb +1 -1
- data/spec/snippets/string/color.rb +2 -2
- data/spec/snippets/string/snake_case.rb +5 -1
- data/spec/snippets/string/unindent.rb +1 -1
- data/spec/snippets/struct/fill.rb +14 -15
- data/spec/snippets/struct/values_at.rb +15 -10
- data/spec/snippets/symbol/to_proc.rb +13 -0
- data/spec/snippets/thread/into.rb +3 -4
- metadata +458 -386
- data/doc/README.html +0 -729
- data/doc/changes.txt +0 -5044
- data/doc/changes.xml +0 -5046
- data/lib/proto/public/error.zmr +0 -61
- data/lib/proto/src/element/page.rb +0 -17
- data/lib/proto/src/model.rb +0 -6
- data/lib/proto/template/index.xhtml +0 -15
- data/lib/ramaze/spec/helper/layout.rb +0 -58
- data/lib/ramaze/spec/helper/minimal.rb +0 -23
- data/lib/ramaze/spec/helper/wrap.rb +0 -198
- data/spec/snippets/kernel/aquire.rb +0 -71
@@ -27,9 +27,8 @@ class TCPartialHelperController < Ramaze::Controller
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe "PartialHelper" do
|
30
|
-
|
31
|
-
|
32
|
-
end
|
30
|
+
behaves_like 'http'
|
31
|
+
ramaze
|
33
32
|
|
34
33
|
it "should render partials" do
|
35
34
|
get('/').body.should == '<html><head><title>Title</title></head></html>'
|
@@ -52,10 +52,15 @@ class TCRedirectHelperController < Ramaze::Controller
|
|
52
52
|
def respond_with_status
|
53
53
|
respond 'not found', 404
|
54
54
|
end
|
55
|
+
|
56
|
+
def redirect_unmodified
|
57
|
+
raw_redirect '/noop'
|
58
|
+
end
|
55
59
|
end
|
56
60
|
|
57
61
|
describe "RedirectHelper" do
|
58
|
-
|
62
|
+
behaves_like 'http', 'browser'
|
63
|
+
ramaze(:adapter => :webrick)
|
59
64
|
|
60
65
|
b = Browser.new
|
61
66
|
|
@@ -100,4 +105,8 @@ describe "RedirectHelper" do
|
|
100
105
|
page.status.should == 404
|
101
106
|
page.body.should == 'not found'
|
102
107
|
end
|
108
|
+
|
109
|
+
it 'should redirect without modifying the target' do
|
110
|
+
get('/redirect_unmodified').headers['Location'].should == '/noop'
|
111
|
+
end
|
103
112
|
end
|
data/spec/ramaze/helper/stack.rb
CHANGED
@@ -42,10 +42,11 @@ class TCStackHelperController < Ramaze::Controller
|
|
42
42
|
end
|
43
43
|
|
44
44
|
describe "StackHelper" do
|
45
|
+
behaves_like 'browser'
|
45
46
|
ramaze(:adapter => :webrick)
|
46
47
|
|
47
48
|
it "conventional login" do
|
48
|
-
|
49
|
+
Browser.new do
|
49
50
|
get('/secure').should == 'please login'
|
50
51
|
get('/login')
|
51
52
|
get('/secure').should == 'secret content'
|
@@ -54,7 +55,7 @@ describe "StackHelper" do
|
|
54
55
|
end
|
55
56
|
|
56
57
|
it "indirect login" do
|
57
|
-
|
58
|
+
Browser.new do
|
58
59
|
get('/foo').should == 'logged in'
|
59
60
|
get('/secure').should == 'secret content'
|
60
61
|
eget('/').should == {:logged_in => true}
|
@@ -62,7 +63,7 @@ describe "StackHelper" do
|
|
62
63
|
end
|
63
64
|
|
64
65
|
it "indirect login with params" do
|
65
|
-
|
66
|
+
Browser.new do
|
66
67
|
eget('/bar', 'x' => 'y').should == {'x' => 'y'}
|
67
68
|
eget('/').should == {:logged_in => true}
|
68
69
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec/helper'
|
2
2
|
|
3
3
|
describe 'Informer' do
|
4
|
-
before
|
4
|
+
before do
|
5
5
|
@out = []
|
6
6
|
def @out.puts(*args) push(*args) end
|
7
7
|
Ramaze::Informer.trait[:colorize] = false
|
@@ -61,7 +61,7 @@ describe 'Informer' do
|
|
61
61
|
begin
|
62
62
|
i = Ramaze::Informer.new('tmp.dummy')
|
63
63
|
out = i.out
|
64
|
-
out.should
|
64
|
+
out.should.be.instance_of(File)
|
65
65
|
out.path.should == 'tmp.dummy'
|
66
66
|
ensure
|
67
67
|
out.close
|
data/spec/ramaze/localize.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'ya2yaml', 'ramaze/tool/localize'
|
7
7
|
|
8
8
|
Ramaze::Tool::Localize.trait :enable => true,
|
9
9
|
:file => 'spec/ramaze/conf/locale_%s.yaml'.freeze,
|
@@ -26,31 +26,33 @@ class TCLocalize < Ramaze::Controller
|
|
26
26
|
end
|
27
27
|
|
28
28
|
describe "Localize" do
|
29
|
-
|
30
|
-
@dir = __DIR__ / :conf
|
31
|
-
FileUtils.mkdir_p(@dir)
|
29
|
+
behaves_like 'http'
|
32
30
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
31
|
+
@dir = __DIR__ / :conf
|
32
|
+
FileUtils.mkdir_p(@dir)
|
33
|
+
|
34
|
+
dict = {
|
35
|
+
:de => {
|
36
|
+
'hello' => 'Hallo, Welt!',
|
37
|
+
'this' => 'Das',
|
38
|
+
'is' => 'ist',
|
39
|
+
'a' => 'ein',
|
40
|
+
'test' => 'Test',
|
41
|
+
},
|
42
|
+
:en => {
|
43
|
+
'hello' => 'Hello, World!',
|
44
|
+
'this' => 'this',
|
45
|
+
'is' => 'is',
|
46
|
+
'a' => 'a',
|
47
|
+
'test' => 'test',
|
48
|
+
} }
|
49
|
+
|
50
|
+
dict.each do |lang, dic|
|
51
|
+
File.open(@dir/"locale_#{lang}.yaml", 'w+'){|fp| fp.print(dic.to_yaml)}
|
52
52
|
end
|
53
53
|
|
54
|
+
ramaze
|
55
|
+
|
54
56
|
it "hello world" do
|
55
57
|
get('/hello').body.should == 'Hello, World!'
|
56
58
|
get('/hello/de').body.should == 'Hallo, Welt!'
|
@@ -61,7 +63,5 @@ describe "Localize" do
|
|
61
63
|
get('/advanced/de').body.should == 'Das ist ein Test'
|
62
64
|
end
|
63
65
|
|
64
|
-
|
65
|
-
FileUtils.rm_rf(@dir)
|
66
|
-
end
|
66
|
+
FileUtils.rm_rf(@dir)
|
67
67
|
end
|
data/spec/ramaze/morpher.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
require 'spec/helper'
|
5
5
|
|
6
|
-
|
6
|
+
spec_require 'hpricot'
|
7
7
|
require 'ramaze/template/ezamar/morpher'
|
8
8
|
|
9
9
|
class TCMorpherController < Ramaze::Controller
|
@@ -66,12 +66,11 @@ class TCMorpherController < Ramaze::Controller
|
|
66
66
|
end
|
67
67
|
|
68
68
|
describe "Morpher" do
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
69
|
+
behaves_like 'http'
|
70
|
+
ramaze
|
71
|
+
pipeline = Ramaze::Template::Ezamar::TRANSFORM_PIPELINE
|
72
|
+
pipeline.clear
|
73
|
+
pipeline.push(Ezamar::Element, Ezamar::Morpher)
|
75
74
|
|
76
75
|
def clean_get(*url)
|
77
76
|
get(*url).body.split("\n").join.strip
|
data/spec/ramaze/params.rb
CHANGED
@@ -60,9 +60,8 @@ class TCParamsController3 < Ramaze::Controller
|
|
60
60
|
end
|
61
61
|
|
62
62
|
describe "Simple Parameters" do
|
63
|
-
|
64
|
-
|
65
|
-
end
|
63
|
+
behaves_like 'http'
|
64
|
+
ramaze
|
66
65
|
|
67
66
|
def handle(*url)
|
68
67
|
Ramaze::Controller.handle(*url)
|
@@ -78,7 +77,7 @@ describe "Simple Parameters" do
|
|
78
77
|
|
79
78
|
it "call /bar though index doesn't take params" do
|
80
79
|
lambda{ handle('/bar') }.
|
81
|
-
should
|
80
|
+
should.raise(Ramaze::Error::NoAction)
|
82
81
|
end
|
83
82
|
|
84
83
|
it "action that takes a single param" do
|
@@ -91,7 +90,7 @@ describe "Simple Parameters" do
|
|
91
90
|
|
92
91
|
it "action that takes two params but we give only one" do
|
93
92
|
lambda{ handle('/double_param/foo') }.
|
94
|
-
should
|
93
|
+
should.raise(Ramaze::Error::NoAction)
|
95
94
|
end
|
96
95
|
|
97
96
|
it "action that takes all params" do
|
@@ -104,7 +103,7 @@ describe "Simple Parameters" do
|
|
104
103
|
|
105
104
|
it "action that takes all params but needs at least one (not given here)" do
|
106
105
|
lambda{ handle('/at_least_one') }.
|
107
|
-
should
|
106
|
+
should.raise(ArgumentError)
|
108
107
|
end
|
109
108
|
|
110
109
|
it "one default" do
|
@@ -126,12 +125,12 @@ describe "Simple Parameters" do
|
|
126
125
|
|
127
126
|
it "jo/add should raise with 0 parameters" do
|
128
127
|
lambda{ handle('/jo/add') }.
|
129
|
-
should
|
128
|
+
should.raise(ArgumentError)
|
130
129
|
end
|
131
130
|
|
132
131
|
it "add should raise with 4 parameters" do
|
133
132
|
lambda{ handle('/jo/add/1/2/3/4') }.
|
134
|
-
should
|
133
|
+
should.raise(ArgumentError)
|
135
134
|
end
|
136
135
|
|
137
136
|
it "add should not raise with 1-3 parameters" do
|
data/spec/ramaze/request.rb
CHANGED
@@ -5,6 +5,7 @@ require 'spec/helper'
|
|
5
5
|
|
6
6
|
class TCRequestController < Ramaze::Controller
|
7
7
|
map '/'
|
8
|
+
engine :None
|
8
9
|
|
9
10
|
def is_post() request.post?.to_s end
|
10
11
|
def is_get() request.get?.to_s end
|
@@ -23,7 +24,7 @@ class TCRequestController < Ramaze::Controller
|
|
23
24
|
# referencing request.rack_params breaks this test
|
24
25
|
# request.params is hacked to return {} on PUT requests
|
25
26
|
request.params
|
26
|
-
request.body.read
|
27
|
+
request.body.read
|
27
28
|
end
|
28
29
|
|
29
30
|
def get_inspect
|
@@ -49,11 +50,15 @@ class TCRequestController < Ramaze::Controller
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
53
|
+
options = ramaze_options rescue {}
|
54
|
+
ramaze options.merge(:public_root => 'spec/ramaze/public')
|
55
|
+
|
52
56
|
describe "Request" do
|
53
|
-
|
54
|
-
ramaze options.merge(:public_root => 'spec/ramaze/public')
|
57
|
+
behaves_like 'http'
|
55
58
|
|
56
59
|
describe "POST" do
|
60
|
+
behaves_like 'http'
|
61
|
+
|
57
62
|
it "give me the result of request.post?" do
|
58
63
|
post("/is_post").body.should == 'true'
|
59
64
|
end
|
@@ -69,25 +74,35 @@ describe "Request" do
|
|
69
74
|
end
|
70
75
|
|
71
76
|
describe "PUT" do
|
77
|
+
behaves_like 'http'
|
78
|
+
|
72
79
|
it "put a resource" do
|
73
80
|
image = 'favicon.ico'
|
74
81
|
image_path = File.join('spec', 'ramaze', 'public', image)
|
75
82
|
address = "/put_inspect/#{image}"
|
76
83
|
|
77
|
-
|
84
|
+
if RUBY_VERSION >= '1.9.0'
|
85
|
+
file = File.open(image_path, 'r:ASCII'){|f| f.read}
|
86
|
+
else
|
87
|
+
file = File.read(image_path)
|
88
|
+
end
|
78
89
|
|
79
90
|
response = put(address, :input => file)
|
80
|
-
response.body
|
91
|
+
response.body.dump.should == file.dump
|
81
92
|
end
|
82
93
|
end
|
83
94
|
|
84
95
|
describe "DELETE" do
|
96
|
+
behaves_like 'http'
|
97
|
+
|
85
98
|
it "delete a resource" do
|
86
99
|
delete('/is_delete').body.should == 'true'
|
87
100
|
end
|
88
101
|
end
|
89
102
|
|
90
103
|
describe "GET" do
|
104
|
+
behaves_like 'http'
|
105
|
+
|
91
106
|
it "give me the result of request.post?" do
|
92
107
|
get("/is_post").body.should == 'false'
|
93
108
|
end
|
@@ -113,9 +128,15 @@ describe "Request" do
|
|
113
128
|
end
|
114
129
|
|
115
130
|
describe "get files" do
|
131
|
+
behaves_like 'http'
|
132
|
+
|
116
133
|
it "binary" do
|
117
134
|
image_path = '/favicon.ico'
|
118
|
-
|
135
|
+
if RUBY_VERSION >= '1.9.0'
|
136
|
+
static_image = File.open("spec/ramaze/public#{image_path}", 'r:ASCII'){|f| f.read}
|
137
|
+
else
|
138
|
+
static_image = File.read("spec/ramaze/public#{image_path}")
|
139
|
+
end
|
119
140
|
|
120
141
|
response = get(image_path)
|
121
142
|
response.status.should == 200
|
data/spec/ramaze/session.rb
CHANGED
@@ -28,6 +28,7 @@ class TCSessionController < Ramaze::Controller
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "Session" do
|
31
|
+
behaves_like 'http', 'browser'
|
31
32
|
ramaze(:adapter => :webrick, :mapping => {'/' => TCSessionController})
|
32
33
|
|
33
34
|
{ :MemoryCache => :memory,
|
@@ -41,7 +42,7 @@ describe "Session" do
|
|
41
42
|
next
|
42
43
|
end
|
43
44
|
|
44
|
-
|
45
|
+
describe cache.to_s do
|
45
46
|
|
46
47
|
Ramaze::Global.cache = cache
|
47
48
|
Thread.main[:session_cache] = nil
|
@@ -4,36 +4,39 @@
|
|
4
4
|
require 'spec/helper'
|
5
5
|
require 'ramaze/store/default'
|
6
6
|
|
7
|
-
describe "
|
7
|
+
describe "Store::Default" do
|
8
8
|
db = 'db.yaml'
|
9
9
|
|
10
|
+
after do
|
11
|
+
FileUtils.rm db
|
12
|
+
end
|
13
|
+
|
10
14
|
def add hash = {}
|
11
15
|
Books.merge!(hash)
|
12
16
|
end
|
13
17
|
|
14
|
-
it "Store::Default
|
18
|
+
it "should initialize Store::Default" do
|
15
19
|
Books = Ramaze::Store::Default.new(db)
|
16
20
|
Books.db.should.is_a?(YAML::Store)
|
17
21
|
end
|
18
22
|
|
19
|
-
it "store and retrieve
|
23
|
+
it "should store and retrieve key/value" do
|
20
24
|
add 'Pickaxe' => 'good book'
|
21
25
|
Books['Pickaxe'].should == 'good book'
|
22
26
|
end
|
23
27
|
|
24
|
-
it "empty
|
28
|
+
it "be empty after #clear" do
|
25
29
|
add 'Pickaxe' => 'good book'
|
26
30
|
|
27
|
-
Books.empty
|
31
|
+
Books.should.not.be.empty
|
28
32
|
Books.clear
|
29
|
-
Books.empty
|
33
|
+
Books.should.be.empty
|
30
34
|
end
|
31
35
|
|
32
|
-
it "size" do
|
36
|
+
it "should have right size" do
|
33
37
|
Books.size.should == 0
|
34
38
|
|
35
|
-
{
|
36
|
-
'Pickaxe' => 'good book',
|
39
|
+
{ 'Pickaxe' => 'good book',
|
37
40
|
'1984' => 'scary',
|
38
41
|
'Brave new World' => 'interesting',
|
39
42
|
}.each_with_index do |(title, content), i|
|
@@ -42,7 +45,7 @@ describe "initialize an Store" do
|
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
45
|
-
it "Enumerable" do
|
48
|
+
it "should be Enumerable" do
|
46
49
|
add 'Pickaxe' => 'good book', '1984' => 'scary'
|
47
50
|
|
48
51
|
Books.each do |title, content|
|
@@ -51,24 +54,18 @@ describe "initialize an Store" do
|
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
|
-
it "merge and merge!" do
|
57
|
+
it "should merge and merge!" do
|
55
58
|
books = {'Pickaxe' => 'good book', '1984' => 'scary'}
|
56
59
|
add books
|
57
60
|
|
58
61
|
bnw = {'Brave new World' => 'interesting'}
|
59
62
|
|
60
63
|
Books.merge(bnw).should == books.merge(bnw)
|
61
|
-
|
62
64
|
Books[bnw.keys.first].should == nil
|
63
65
|
|
64
66
|
Books.merge!(bnw).should == books.merge(bnw)
|
65
|
-
|
66
67
|
Books[bnw.keys.first].should == bnw.values.first
|
67
68
|
|
68
69
|
Books.size.should == 3
|
69
70
|
end
|
70
|
-
|
71
|
-
after(:each) do
|
72
|
-
FileUtils.rm db
|
73
|
-
end
|
74
71
|
end
|