ramaze 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. data/Rakefile +14 -259
  2. data/bin/ramaze +52 -25
  3. data/doc/AUTHORS +6 -0
  4. data/doc/CHANGELOG +1363 -42
  5. data/doc/INSTALL +1 -1
  6. data/doc/README +48 -35
  7. data/doc/README.html +637 -0
  8. data/doc/TODO +7 -16
  9. data/doc/allison/allison.css +6 -7
  10. data/doc/allison/allison.gif +0 -0
  11. data/doc/allison/cache/STYLE +1 -2
  12. data/doc/changes.txt +3375 -0
  13. data/doc/changes.xml +3378 -0
  14. data/doc/meta/announcement.txt +47 -0
  15. data/doc/meta/configuration.txt +179 -0
  16. data/doc/meta/internals.txt +111 -0
  17. data/doc/readme_chunks/features.txt +8 -16
  18. data/doc/readme_chunks/installing.txt +7 -1
  19. data/doc/tutorial/todolist.txt +2 -3
  20. data/examples/blog/main.rb +9 -8
  21. data/examples/blog/public/styles/blog.css +132 -0
  22. data/examples/blog/src/controller.rb +14 -41
  23. data/examples/blog/src/model.rb +12 -13
  24. data/examples/blog/src/view.rb +16 -0
  25. data/examples/blog/template/edit.xhtml +19 -8
  26. data/examples/blog/template/index.xhtml +14 -22
  27. data/examples/blog/template/new.xhtml +18 -5
  28. data/examples/caching.rb +5 -8
  29. data/examples/element.rb +3 -3
  30. data/examples/hello.rb +3 -5
  31. data/examples/simple.rb +4 -7
  32. data/examples/templates/template/external.haml +8 -7
  33. data/examples/templates/template/external.mab +11 -8
  34. data/examples/templates/template_amrita2.rb +4 -4
  35. data/examples/templates/template_erubis.rb +3 -3
  36. data/examples/templates/template_ezamar.rb +1 -2
  37. data/examples/templates/template_haml.rb +24 -23
  38. data/examples/templates/template_liquid.rb +3 -1
  39. data/examples/templates/template_markaby.rb +15 -9
  40. data/examples/todolist/src/element/page.rb +1 -1
  41. data/lib/proto/conf/benchmark.yaml +6 -20
  42. data/lib/proto/conf/debug.yaml +6 -19
  43. data/lib/proto/conf/live.yaml +7 -19
  44. data/lib/proto/conf/silent.yaml +6 -16
  45. data/lib/proto/conf/stage.yaml +6 -18
  46. data/lib/proto/public/error.zmr +2 -2
  47. data/lib/ramaze.rb +34 -72
  48. data/lib/ramaze/adapter.rb +21 -18
  49. data/lib/ramaze/adapter/mongrel.rb +0 -3
  50. data/lib/ramaze/adapter/webrick.rb +6 -6
  51. data/lib/ramaze/cache/memcached.rb +3 -0
  52. data/lib/ramaze/controller.rb +227 -183
  53. data/lib/ramaze/dispatcher.rb +34 -129
  54. data/lib/ramaze/dispatcher/action.rb +28 -0
  55. data/lib/ramaze/dispatcher/error.rb +43 -0
  56. data/lib/ramaze/dispatcher/file.rb +34 -0
  57. data/lib/ramaze/global.rb +89 -48
  58. data/lib/ramaze/helper/aspect.rb +8 -6
  59. data/lib/ramaze/helper/auth.rb +3 -3
  60. data/lib/ramaze/helper/cache.rb +2 -2
  61. data/lib/ramaze/helper/file.rb +14 -0
  62. data/lib/ramaze/helper/inform.rb +36 -0
  63. data/lib/ramaze/helper/link.rb +7 -3
  64. data/lib/ramaze/helper/markaby.rb +30 -0
  65. data/lib/ramaze/helper/redirect.rb +2 -0
  66. data/lib/ramaze/inform.rb +8 -182
  67. data/lib/ramaze/inform/analogger.rb +19 -0
  68. data/lib/ramaze/inform/growl.rb +28 -0
  69. data/lib/ramaze/inform/hub.rb +26 -0
  70. data/lib/ramaze/inform/informer.rb +92 -0
  71. data/lib/ramaze/inform/informing.rb +44 -0
  72. data/lib/ramaze/inform/syslog.rb +27 -0
  73. data/lib/ramaze/inform/xosd.rb +42 -0
  74. data/lib/ramaze/snippets.rb +6 -2
  75. data/lib/ramaze/snippets/object/traits.rb +13 -1
  76. data/lib/ramaze/snippets/ramaze/autoreload.rb +58 -2
  77. data/lib/ramaze/snippets/string/color.rb +27 -0
  78. data/lib/ramaze/snippets/string/each.rb +6 -0
  79. data/lib/ramaze/snippets/struct/fill.rb +15 -0
  80. data/lib/ramaze/template/ezamar.rb +13 -22
  81. data/lib/ramaze/template/ezamar/element.rb +12 -12
  82. data/lib/ramaze/template/liquid.rb +19 -18
  83. data/lib/ramaze/template/markaby.rb +37 -58
  84. data/lib/ramaze/tool/localize.rb +128 -0
  85. data/lib/ramaze/tool/tidy.rb +51 -21
  86. data/lib/ramaze/trinity.rb +3 -3
  87. data/lib/ramaze/trinity/request.rb +41 -23
  88. data/lib/ramaze/trinity/response.rb +10 -5
  89. data/lib/ramaze/trinity/session.rb +17 -3
  90. data/lib/ramaze/version.rb +2 -2
  91. data/rake_tasks/conf.rake +56 -0
  92. data/rake_tasks/gem.rake +44 -0
  93. data/rake_tasks/maintaince.rake +187 -0
  94. data/spec/all.rb +32 -0
  95. data/spec/examples/caching.rb +19 -0
  96. data/spec/examples/element.rb +15 -0
  97. data/spec/examples/hello.rb +11 -0
  98. data/spec/examples/simple.rb +51 -0
  99. data/spec/examples/templates/template_amrita2.rb +14 -0
  100. data/spec/examples/templates/template_erubis.rb +21 -0
  101. data/spec/examples/templates/template_ezamar.rb +22 -0
  102. data/spec/examples/templates/template_haml.rb +23 -0
  103. data/spec/examples/templates/template_liquid.rb +24 -0
  104. data/spec/examples/templates/template_markaby.rb +21 -0
  105. data/spec/helper.rb +81 -0
  106. data/spec/{spec_helper_context.rb → helper/context.rb} +1 -1
  107. data/spec/helper/layout.rb +55 -0
  108. data/spec/helper/mock_http.rb +66 -0
  109. data/spec/{spec_helper_requester.rb → helper/requester.rb} +0 -6
  110. data/spec/{spec_helper_simple_http.rb → helper/simple_http.rb} +57 -57
  111. data/spec/helper/wrap.rb +193 -0
  112. data/spec/{adapter_spec.rb → ramaze/adapter.rb} +7 -5
  113. data/spec/{tc_adapter_mongrel.rb → ramaze/adapter/mongrel.rb} +2 -2
  114. data/spec/{tc_adapter_webrick.rb → ramaze/adapter/webrick.rb} +2 -2
  115. data/spec/{tc_cache.rb → ramaze/cache.rb} +16 -16
  116. data/spec/ramaze/conf/locale_de.yaml +6 -0
  117. data/spec/ramaze/conf/locale_en.yaml +6 -0
  118. data/spec/ramaze/controller.rb +184 -0
  119. data/spec/ramaze/controller/template/greet.xhtml +1 -0
  120. data/spec/ramaze/controller/template_resolving.rb +54 -0
  121. data/spec/ramaze/dependencies.rb +16 -0
  122. data/spec/{tc_element.rb → ramaze/element.rb} +21 -19
  123. data/spec/ramaze/error.rb +64 -0
  124. data/spec/{tc_gestalt.rb → ramaze/gestalt.rb} +10 -10
  125. data/spec/{tc_global.rb → ramaze/global.rb} +7 -7
  126. data/spec/{tc_helper_aspect.rb → ramaze/helper/aspect.rb} +22 -14
  127. data/spec/{tc_helper_auth.rb → ramaze/helper/auth.rb} +9 -7
  128. data/spec/{tc_helper_cache.rb → ramaze/helper/cache.rb} +14 -24
  129. data/spec/{tc_helper_feed.rb → ramaze/helper/feed.rb} +12 -12
  130. data/spec/ramaze/helper/file.rb +17 -0
  131. data/spec/{tc_helper_flash.rb → ramaze/helper/flash.rb} +16 -17
  132. data/spec/{tc_helper_form.rb → ramaze/helper/form.rb} +25 -26
  133. data/spec/{tc_helper_link.rb → ramaze/helper/link.rb} +9 -9
  134. data/spec/{tc_helper_redirect.rb → ramaze/helper/redirect.rb} +11 -10
  135. data/spec/{tc_helper_stack.rb → ramaze/helper/stack.rb} +10 -11
  136. data/spec/ramaze/inform/informer.rb +40 -0
  137. data/spec/ramaze/inform/syslog.rb +10 -0
  138. data/spec/ramaze/localize.rb +40 -0
  139. data/spec/ramaze/morpher.rb +82 -0
  140. data/spec/ramaze/params.rb +124 -0
  141. data/spec/{public → ramaze/public}/error404.xhtml +0 -0
  142. data/spec/{public → ramaze/public}/favicon.ico +0 -0
  143. data/spec/{public → ramaze/public}/ramaze.png +0 -0
  144. data/spec/{public → ramaze/public}/test_download.css +0 -0
  145. data/spec/ramaze/request.rb +129 -0
  146. data/spec/{tc_request_mongrel.rb → ramaze/request/mongrel.rb} +2 -2
  147. data/spec/{tc_request_webrick.rb → ramaze/request/webrick.rb} +1 -1
  148. data/spec/{tc_session.rb → ramaze/session.rb} +18 -18
  149. data/spec/{tc_store.rb → ramaze/store/default.rb} +10 -10
  150. data/spec/{tc_store_yaml.rb → ramaze/store/yaml.rb} +9 -9
  151. data/spec/ramaze/template.rb +86 -0
  152. data/spec/{tc_template_amrita2.rb → ramaze/template/amrita2.rb} +5 -5
  153. data/spec/{template → ramaze/template}/amrita2/data.amrita +0 -0
  154. data/spec/{template → ramaze/template}/amrita2/index.amrita +0 -0
  155. data/spec/{template → ramaze/template}/amrita2/sum.amrita +0 -0
  156. data/spec/{tc_template_erubis.rb → ramaze/template/erubis.rb} +9 -9
  157. data/spec/{template → ramaze/template}/erubis/sum.rhtml +0 -0
  158. data/spec/ramaze/template/ezamar.rb +62 -0
  159. data/spec/{template → ramaze/template}/ezamar/another/long/action.zmr +0 -0
  160. data/spec/{template → ramaze/template}/ezamar/combined.zmr +0 -0
  161. data/spec/{template → ramaze/template}/ezamar/file_only.zmr +0 -0
  162. data/spec/{template → ramaze/template}/ezamar/index.zmr +0 -0
  163. data/spec/ramaze/template/ezamar/nested.zmr +1 -0
  164. data/spec/{template → ramaze/template}/ezamar/some__long__action.zmr +0 -0
  165. data/spec/{template → ramaze/template}/ezamar/sum.zmr +0 -0
  166. data/spec/{tc_template_haml.rb → ramaze/template/haml.rb} +7 -7
  167. data/spec/{template → ramaze/template}/haml/index.haml +0 -0
  168. data/spec/{template → ramaze/template}/haml/with_vars.haml +0 -0
  169. data/spec/{tc_template_liquid.rb → ramaze/template/liquid.rb} +7 -7
  170. data/spec/{template → ramaze/template}/liquid/index.liquid +0 -0
  171. data/spec/{template → ramaze/template}/liquid/products.liquid +0 -0
  172. data/spec/ramaze/template/markaby.rb +59 -0
  173. data/spec/{template → ramaze/template}/markaby/external.mab +0 -0
  174. data/spec/{template → ramaze/template}/markaby/sum.mab +0 -0
  175. data/spec/ramaze/template/ramaze/external.test +1 -0
  176. data/spec/{tc_tidy.rb → ramaze/tidy.rb} +3 -3
  177. metadata +145 -81
  178. data/examples/blog/public/screen.css +0 -106
  179. data/examples/blog/src/element.rb +0 -58
  180. data/examples/blog/template/view.xhtml +0 -15
  181. data/examples/blog/test/tc_entry.rb +0 -18
  182. data/lib/proto/public/404.jpg +0 -0
  183. data/spec/request_tc_helper.rb +0 -135
  184. data/spec/spec_all.rb +0 -118
  185. data/spec/spec_helper.rb +0 -66
  186. data/spec/tc_controller.rb +0 -49
  187. data/spec/tc_dependencies.rb +0 -13
  188. data/spec/tc_error.rb +0 -43
  189. data/spec/tc_morpher.rb +0 -88
  190. data/spec/tc_params.rb +0 -125
  191. data/spec/tc_template_ezamar.rb +0 -64
  192. data/spec/tc_template_markaby.rb +0 -72
  193. 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
@@ -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,4 +1,4 @@
1
- require 'spec/spec_helper'
1
+ require 'spec/helper'
2
2
 
3
3
  testcase_requires 'mongrel'
4
4
 
@@ -6,4 +6,4 @@ def ramaze_options
6
6
  { :adapter => :mongrel }
7
7
  end
8
8
 
9
- require 'spec/request_tc_helper'
9
+ require 'spec/ramaze/request'
@@ -2,4 +2,4 @@ def ramaze_options
2
2
  { :adapter => :webrick }
3
3
  end
4
4
 
5
- require 'spec/request_tc_helper'
5
+ require 'spec/ramaze/request'
@@ -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/spec_helper'
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
- context "Session" do
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
- ctx = Context.new
41
+ b = Browser.new
42
42
 
43
- specify "Should give me an empty session" do
44
- ctx.eget.should == {}
43
+ it "Should give me an empty session" do
44
+ b.eget.should == {}
45
45
  end
46
46
 
47
- specify "set some session-parameters" do
48
- ctx.eget('/set_session/foo/bar').should == {'foo' => 'bar'}
47
+ it "set some session-parameters" do
48
+ b.eget('/set_session/foo/bar').should == {'foo' => 'bar'}
49
49
  end
50
50
 
51
- specify "inspect session again" do
52
- ctx.eget('/').should == {'foo' => 'bar'}
51
+ it "inspect session again" do
52
+ b.eget('/').should == {'foo' => 'bar'}
53
53
  end
54
54
 
55
- specify "change the session" do
56
- ctx.eget('/set_session/foo/foobar')['foo'].should == 'foobar'
55
+ it "change the session" do
56
+ b.eget('/set_session/foo/foobar')['foo'].should == 'foobar'
57
57
  end
58
58
 
59
- specify "inspect the changed session" do
60
- ctx.eget('/')['foo'].should == 'foobar'
59
+ it "inspect the changed session" do
60
+ b.eget('/')['foo'].should == 'foobar'
61
61
  end
62
62
 
63
- specify "now a little bit with POST" do
64
- ctx.epost('/post_set_session', 'x' => 'y')['x'].should == 'y'
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
- specify "snooping a bit around" do
68
- ctx.cookie.split('=').size.should == 3
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/spec_helper'
4
+ require 'spec/helper'
5
5
  require 'ramaze/store/default'
6
6
 
7
- context "initialize an Store" do
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
- specify "Store::Default.new" do
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
- specify "store and retrieve something" do
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
- specify "empty?" do
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
- specify "size" do
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
- specify "Enumerable" do
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
- specify "merge and merge!" do
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
- teardown do
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/spec_helper'
4
+ require 'spec/helper'
5
5
  require 'ramaze/store/yaml'
6
6
 
7
- context "Store::YAML" do
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
- specify "model" do
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
- specify "store and retrieve" do
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
- specify "convenience" do
32
+ it "convenience" do
33
33
  article_class = new_store :article
34
- article_class.all.should.be.empty
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.be.empty
40
+ article_class.all.should_not be_empty
41
41
  end
42
42
 
43
- specify "relations" do
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
- specify "delete" do
60
+ it "delete" do
61
61
  article_class = new_store :article
62
62
 
63
63
  article = article_class['foo'] = {