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
@@ -0,0 +1,124 @@
|
|
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
|
+
class TCParamsController < Ramaze::Controller
|
7
|
+
def index
|
8
|
+
"index"
|
9
|
+
end
|
10
|
+
|
11
|
+
def no_params
|
12
|
+
"no params"
|
13
|
+
end
|
14
|
+
|
15
|
+
def single_param param
|
16
|
+
"single param (#{param})"
|
17
|
+
end
|
18
|
+
|
19
|
+
def double_param param1, param2
|
20
|
+
"double param (#{param1}, #{param2})"
|
21
|
+
end
|
22
|
+
|
23
|
+
def all_params *params
|
24
|
+
"all params (#{params.join(', ')})"
|
25
|
+
end
|
26
|
+
|
27
|
+
def at_least_one param, *params
|
28
|
+
"at least one (#{param}, #{params.join(', ')})"
|
29
|
+
end
|
30
|
+
|
31
|
+
def one_default param = 'default'
|
32
|
+
"one_default (#{param})"
|
33
|
+
end
|
34
|
+
|
35
|
+
def cat1__cat11
|
36
|
+
'cat1: cat11'
|
37
|
+
end
|
38
|
+
|
39
|
+
def cat1__cat11__cat111
|
40
|
+
'cat1: cat11: cat111'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class TCParamsController2 < Ramaze::Controller
|
45
|
+
def add(one, two = nil, three = nil)
|
46
|
+
"#{one}:#{two}:#{three}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "Simple Parameters" do
|
51
|
+
ramaze(
|
52
|
+
:mapping => {
|
53
|
+
'/' => TCParamsController,
|
54
|
+
'/jo' => TCParamsController2
|
55
|
+
}
|
56
|
+
)
|
57
|
+
|
58
|
+
it "Should respond to no parameters given" do
|
59
|
+
get('/no_params').body.should == "no params"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "Should respond to only / with the index" do
|
63
|
+
get('/').body.should == "index"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "call /bar though index doesn't take params" do
|
67
|
+
get('/bar').status.should == 404
|
68
|
+
end
|
69
|
+
|
70
|
+
it "action that takes a single param" do
|
71
|
+
get('/single_param/foo').body.should == "single param (foo)"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "action that takes two params" do
|
75
|
+
get('/double_param/foo/bar').body.should == "double param (foo, bar)"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "action that takes two params but we give only one" do
|
79
|
+
get('/double_param/foo').status.should == 404
|
80
|
+
end
|
81
|
+
|
82
|
+
it "action that takes all params" do
|
83
|
+
get('/all_params/foo/bar/foobar').body.should == "all params (foo, bar, foobar)"
|
84
|
+
end
|
85
|
+
|
86
|
+
it "action that takes all params but needs at least one" do
|
87
|
+
get('/at_least_one/foo/bar/foobar').body.should == "at least one (foo, bar, foobar)"
|
88
|
+
end
|
89
|
+
|
90
|
+
it "action that takes all params but needs at least one (not given here)" do
|
91
|
+
get('/at_least_one').status.should == 500
|
92
|
+
end
|
93
|
+
|
94
|
+
it "one default" do
|
95
|
+
get('/one_default').body.should == "one_default (default)"
|
96
|
+
end
|
97
|
+
|
98
|
+
it "one default" do
|
99
|
+
get('/one_default/my_default').body.should == "one_default (my_default)"
|
100
|
+
end
|
101
|
+
|
102
|
+
it "double underscore lookup" do
|
103
|
+
get('/cat1/cat11').body.should == 'cat1: cat11'
|
104
|
+
end
|
105
|
+
|
106
|
+
it "double double underscore lookup" do
|
107
|
+
get('/cat1/cat11/cat111').body.should == 'cat1: cat11: cat111'
|
108
|
+
end
|
109
|
+
|
110
|
+
|
111
|
+
it "jo/add should raise with 0 parameters" do
|
112
|
+
get('/jo/add').status.should == 500
|
113
|
+
end
|
114
|
+
|
115
|
+
it "add should raise with 4 parameters" do
|
116
|
+
get('/jo/add/1/2/3/4').status.should == 500
|
117
|
+
end
|
118
|
+
|
119
|
+
it "add should not raise with 1-3 parameters" do
|
120
|
+
get('/jo/add/1').body.should == '1::'
|
121
|
+
get('/jo/add/1/2').body.should == '1:2:'
|
122
|
+
get('/jo/add/1/2/3').body.should == '1:2:3'
|
123
|
+
end
|
124
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,129 @@
|
|
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
|
+
class TCRequestController < Ramaze::Controller
|
7
|
+
map '/'
|
8
|
+
|
9
|
+
trait :public => 'spec/ramaze/public'
|
10
|
+
|
11
|
+
def is_post() request.post?.to_s end
|
12
|
+
def is_get() request.get?.to_s end
|
13
|
+
def is_put() request.put?.to_s end
|
14
|
+
def is_delete() request.delete?.to_s end
|
15
|
+
|
16
|
+
def request_inspect
|
17
|
+
request.params.inspect
|
18
|
+
end
|
19
|
+
|
20
|
+
def post_inspect
|
21
|
+
request.params.inspect
|
22
|
+
end
|
23
|
+
|
24
|
+
def put_inspect(file)
|
25
|
+
request.body.read.inspect
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_inspect
|
29
|
+
request.params.inspect
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_get
|
33
|
+
request['foo']
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_post
|
37
|
+
[ request['foo'],
|
38
|
+
request['bar']['1'],
|
39
|
+
request['bar']['7'],
|
40
|
+
].inspect
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_headers
|
44
|
+
end
|
45
|
+
|
46
|
+
def my_ip
|
47
|
+
request.remote_addr
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe "Request" do
|
52
|
+
options = ramaze_options rescue {}
|
53
|
+
ramaze options.merge(:mapping => {'/' => TCRequestController})
|
54
|
+
|
55
|
+
describe "POST" do
|
56
|
+
it "give me the result of request.post?" do
|
57
|
+
post("/is_post").body.should == 'true'
|
58
|
+
end
|
59
|
+
|
60
|
+
it "give me the result of request.get?" do
|
61
|
+
post("/is_get").body.should == 'false'
|
62
|
+
end
|
63
|
+
|
64
|
+
# this here has shown some odd errors... keep an eye on it.
|
65
|
+
it "give me back what i gave" do
|
66
|
+
post("/post_inspect", 'this' => 'post').body.should == {"this" => "post"}.inspect
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe "PUT" do
|
71
|
+
it "put a ressource" do
|
72
|
+
image = 'favicon.ico'
|
73
|
+
image_path = File.join('spec', 'ramaze', 'public', image)
|
74
|
+
address = "/put_inspect/#{image}"
|
75
|
+
|
76
|
+
file = File.read(image_path)
|
77
|
+
|
78
|
+
response = put(address, :input => file)
|
79
|
+
response.body[1..-2].should == file
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
describe "DELETE" do
|
84
|
+
it "delete a ressource" do
|
85
|
+
delete('/is_delete').body.should == 'true'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
describe "GET" do
|
90
|
+
it "give me the result of request.post?" do
|
91
|
+
get("/is_post").body.should == 'false'
|
92
|
+
end
|
93
|
+
|
94
|
+
it "give me the result of request.get?" do
|
95
|
+
get("/is_get").body.should == 'true'
|
96
|
+
end
|
97
|
+
|
98
|
+
it "give me back what i gave" do
|
99
|
+
params = {'one' => 'two', 'three' => 'four'}
|
100
|
+
get("/get_inspect", params).body.should == params.inspect
|
101
|
+
end
|
102
|
+
|
103
|
+
it "my ip" do
|
104
|
+
get("/my_ip").body.should == '127.0.0.1'
|
105
|
+
end
|
106
|
+
|
107
|
+
it "request[key]" do
|
108
|
+
get('/test_get', 'foo' => 'bar').body.should == 'bar'
|
109
|
+
post('/test_post', 'foo' => 'null', 'bar[1]' => 'eins', 'bar[7]' => 'sieben').body.should ==
|
110
|
+
['null', 'eins', 'sieben'].inspect
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe "get files" do
|
115
|
+
it "binary" do
|
116
|
+
image_path = '/favicon.ico'
|
117
|
+
static_image = File.read("spec/ramaze/public#{image_path}")
|
118
|
+
|
119
|
+
get(image_path).body.should == static_image
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'plain test' do
|
123
|
+
css_path = '/test_download.css'
|
124
|
+
static_css = File.read("spec/ramaze/public#{css_path}").strip
|
125
|
+
|
126
|
+
get(css_path).body.strip.should == static_css
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
@@ -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 TCSessionController < Ramaze::Controller
|
7
7
|
def index
|
@@ -19,8 +19,8 @@ class TCSessionController < Ramaze::Controller
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
ramaze(:mapping => {'/' => TCSessionController})
|
22
|
+
describe "Session" do
|
23
|
+
ramaze(:adapter => :webrick, :mapping => {'/' => TCSessionController})
|
24
24
|
|
25
25
|
{ :MemoryCache => :memory,
|
26
26
|
:YAMLStoreCache => :yaml_store,
|
@@ -38,34 +38,34 @@ context "Session" do
|
|
38
38
|
Ramaze::Global.cache = cache
|
39
39
|
Thread.main[:session_cache] = nil
|
40
40
|
|
41
|
-
|
41
|
+
b = Browser.new
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
it "Should give me an empty session" do
|
44
|
+
b.eget.should == {}
|
45
45
|
end
|
46
46
|
|
47
|
-
|
48
|
-
|
47
|
+
it "set some session-parameters" do
|
48
|
+
b.eget('/set_session/foo/bar').should == {'foo' => 'bar'}
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
it "inspect session again" do
|
52
|
+
b.eget('/').should == {'foo' => 'bar'}
|
53
53
|
end
|
54
54
|
|
55
|
-
|
56
|
-
|
55
|
+
it "change the session" do
|
56
|
+
b.eget('/set_session/foo/foobar')['foo'].should == 'foobar'
|
57
57
|
end
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
it "inspect the changed session" do
|
60
|
+
b.eget('/')['foo'].should == 'foobar'
|
61
61
|
end
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
it "now a little bit with POST" do
|
64
|
+
b.epost('/post_set_session', 'x' => 'y')['x'].should == 'y'
|
65
65
|
end
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
it "snooping a bit around" do
|
68
|
+
b.cookie.split('=').size.should == 3
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -1,27 +1,27 @@
|
|
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
|
require 'ramaze/store/default'
|
6
6
|
|
7
|
-
|
7
|
+
describe "initialize an Store" do
|
8
8
|
db = 'db.yaml'
|
9
9
|
|
10
10
|
def add hash = {}
|
11
11
|
Books.merge!(hash)
|
12
12
|
end
|
13
13
|
|
14
|
-
|
14
|
+
it "Store::Default.new" do
|
15
15
|
Books = Ramaze::Store::Default.new(db)
|
16
16
|
Books.db.should.is_a?(YAML::Store)
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "store and retrieve something" do
|
20
20
|
add 'Pickaxe' => 'good book'
|
21
21
|
Books['Pickaxe'].should == 'good book'
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
it "empty?" do
|
25
25
|
add 'Pickaxe' => 'good book'
|
26
26
|
|
27
27
|
Books.empty?.should == false
|
@@ -29,7 +29,7 @@ context "initialize an Store" do
|
|
29
29
|
Books.empty?.should == true
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
it "size" do
|
33
33
|
Books.size.should == 0
|
34
34
|
|
35
35
|
{
|
@@ -42,7 +42,7 @@ context "initialize an Store" do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
it "Enumerable" do
|
46
46
|
add 'Pickaxe' => 'good book', '1984' => 'scary'
|
47
47
|
|
48
48
|
Books.each do |title, content|
|
@@ -51,7 +51,7 @@ context "initialize an Store" do
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
|
54
|
+
it "merge and merge!" do
|
55
55
|
books = {'Pickaxe' => 'good book', '1984' => 'scary'}
|
56
56
|
add books
|
57
57
|
|
@@ -64,11 +64,11 @@ context "initialize an Store" do
|
|
64
64
|
Books.merge!(bnw).should == books.merge(bnw)
|
65
65
|
|
66
66
|
Books[bnw.keys.first].should == bnw.values.first
|
67
|
-
|
67
|
+
|
68
68
|
Books.size.should == 3
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
after(:each) do
|
72
72
|
FileUtils.rm db
|
73
73
|
end
|
74
74
|
end
|
@@ -1,20 +1,20 @@
|
|
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
|
require 'ramaze/store/yaml'
|
6
6
|
|
7
|
-
|
7
|
+
describe "Store::YAML" do
|
8
8
|
def new_store name
|
9
9
|
Ramaze::Store::YAML.new(name, :destroy => true)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
12
|
+
it "model" do
|
13
13
|
article_class = new_store :article
|
14
14
|
article_class.entities.should_not == nil
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
it "store and retrieve" do
|
18
18
|
article_class = new_store :article
|
19
19
|
article = article_class.new
|
20
20
|
article.title = 'the article'
|
@@ -29,18 +29,18 @@ context "Store::YAML" do
|
|
29
29
|
old_article.text.should == article.text
|
30
30
|
end
|
31
31
|
|
32
|
-
|
32
|
+
it "convenience" do
|
33
33
|
article_class = new_store :article
|
34
|
-
article_class.all.should
|
34
|
+
article_class.all.should be_empty
|
35
35
|
article = article_class.new
|
36
36
|
article.name = 'the article'
|
37
37
|
article.save
|
38
38
|
|
39
39
|
article_class.keys.should == [:a]
|
40
|
-
article_class.all.should_not
|
40
|
+
article_class.all.should_not be_empty
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
it "relations" do
|
44
44
|
article_class = new_store :article
|
45
45
|
author_class = new_store :author
|
46
46
|
|
@@ -57,7 +57,7 @@ context "Store::YAML" do
|
|
57
57
|
author.article.name.should == article.name
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
it "delete" do
|
61
61
|
article_class = new_store :article
|
62
62
|
|
63
63
|
article = article_class['foo'] = {
|