ramaze 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +14 -259
- data/bin/ramaze +52 -25
- data/doc/AUTHORS +6 -0
- data/doc/CHANGELOG +1363 -42
- data/doc/INSTALL +1 -1
- data/doc/README +48 -35
- data/doc/README.html +637 -0
- data/doc/TODO +7 -16
- data/doc/allison/allison.css +6 -7
- data/doc/allison/allison.gif +0 -0
- data/doc/allison/cache/STYLE +1 -2
- data/doc/changes.txt +3375 -0
- data/doc/changes.xml +3378 -0
- data/doc/meta/announcement.txt +47 -0
- data/doc/meta/configuration.txt +179 -0
- data/doc/meta/internals.txt +111 -0
- data/doc/readme_chunks/features.txt +8 -16
- data/doc/readme_chunks/installing.txt +7 -1
- data/doc/tutorial/todolist.txt +2 -3
- data/examples/blog/main.rb +9 -8
- data/examples/blog/public/styles/blog.css +132 -0
- data/examples/blog/src/controller.rb +14 -41
- data/examples/blog/src/model.rb +12 -13
- data/examples/blog/src/view.rb +16 -0
- data/examples/blog/template/edit.xhtml +19 -8
- data/examples/blog/template/index.xhtml +14 -22
- data/examples/blog/template/new.xhtml +18 -5
- data/examples/caching.rb +5 -8
- data/examples/element.rb +3 -3
- data/examples/hello.rb +3 -5
- data/examples/simple.rb +4 -7
- data/examples/templates/template/external.haml +8 -7
- data/examples/templates/template/external.mab +11 -8
- data/examples/templates/template_amrita2.rb +4 -4
- data/examples/templates/template_erubis.rb +3 -3
- data/examples/templates/template_ezamar.rb +1 -2
- data/examples/templates/template_haml.rb +24 -23
- data/examples/templates/template_liquid.rb +3 -1
- data/examples/templates/template_markaby.rb +15 -9
- data/examples/todolist/src/element/page.rb +1 -1
- data/lib/proto/conf/benchmark.yaml +6 -20
- data/lib/proto/conf/debug.yaml +6 -19
- data/lib/proto/conf/live.yaml +7 -19
- data/lib/proto/conf/silent.yaml +6 -16
- data/lib/proto/conf/stage.yaml +6 -18
- data/lib/proto/public/error.zmr +2 -2
- data/lib/ramaze.rb +34 -72
- data/lib/ramaze/adapter.rb +21 -18
- data/lib/ramaze/adapter/mongrel.rb +0 -3
- data/lib/ramaze/adapter/webrick.rb +6 -6
- data/lib/ramaze/cache/memcached.rb +3 -0
- data/lib/ramaze/controller.rb +227 -183
- data/lib/ramaze/dispatcher.rb +34 -129
- data/lib/ramaze/dispatcher/action.rb +28 -0
- data/lib/ramaze/dispatcher/error.rb +43 -0
- data/lib/ramaze/dispatcher/file.rb +34 -0
- data/lib/ramaze/global.rb +89 -48
- data/lib/ramaze/helper/aspect.rb +8 -6
- data/lib/ramaze/helper/auth.rb +3 -3
- data/lib/ramaze/helper/cache.rb +2 -2
- data/lib/ramaze/helper/file.rb +14 -0
- data/lib/ramaze/helper/inform.rb +36 -0
- data/lib/ramaze/helper/link.rb +7 -3
- data/lib/ramaze/helper/markaby.rb +30 -0
- data/lib/ramaze/helper/redirect.rb +2 -0
- data/lib/ramaze/inform.rb +8 -182
- data/lib/ramaze/inform/analogger.rb +19 -0
- data/lib/ramaze/inform/growl.rb +28 -0
- data/lib/ramaze/inform/hub.rb +26 -0
- data/lib/ramaze/inform/informer.rb +92 -0
- data/lib/ramaze/inform/informing.rb +44 -0
- data/lib/ramaze/inform/syslog.rb +27 -0
- data/lib/ramaze/inform/xosd.rb +42 -0
- data/lib/ramaze/snippets.rb +6 -2
- data/lib/ramaze/snippets/object/traits.rb +13 -1
- data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
- data/lib/ramaze/snippets/string/color.rb +27 -0
- data/lib/ramaze/snippets/string/each.rb +6 -0
- data/lib/ramaze/snippets/struct/fill.rb +15 -0
- data/lib/ramaze/template/ezamar.rb +13 -22
- data/lib/ramaze/template/ezamar/element.rb +12 -12
- data/lib/ramaze/template/liquid.rb +19 -18
- data/lib/ramaze/template/markaby.rb +37 -58
- data/lib/ramaze/tool/localize.rb +128 -0
- data/lib/ramaze/tool/tidy.rb +51 -21
- data/lib/ramaze/trinity.rb +3 -3
- data/lib/ramaze/trinity/request.rb +41 -23
- data/lib/ramaze/trinity/response.rb +10 -5
- data/lib/ramaze/trinity/session.rb +17 -3
- data/lib/ramaze/version.rb +2 -2
- data/rake_tasks/conf.rake +56 -0
- data/rake_tasks/gem.rake +44 -0
- data/rake_tasks/maintaince.rake +187 -0
- data/spec/all.rb +32 -0
- data/spec/examples/caching.rb +19 -0
- data/spec/examples/element.rb +15 -0
- data/spec/examples/hello.rb +11 -0
- data/spec/examples/simple.rb +51 -0
- data/spec/examples/templates/template_amrita2.rb +14 -0
- data/spec/examples/templates/template_erubis.rb +21 -0
- data/spec/examples/templates/template_ezamar.rb +22 -0
- data/spec/examples/templates/template_haml.rb +23 -0
- data/spec/examples/templates/template_liquid.rb +24 -0
- data/spec/examples/templates/template_markaby.rb +21 -0
- data/spec/helper.rb +81 -0
- data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
- data/spec/helper/layout.rb +55 -0
- data/spec/helper/mock_http.rb +66 -0
- data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
- data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
- data/spec/helper/wrap.rb +193 -0
- data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
- data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
- data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
- data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
- data/spec/ramaze/conf/locale_de.yaml +6 -0
- data/spec/ramaze/conf/locale_en.yaml +6 -0
- data/spec/ramaze/controller.rb +184 -0
- data/spec/ramaze/controller/template/greet.xhtml +1 -0
- data/spec/ramaze/controller/template_resolving.rb +54 -0
- data/spec/ramaze/dependencies.rb +16 -0
- data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
- data/spec/ramaze/error.rb +64 -0
- data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
- data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
- data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
- data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
- data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
- data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
- data/spec/ramaze/helper/file.rb +17 -0
- data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
- data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
- data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
- data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
- data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
- data/spec/ramaze/inform/informer.rb +40 -0
- data/spec/ramaze/inform/syslog.rb +10 -0
- data/spec/ramaze/localize.rb +40 -0
- data/spec/ramaze/morpher.rb +82 -0
- data/spec/ramaze/params.rb +124 -0
- data/spec/{public → ramaze/public}/error404.xhtml +0 -0
- data/spec/{public → ramaze/public}/favicon.ico +0 -0
- data/spec/{public → ramaze/public}/ramaze.png +0 -0
- data/spec/{public → ramaze/public}/test_download.css +0 -0
- data/spec/ramaze/request.rb +129 -0
- data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
- data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
- data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
- data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
- data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
- data/spec/ramaze/template.rb +86 -0
- data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
- data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
- data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
- data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
- data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
- data/spec/ramaze/template/ezamar.rb +62 -0
- data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
- data/spec/ramaze/template/ezamar/nested.zmr +1 -0
- data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
- data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
- data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
- data/spec/{template → ramaze/template}/haml/index.haml +0 -0
- data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
- data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
- data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
- data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
- data/spec/ramaze/template/markaby.rb +59 -0
- data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
- data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
- data/spec/ramaze/template/ramaze/external.test +1 -0
- data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
- metadata +145 -81
- data/examples/blog/public/screen.css +0 -106
- data/examples/blog/src/element.rb +0 -58
- data/examples/blog/template/view.xhtml +0 -15
- data/examples/blog/test/tc_entry.rb +0 -18
- data/lib/proto/public/404.jpg +0 -0
- data/spec/request_tc_helper.rb +0 -135
- data/spec/spec_all.rb +0 -118
- data/spec/spec_helper.rb +0 -66
- data/spec/tc_controller.rb +0 -49
- data/spec/tc_dependencies.rb +0 -13
- data/spec/tc_error.rb +0 -43
- data/spec/tc_morpher.rb +0 -88
- data/spec/tc_params.rb +0 -125
- data/spec/tc_template_ezamar.rb +0 -64
- data/spec/tc_template_markaby.rb +0 -72
- data/spec/template/ezamar/nested.zmr +0 -1
@@ -1,9 +1,10 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
require 'spec/
|
4
|
+
require 'spec/helper'
|
5
5
|
|
6
6
|
class TCFlashHelperFirstController < Ramaze::Controller
|
7
|
+
map :/
|
7
8
|
helper :flash
|
8
9
|
|
9
10
|
def index
|
@@ -20,6 +21,7 @@ class TCFlashHelperFirstController < Ramaze::Controller
|
|
20
21
|
end
|
21
22
|
|
22
23
|
class TCFlashHelperSecondController < Ramaze::Controller
|
24
|
+
map '/second'
|
23
25
|
helper :flash
|
24
26
|
|
25
27
|
def index
|
@@ -36,6 +38,7 @@ class TCFlashHelperSecondController < Ramaze::Controller
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class TCFlashHelperThirdController < Ramaze::Controller
|
41
|
+
map '/third'
|
39
42
|
helper :flash
|
40
43
|
|
41
44
|
def index
|
@@ -44,7 +47,7 @@ class TCFlashHelperThirdController < Ramaze::Controller
|
|
44
47
|
def noop
|
45
48
|
'noop'
|
46
49
|
end
|
47
|
-
|
50
|
+
|
48
51
|
def set par
|
49
52
|
flash[:e] = par
|
50
53
|
end
|
@@ -54,15 +57,11 @@ class TCFlashHelperThirdController < Ramaze::Controller
|
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
57
|
-
|
58
|
-
ramaze :
|
59
|
-
'/' => TCFlashHelperFirstController,
|
60
|
-
'/second' => TCFlashHelperSecondController,
|
61
|
-
'/third' => TCFlashHelperThirdController
|
62
|
-
}
|
60
|
+
describe "FlashHelper" do
|
61
|
+
ramaze :adapter => :webrick
|
63
62
|
|
64
|
-
|
65
|
-
|
63
|
+
it "twice" do
|
64
|
+
browser '/' do
|
66
65
|
get('/first_here')
|
67
66
|
get('/then_here').should == 'hey'
|
68
67
|
get('/then_here').should == ''
|
@@ -73,8 +72,8 @@ context "FlashHelper" do
|
|
73
72
|
end
|
74
73
|
end
|
75
74
|
|
76
|
-
|
77
|
-
|
75
|
+
it "over seperate controllers" do
|
76
|
+
browser do
|
78
77
|
get('/first_here')
|
79
78
|
get('/second/then_here').should == 'hey'
|
80
79
|
get('/then_here').should == ''
|
@@ -85,14 +84,14 @@ context "FlashHelper" do
|
|
85
84
|
end
|
86
85
|
end
|
87
86
|
|
88
|
-
|
89
|
-
|
87
|
+
it "single" do
|
88
|
+
browser do
|
90
89
|
get('/third/set/foo').should == 'foo'
|
91
90
|
end
|
92
91
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
92
|
+
|
93
|
+
it "single" do
|
94
|
+
browser do
|
96
95
|
get('/third/set/foo').should == 'foo'
|
97
96
|
get('/third/retrieve').should == 'foo'
|
98
97
|
get('/third/retrieve').should == ''
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
require 'spec/
|
4
|
+
require 'spec/helper'
|
5
5
|
|
6
6
|
testcase_requires 'og', 'glue/timestamped'
|
7
7
|
|
@@ -21,8 +21,7 @@ end
|
|
21
21
|
# catches all the stuff Og sends to Logger,
|
22
22
|
# i wished on could mute it otherwise
|
23
23
|
|
24
|
-
|
25
|
-
Logger.send(:class_variable_set, "@@global_logger", gulp_class.new)
|
24
|
+
Logger.send(:class_variable_set, "@@global_logger", Ramaze::Informer.new)
|
26
25
|
|
27
26
|
Og.start :destroy => true
|
28
27
|
|
@@ -78,61 +77,61 @@ class TCFormHelperEntryDatedController < Ramaze::Controller
|
|
78
77
|
end
|
79
78
|
end
|
80
79
|
|
81
|
-
|
82
|
-
|
80
|
+
describe "FormHelper" do
|
81
|
+
describe "Entry" do
|
83
82
|
ramaze :mapping => {'/entry' => TCFormHelperEntryController}
|
84
83
|
|
85
|
-
|
86
|
-
get('/entry/').should == 'FormHelper Entry'
|
84
|
+
it "testrun" do
|
85
|
+
get('/entry/').body.should == 'FormHelper Entry'
|
87
86
|
end
|
88
87
|
|
89
|
-
|
90
|
-
get('/entry/form_with_submit').should ==
|
88
|
+
it "with submit" do
|
89
|
+
get('/entry/form_with_submit').body.should ==
|
91
90
|
%{title: <input type="text" name="title" value="" /><br />\n<input type="submit" />}
|
92
91
|
end
|
93
92
|
|
94
|
-
|
95
|
-
get('/entry/form_without_submit').should ==
|
93
|
+
it "without submit" do
|
94
|
+
get('/entry/form_without_submit').body.should ==
|
96
95
|
%{title: <input type="text" name="title" value="" />}
|
97
96
|
end
|
98
97
|
|
99
|
-
|
100
|
-
get('/entry/form_with_title').should ==
|
98
|
+
it "with title" do
|
99
|
+
get('/entry/form_with_title').body.should ==
|
101
100
|
%{Title: <input type="text" name="title" value="" /><br />\n<input type="submit" />}
|
102
101
|
end
|
103
102
|
|
104
|
-
|
105
|
-
get('/entry/form_without_title').should ==
|
103
|
+
it "without title" do
|
104
|
+
get('/entry/form_without_title').body.should ==
|
106
105
|
%{<input type="text" name="title" value="" /><br />\n<input type="submit" />}
|
107
106
|
end
|
108
107
|
|
109
|
-
|
110
|
-
get('/entry/form_with_oid').should ==
|
108
|
+
it "with oid" do
|
109
|
+
get('/entry/form_with_oid').body.should ==
|
111
110
|
%{title: <input type="text" name="title" value="" /><br />\noid: <input type="text" name="oid" value="0" /><br />\n<input type="submit" />}
|
112
111
|
end
|
113
112
|
|
114
|
-
|
113
|
+
describe "EntryTimestamped" do
|
115
114
|
ramaze :fake_start => true, :mapping => {'/entry_timestamped' => TCFormHelperEntryTimestampedController}
|
116
115
|
|
117
|
-
|
118
|
-
get('/entry_timestamped/').should == "FormHelper EntryTimestamped"
|
116
|
+
it "testrun" do
|
117
|
+
get('/entry_timestamped/').body.should == "FormHelper EntryTimestamped"
|
119
118
|
end
|
120
119
|
|
121
|
-
|
122
|
-
get('/entry_timestamped/form_with_submit').should ==
|
120
|
+
it "with submit" do
|
121
|
+
get('/entry_timestamped/form_with_submit').body.should ==
|
123
122
|
"title: <input type=\"text\" name=\"title\" value=\"\" /><br />\n<input type=\"submit\" />"
|
124
123
|
end
|
125
124
|
end
|
126
125
|
|
127
|
-
|
126
|
+
describe "EntryDated" do
|
128
127
|
ramaze :fake_start => true, :mapping => {'/entry_dated' => TCFormHelperEntryDatedController}
|
129
128
|
|
130
|
-
|
131
|
-
get('/entry_dated').should ==
|
129
|
+
it "testrun" do
|
130
|
+
get('/entry_dated').body.should ==
|
132
131
|
"FormHelper Dated"
|
133
132
|
end
|
134
133
|
|
135
|
-
|
134
|
+
it "with submit" do
|
136
135
|
result = get('/entry_dated/form_with_submit')
|
137
136
|
result.should =~ /date\[day\]/
|
138
137
|
result.should =~ /date\[month\]/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
require 'spec/
|
4
|
+
require 'spec/helper'
|
5
5
|
|
6
6
|
class TCLinkHelperController < Ramaze::Controller
|
7
7
|
helper :link
|
@@ -16,30 +16,30 @@ class TCLinkHelperController < Ramaze::Controller
|
|
16
16
|
end
|
17
17
|
|
18
18
|
|
19
|
-
|
19
|
+
describe "LinkHelper" do
|
20
20
|
ramaze(:mapping => {'/' => TCLinkHelperController})
|
21
21
|
|
22
22
|
include Ramaze::LinkHelper
|
23
23
|
|
24
24
|
this = TCLinkHelperController
|
25
25
|
|
26
|
-
|
27
|
-
get.should == %{<a href="/">index</a>}
|
28
|
-
get('/index_with_title').should == %{<a href="/">Foo</a>}
|
26
|
+
it "testrun" do
|
27
|
+
get('/').body.should == %{<a href="/">index</a>}
|
28
|
+
get('/index_with_title').body.should == %{<a href="/">Foo</a>}
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
it "link" do
|
32
32
|
link(:foo).should == %{<a href="foo">foo</a>}
|
33
33
|
link(:foo, :bar).should == %{<a href="foo/bar">bar</a>}
|
34
34
|
link(this, :bar).should == %{<a href="/bar">bar</a>}
|
35
35
|
link('/foo/bar').should == %{<a href="/foo/bar">bar</a>}
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
it "link with title" do
|
39
39
|
link(:foo, :title => 'bar').should == %{<a href="foo">bar</a>}
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
it "link with get-parameters" do
|
43
43
|
link(:foo, :first => :bar, :title => 'bar').should == %{<a href="foo?first=bar">bar</a>}
|
44
44
|
l = link(:foo, :first => :bar, :second => :foobar)
|
45
45
|
m = l.match(%r{<a href="foo\?(.*?)=(.*?);(.*?)=(.*?)">(.*?)</a>}).to_a
|
@@ -48,7 +48,7 @@ context "LinkHelper" do
|
|
48
48
|
Hash[*m].should == {'first' => 'bar', 'second' => 'foobar'}
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
it "R" do
|
52
52
|
R(this).should == '/'
|
53
53
|
R(this, :foo).should == '/foo'
|
54
54
|
R(this, :foo, :bar => :one).should == '/foo?bar=one'
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
require 'spec/
|
4
|
+
require 'spec/helper'
|
5
5
|
|
6
6
|
class TCRedirectHelperController < Ramaze::Controller
|
7
|
+
map :/
|
7
8
|
helper :redirect
|
8
9
|
|
9
10
|
def index
|
@@ -37,17 +38,17 @@ class TCRedirectHelperController < Ramaze::Controller
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
40
|
-
|
41
|
-
ramaze(:
|
41
|
+
describe "RedirectHelper" do
|
42
|
+
ramaze(:adapter => :webrick)
|
42
43
|
|
43
|
-
|
44
|
+
b = Browser.new
|
44
45
|
|
45
|
-
|
46
|
-
|
46
|
+
it "testrun" do
|
47
|
+
b.get('/').should == "TCRedirectHelperController"
|
47
48
|
end
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
it "calls" do
|
51
|
+
b.story do
|
51
52
|
get('/redirection').should == "TCRedirectHelperController"
|
52
53
|
get('/double_redirection').should == "TCRedirectHelperController"
|
53
54
|
get('/no_actual_redirect').should == 'foo'
|
@@ -55,8 +56,8 @@ context "RedirectHelper" do
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
58
|
-
|
59
|
-
|
59
|
+
it "redirect to referer" do
|
60
|
+
b.story do
|
60
61
|
get('/').should == 'TCRedirectHelperController'
|
61
62
|
get('/redirect_referer_action').should == 'TCRedirectHelperController'
|
62
63
|
get('/noop').should == 'noop'
|
@@ -1,9 +1,10 @@
|
|
1
1
|
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
3
3
|
|
4
|
-
require 'spec/
|
4
|
+
require 'spec/helper'
|
5
5
|
|
6
6
|
class TCStackHelperController < Ramaze::Controller
|
7
|
+
map :/
|
7
8
|
helper :stack, :aspect
|
8
9
|
|
9
10
|
def index
|
@@ -40,30 +41,28 @@ class TCStackHelperController < Ramaze::Controller
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
|
44
|
-
ramaze(:
|
44
|
+
describe "StackHelper" do
|
45
|
+
ramaze(:adapter => :webrick)
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
Context.new do
|
47
|
+
it "conventional login" do
|
48
|
+
browser do
|
49
49
|
get('/secure').should == 'please login'
|
50
50
|
get('/login')
|
51
51
|
get('/secure').should == 'secret content'
|
52
52
|
get('/logout')
|
53
53
|
end
|
54
|
-
=end
|
55
54
|
end
|
56
55
|
|
57
|
-
|
58
|
-
|
56
|
+
it "indirect login" do
|
57
|
+
browser do
|
59
58
|
get('/foo').should == 'logged in'
|
60
59
|
get('/foo').should == 'logged in'
|
61
60
|
eget('/').should == {:logged_in => true, :STACK => []}
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
65
|
-
|
66
|
-
|
64
|
+
it "indirect login with params" do
|
65
|
+
browser do
|
67
66
|
eget('/bar', 'x' => 'y').should == {'x' => 'y'}
|
68
67
|
eget('/').should == {:logged_in => true, :STACK => []}
|
69
68
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec/helper'
|
2
|
+
|
3
|
+
describe 'Informer' do
|
4
|
+
before(:each) do
|
5
|
+
@out = []
|
6
|
+
def @out.puts(*args) push(*args) end
|
7
|
+
@inform = Ramaze::Informer.new(@out)
|
8
|
+
@inform.colorize = false
|
9
|
+
end
|
10
|
+
|
11
|
+
def format(tag, string)
|
12
|
+
"[#{@inform.timestamp}] #{tag.to_s.upcase.ljust(5)} #{string}"
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'info' do
|
16
|
+
@inform.info('Some Info')
|
17
|
+
@out.first.should == format(:info, 'Some Info')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'debug' do
|
21
|
+
arr = [:some, :stuff]
|
22
|
+
@inform.debug(arr)
|
23
|
+
@out.first.should == format(:debug, arr.inspect)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'warn' do
|
27
|
+
@inform.warn('More things')
|
28
|
+
@out.first.should == format(:warn, 'More things')
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'error' do
|
32
|
+
begin
|
33
|
+
raise('Stuff')
|
34
|
+
rescue => ex
|
35
|
+
end
|
36
|
+
|
37
|
+
@inform.error(ex)
|
38
|
+
@out.first.should == format(:error, ex.inspect)
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'spec/helper'
|
5
|
+
|
6
|
+
testcase_requires 'ya2yaml', 'ramaze/tool/localize'
|
7
|
+
|
8
|
+
Ramaze::Tool::Localize.trait :enable => true,
|
9
|
+
:file => 'spec/ramaze/conf/locale_%s.yaml'.freeze,
|
10
|
+
:languages => %w[en de]
|
11
|
+
|
12
|
+
Ramaze::Dispatcher::Action.trait[:filter] << Ramaze::Tool::Localize
|
13
|
+
|
14
|
+
class TCLocalize < Ramaze::Controller
|
15
|
+
trait :map => '/'
|
16
|
+
|
17
|
+
def hello lang = 'en'
|
18
|
+
session[:LOCALE] = lang
|
19
|
+
'[[hello]]'
|
20
|
+
end
|
21
|
+
|
22
|
+
def advanced lang = 'en'
|
23
|
+
session[:LOCALE] = lang
|
24
|
+
'[[this]] [[is]] [[a]] [[test]]'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "Localize" do
|
29
|
+
ramaze
|
30
|
+
|
31
|
+
it "hello world" do
|
32
|
+
get('/hello').body.should == 'Hello, World!'
|
33
|
+
get('/hello/de').body.should == 'Hallo, Welt!'
|
34
|
+
end
|
35
|
+
|
36
|
+
it "advanced" do
|
37
|
+
get('/advanced').body.should == 'this is a test'
|
38
|
+
get('/advanced/de').body.should == 'Das ist ein Test'
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
|
2
|
+
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
+
|
4
|
+
require 'spec/helper'
|
5
|
+
|
6
|
+
testcase_requires 'hpricot'
|
7
|
+
|
8
|
+
class TCMorpherController < Ramaze::Controller
|
9
|
+
def index
|
10
|
+
self.class.name
|
11
|
+
end
|
12
|
+
|
13
|
+
def simple_if(arg = nil)
|
14
|
+
@arg = arg
|
15
|
+
%q{
|
16
|
+
<p if="@arg.nil?">orig</p>
|
17
|
+
<p if="@arg">#{@arg}</p>
|
18
|
+
}.strip
|
19
|
+
end
|
20
|
+
|
21
|
+
def simple_unless(arg = nil)
|
22
|
+
@arg = arg
|
23
|
+
%q{
|
24
|
+
<p unless="@arg">orig</p>
|
25
|
+
<p unless="@arg.nil?">#{@arg}</p>
|
26
|
+
}.strip
|
27
|
+
end
|
28
|
+
|
29
|
+
def simple_for n = 1
|
30
|
+
@n = (0..n.to_i)
|
31
|
+
%q{
|
32
|
+
<div for="i in @n">#{i}</div>
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def simple_times n = 1
|
37
|
+
@n = n.to_i
|
38
|
+
%q{
|
39
|
+
<div times="@n">#{_t}</div>
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def simple_each *elem
|
44
|
+
@elem = elem
|
45
|
+
%q{
|
46
|
+
<div each="@elem">#{_e}</div>
|
47
|
+
}
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "Morpher" do
|
52
|
+
ramaze :mapping => {'/' => TCMorpherController}
|
53
|
+
|
54
|
+
it "testrun" do
|
55
|
+
get('/').body.should == 'TCMorpherController'
|
56
|
+
end
|
57
|
+
|
58
|
+
it "if" do
|
59
|
+
get('/simple_if').body.should == '<p>orig</p>'
|
60
|
+
get('/simple_if/bar').body.should == '<p>bar</p>'
|
61
|
+
end
|
62
|
+
|
63
|
+
it "unless" do
|
64
|
+
get('/simple_unless').body.should == '<p>orig</p>'
|
65
|
+
get('/simple_unless/bar').body.should == '<p>bar</p>'
|
66
|
+
end
|
67
|
+
|
68
|
+
it "for" do
|
69
|
+
get('/simple_for').body.should == "<div>0</div><div>1</div>"
|
70
|
+
get('/simple_for/3').body.should == "<div>0</div><div>1</div><div>2</div><div>3</div>"
|
71
|
+
end
|
72
|
+
|
73
|
+
it "times" do
|
74
|
+
get('/simple_times').body.should == "<div>0</div>"
|
75
|
+
get('/simple_times/3').body.should == "<div>0</div><div>1</div><div>2</div>"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "each" do
|
79
|
+
get('/simple_each').body.should == ''
|
80
|
+
get('/simple_each/1/2/3').body.should == "<div>1</div><div>2</div><div>3</div>"
|
81
|
+
end
|
82
|
+
end
|