ramaze 0.2.1 → 0.3.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 (304) hide show
  1. data/Rakefile +20 -3
  2. data/bin/ramaze +1 -4
  3. data/doc/AUTHORS +2 -1
  4. data/doc/CHANGELOG +539 -32
  5. data/doc/LEGAL +4 -0
  6. data/doc/meta/announcement.txt +79 -47
  7. data/examples/blog/README +2 -2
  8. data/examples/blog/spec/blog.rb +33 -48
  9. data/examples/blog/src/controller.rb +15 -13
  10. data/examples/blog/src/model.rb +28 -10
  11. data/examples/blog/start.rb +0 -10
  12. data/examples/blog/template/edit.xhtml +1 -1
  13. data/examples/blog/template/index.xhtml +2 -2
  14. data/examples/facebook.rb +152 -0
  15. data/examples/linking.rb +28 -0
  16. data/examples/ramaise.rb +4 -11
  17. data/examples/rammit/spec/rammit.rb +30 -0
  18. data/examples/rammit/src/controller/main.rb +3 -0
  19. data/examples/rammit/src/controller/page.rb +16 -0
  20. data/examples/rammit/src/model.rb +33 -0
  21. data/examples/rammit/start.rb +7 -0
  22. data/examples/rammit/template/index.xhtml +14 -0
  23. data/examples/rammit/template/page/view.xhtml +4 -0
  24. data/examples/rapaste/Rakefile +28 -0
  25. data/examples/rapaste/public/css/active4d.css +114 -0
  26. data/examples/rapaste/public/css/all_hallows_eve.css +72 -0
  27. data/examples/rapaste/public/css/amy.css +147 -0
  28. data/examples/rapaste/public/css/blackboard.css +88 -0
  29. data/examples/rapaste/public/css/brilliance_black.css +605 -0
  30. data/examples/rapaste/public/css/brilliance_dull.css +599 -0
  31. data/examples/rapaste/public/css/cobalt.css +149 -0
  32. data/examples/rapaste/public/css/dawn.css +121 -0
  33. data/examples/rapaste/public/css/display.css +179 -0
  34. data/examples/rapaste/public/css/eiffel.css +121 -0
  35. data/examples/rapaste/public/css/espresso_libre.css +109 -0
  36. data/examples/rapaste/public/css/idle.css +62 -0
  37. data/examples/rapaste/public/css/iplastic.css +80 -0
  38. data/examples/rapaste/public/css/lazy.css +73 -0
  39. data/examples/rapaste/public/css/mac_classic.css +123 -0
  40. data/examples/rapaste/public/css/magicwb_amiga.css +104 -0
  41. data/examples/rapaste/public/css/pastels_on_dark.css +188 -0
  42. data/examples/rapaste/public/css/slush_poppies.css +85 -0
  43. data/examples/rapaste/public/css/spacecadet.css +51 -0
  44. data/examples/rapaste/public/css/sunburst.css +180 -0
  45. data/examples/rapaste/public/css/twilight.css +137 -0
  46. data/examples/rapaste/public/css/zenburnesque.css +91 -0
  47. data/examples/rapaste/public/js/jquery.js +11 -0
  48. data/examples/rapaste/rapaste.sqlite +0 -0
  49. data/examples/rapaste/spec/rapaste.rb +49 -0
  50. data/examples/rapaste/src/controller.rb +69 -0
  51. data/examples/rapaste/src/model.rb +61 -0
  52. data/examples/rapaste/start.rb +20 -0
  53. data/examples/rapaste/template/copy.xhtml +10 -0
  54. data/examples/rapaste/template/index.xhtml +9 -0
  55. data/examples/rapaste/template/layout.xhtml +22 -0
  56. data/examples/rapaste/template/list.xhtml +28 -0
  57. data/examples/rapaste/template/view.xhtml +37 -0
  58. data/examples/sourceview/sourceview.rb +3 -3
  59. data/examples/templates/template_amrita2.rb +1 -3
  60. data/examples/todolist/spec/todolist.rb +15 -18
  61. data/examples/whywiki/spec/whywiki.rb +15 -20
  62. data/examples/whywiki/start.rb +0 -1
  63. data/examples/wikore/spec/wikore.rb +14 -19
  64. data/examples/wiktacular/spec/wiktacular.rb +8 -15
  65. data/lib/proto/{src/controller → controller}/main.rb +4 -4
  66. data/lib/proto/public/css/ramaze_error.css +39 -3
  67. data/lib/proto/public/js/jquery.js +2039 -1020
  68. data/lib/proto/spec/main.rb +27 -0
  69. data/lib/proto/start.rb +5 -5
  70. data/lib/proto/view/error.xhtml +62 -0
  71. data/lib/proto/view/index.xhtml +34 -0
  72. data/lib/proto/view/page.xhtml +15 -0
  73. data/lib/ramaze.rb +9 -7
  74. data/lib/ramaze/action.rb +7 -3
  75. data/lib/ramaze/action/render.rb +15 -5
  76. data/lib/ramaze/adapter.rb +5 -5
  77. data/lib/ramaze/adapter/base.rb +2 -2
  78. data/lib/ramaze/adapter/cgi.rb +1 -1
  79. data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
  80. data/lib/ramaze/adapter/fcgi.rb +2 -2
  81. data/lib/ramaze/adapter/mongrel.rb +1 -1
  82. data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
  83. data/lib/ramaze/adapter/thin.rb +25 -0
  84. data/lib/ramaze/adapter/webrick.rb +1 -1
  85. data/lib/ramaze/cache.rb +3 -2
  86. data/lib/ramaze/cache/memcached.rb +1 -1
  87. data/lib/ramaze/cache/memory.rb +1 -1
  88. data/lib/ramaze/cache/yaml_store.rb +1 -1
  89. data/lib/ramaze/contrib.rb +1 -1
  90. data/lib/ramaze/contrib/auto_params.rb +12 -5
  91. data/lib/ramaze/contrib/auto_params/get_args.rb +1 -0
  92. data/lib/ramaze/contrib/facebook.rb +23 -0
  93. data/lib/ramaze/contrib/facebook/facebook.rb +168 -0
  94. data/lib/ramaze/contrib/gettext.rb +111 -0
  95. data/lib/ramaze/contrib/gettext/mo.rb +155 -0
  96. data/lib/ramaze/contrib/gettext/po.rb +109 -0
  97. data/lib/ramaze/contrib/gzip_filter.rb +1 -1
  98. data/lib/ramaze/contrib/route.rb +15 -5
  99. data/lib/ramaze/contrib/sequel/fill.rb +1 -1
  100. data/lib/ramaze/controller.rb +10 -4
  101. data/lib/ramaze/controller/error.rb +5 -13
  102. data/lib/ramaze/controller/main.rb +2 -0
  103. data/lib/ramaze/controller/resolve.rb +18 -10
  104. data/lib/ramaze/dispatcher.rb +1 -1
  105. data/lib/ramaze/dispatcher/action.rb +1 -1
  106. data/lib/ramaze/dispatcher/directory.rb +3 -2
  107. data/lib/ramaze/dispatcher/error.rb +5 -5
  108. data/lib/ramaze/dispatcher/file.rb +13 -2
  109. data/lib/ramaze/error.rb +1 -1
  110. data/lib/ramaze/gestalt.rb +2 -2
  111. data/lib/ramaze/global.rb +5 -5
  112. data/lib/ramaze/global/dsl.rb +1 -1
  113. data/lib/ramaze/global/globalstruct.rb +11 -5
  114. data/lib/ramaze/helper.rb +1 -1
  115. data/lib/ramaze/helper/aspect.rb +1 -1
  116. data/lib/ramaze/helper/auth.rb +2 -2
  117. data/lib/ramaze/helper/cache.rb +1 -1
  118. data/lib/ramaze/helper/cgi.rb +1 -1
  119. data/lib/ramaze/helper/file.rb +1 -1
  120. data/lib/ramaze/helper/flash.rb +1 -1
  121. data/lib/ramaze/helper/formatting.rb +1 -1
  122. data/lib/ramaze/helper/identity.rb +1 -1
  123. data/lib/ramaze/helper/inform.rb +1 -1
  124. data/lib/ramaze/helper/link.rb +4 -4
  125. data/lib/ramaze/helper/markaby.rb +1 -1
  126. data/lib/ramaze/helper/nitroform.rb +1 -1
  127. data/lib/ramaze/helper/pager.rb +2 -1
  128. data/lib/ramaze/helper/partial.rb +1 -1
  129. data/lib/ramaze/helper/redirect.rb +6 -1
  130. data/lib/ramaze/helper/sequel.rb +54 -0
  131. data/lib/ramaze/helper/stack.rb +1 -1
  132. data/lib/ramaze/inform.rb +1 -1
  133. data/lib/ramaze/inform/analogger.rb +1 -1
  134. data/lib/ramaze/inform/growl.rb +1 -1
  135. data/lib/ramaze/inform/hub.rb +1 -1
  136. data/lib/ramaze/inform/informer.rb +1 -1
  137. data/lib/ramaze/inform/informing.rb +2 -2
  138. data/lib/ramaze/inform/knotify.rb +1 -1
  139. data/lib/ramaze/inform/syslog.rb +1 -1
  140. data/lib/ramaze/inform/xosd.rb +1 -1
  141. data/lib/ramaze/snippets.rb +1 -1
  142. data/lib/ramaze/snippets/array/put_within.rb +1 -1
  143. data/lib/ramaze/snippets/blankslate.rb +7 -0
  144. data/lib/ramaze/snippets/dictionary.rb +6 -1
  145. data/lib/ramaze/snippets/divide.rb +1 -1
  146. data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
  147. data/lib/ramaze/snippets/kernel/acquire.rb +39 -0
  148. data/lib/ramaze/snippets/kernel/aquire.rb +1 -34
  149. data/lib/ramaze/snippets/kernel/constant.rb +1 -1
  150. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +1 -1
  151. data/lib/ramaze/snippets/numeric/filesize_format.rb +1 -1
  152. data/lib/ramaze/snippets/object/traits.rb +1 -1
  153. data/lib/ramaze/snippets/ordered_set.rb +12 -7
  154. data/lib/ramaze/snippets/ramaze/caller_info.rb +1 -1
  155. data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
  156. data/lib/ramaze/snippets/string/camel_case.rb +1 -1
  157. data/lib/ramaze/snippets/string/color.rb +2 -4
  158. data/lib/ramaze/snippets/string/each.rb +1 -1
  159. data/lib/ramaze/snippets/string/ord.rb +15 -0
  160. data/lib/ramaze/snippets/string/snake_case.rb +1 -1
  161. data/lib/ramaze/snippets/struct/fill.rb +4 -2
  162. data/lib/ramaze/snippets/struct/values_at.rb +2 -2
  163. data/lib/ramaze/snippets/symbol/to_proc.rb +15 -8
  164. data/lib/ramaze/snippets/thread/into.rb +1 -1
  165. data/lib/ramaze/sourcereload.rb +4 -3
  166. data/lib/ramaze/spec/helper.rb +85 -32
  167. data/lib/ramaze/spec/helper/bacon.rb +7 -0
  168. data/lib/ramaze/spec/helper/browser.rb +1 -2
  169. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  170. data/lib/ramaze/spec/helper/pretty_output.rb +70 -0
  171. data/lib/ramaze/spec/helper/requester.rb +1 -1
  172. data/lib/ramaze/spec/helper/simple_http.rb +5 -4
  173. data/lib/ramaze/spec/helper/snippets.rb +6 -0
  174. data/lib/ramaze/store/default.rb +1 -1
  175. data/lib/ramaze/template.rb +1 -1
  176. data/lib/ramaze/template/amrita2.rb +6 -5
  177. data/lib/ramaze/template/erubis.rb +1 -1
  178. data/lib/ramaze/template/ezamar.rb +1 -1
  179. data/lib/ramaze/template/ezamar/element.rb +1 -1
  180. data/lib/ramaze/template/ezamar/engine.rb +1 -1
  181. data/lib/ramaze/template/ezamar/morpher.rb +1 -1
  182. data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
  183. data/lib/ramaze/template/haml.rb +1 -1
  184. data/lib/ramaze/template/liquid.rb +1 -1
  185. data/lib/ramaze/template/markaby.rb +1 -1
  186. data/lib/ramaze/template/nagoro.rb +4 -6
  187. data/lib/ramaze/template/none.rb +1 -1
  188. data/lib/ramaze/template/remarkably.rb +1 -1
  189. data/lib/ramaze/template/sass.rb +1 -1
  190. data/lib/ramaze/tool.rb +1 -1
  191. data/lib/ramaze/tool/create.rb +7 -1
  192. data/lib/ramaze/tool/localize.rb +7 -14
  193. data/lib/ramaze/tool/mime.rb +1 -1
  194. data/lib/ramaze/tool/record.rb +1 -1
  195. data/lib/ramaze/trinity.rb +1 -1
  196. data/lib/ramaze/trinity/request.rb +4 -2
  197. data/lib/ramaze/trinity/response.rb +1 -1
  198. data/lib/ramaze/trinity/session.rb +7 -1
  199. data/lib/ramaze/version.rb +3 -3
  200. data/lib/vendor/bacon.rb +317 -0
  201. data/rake_tasks/conf.rake +1 -1
  202. data/rake_tasks/maintenance.rake +7 -5
  203. data/rake_tasks/spec.rake +54 -40
  204. data/spec/contrib/auto_params.rb +21 -4
  205. data/spec/contrib/route.rb +31 -4
  206. data/spec/contrib/sequel/fill.rb +3 -4
  207. data/spec/examples/caching.rb +5 -2
  208. data/spec/examples/css.rb +5 -2
  209. data/spec/examples/element.rb +5 -4
  210. data/spec/examples/hello.rb +1 -0
  211. data/spec/examples/linking.rb +18 -0
  212. data/spec/examples/simple.rb +13 -18
  213. data/spec/examples/templates/template_amrita2.rb +3 -2
  214. data/spec/examples/templates/template_erubis.rb +3 -2
  215. data/spec/examples/templates/template_ezamar.rb +2 -1
  216. data/spec/examples/templates/template_haml.rb +3 -2
  217. data/spec/examples/templates/template_liquid.rb +3 -2
  218. data/spec/examples/templates/template_markaby.rb +3 -2
  219. data/spec/examples/templates/template_remarkably.rb +3 -2
  220. data/spec/ramaze/action/basics.rb +4 -4
  221. data/spec/ramaze/action/cache.rb +11 -13
  222. data/spec/ramaze/action/layout.rb +47 -3
  223. data/spec/ramaze/action/render.rb +3 -3
  224. data/spec/ramaze/action/template/instancevars/layout.xhtml +1 -0
  225. data/spec/ramaze/adapter.rb +7 -7
  226. data/spec/ramaze/adapter/mongrel.rb +1 -1
  227. data/spec/ramaze/adapter/record.rb +7 -7
  228. data/spec/ramaze/adapter/webrick.rb +1 -1
  229. data/spec/ramaze/cache.rb +6 -8
  230. data/spec/ramaze/controller.rb +77 -65
  231. data/spec/ramaze/controller/resolve.rb +2 -1
  232. data/spec/ramaze/controller/template_resolving.rb +3 -4
  233. data/spec/ramaze/dispatcher.rb +3 -4
  234. data/spec/ramaze/dispatcher/directory.rb +35 -35
  235. data/spec/ramaze/dispatcher/file.rb +8 -5
  236. data/spec/ramaze/element.rb +4 -4
  237. data/spec/ramaze/error.rb +13 -11
  238. data/spec/ramaze/gestalt.rb +1 -1
  239. data/spec/ramaze/helper/aspect.rb +2 -1
  240. data/spec/ramaze/helper/auth.rb +4 -2
  241. data/spec/ramaze/helper/cache.rb +10 -9
  242. data/spec/ramaze/helper/cgi.rb +2 -2
  243. data/spec/ramaze/helper/file.rb +1 -0
  244. data/spec/ramaze/helper/flash.rb +5 -4
  245. data/spec/ramaze/helper/formatting.rb +1 -1
  246. data/spec/ramaze/helper/link.rb +3 -3
  247. data/spec/ramaze/helper/pager.rb +44 -80
  248. data/spec/ramaze/helper/partial.rb +2 -3
  249. data/spec/ramaze/helper/redirect.rb +10 -1
  250. data/spec/ramaze/helper/stack.rb +4 -3
  251. data/spec/ramaze/helper/template/loop.xhtml +2 -1
  252. data/spec/ramaze/inform/informer.rb +2 -2
  253. data/spec/ramaze/inform/syslog.rb +1 -1
  254. data/spec/ramaze/localize.rb +26 -26
  255. data/spec/ramaze/morpher.rb +6 -7
  256. data/spec/ramaze/params.rb +7 -8
  257. data/spec/ramaze/request.rb +27 -6
  258. data/spec/ramaze/request/mongrel.rb +1 -1
  259. data/spec/ramaze/request/thin.rb +9 -0
  260. data/spec/ramaze/session.rb +2 -1
  261. data/spec/ramaze/store/default.rb +14 -17
  262. data/spec/ramaze/template.rb +5 -7
  263. data/spec/ramaze/template/amrita2.rb +4 -1
  264. data/spec/ramaze/template/erubis.rb +2 -1
  265. data/spec/ramaze/template/ezamar.rb +2 -3
  266. data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
  267. data/spec/ramaze/template/haml.rb +2 -1
  268. data/spec/ramaze/template/liquid.rb +4 -2
  269. data/spec/ramaze/template/markaby.rb +4 -2
  270. data/spec/ramaze/template/nagoro.rb +3 -4
  271. data/spec/ramaze/template/remarkably.rb +4 -2
  272. data/spec/ramaze/template/sass.rb +3 -2
  273. data/spec/ramaze/template/xslt.rb +4 -7
  274. data/spec/ramaze/trinity/request.rb +4 -3
  275. data/spec/ramaze/trinity/session.rb +6 -4
  276. data/spec/snippets/array/put_within.rb +3 -2
  277. data/spec/snippets/divide.rb +1 -4
  278. data/spec/snippets/kernel/__dir__.rb +1 -1
  279. data/spec/snippets/kernel/acquire.rb +71 -0
  280. data/spec/snippets/kernel/constant.rb +4 -8
  281. data/spec/snippets/numeric/filesize_format.rb +1 -1
  282. data/spec/snippets/ordered_set.rb +9 -2
  283. data/spec/snippets/ramaze/caller_info.rb +3 -3
  284. data/spec/snippets/ramaze/caller_lines.rb +3 -3
  285. data/spec/snippets/string/camel_case.rb +1 -1
  286. data/spec/snippets/string/color.rb +2 -2
  287. data/spec/snippets/string/snake_case.rb +5 -1
  288. data/spec/snippets/string/unindent.rb +1 -1
  289. data/spec/snippets/struct/fill.rb +14 -15
  290. data/spec/snippets/struct/values_at.rb +15 -10
  291. data/spec/snippets/symbol/to_proc.rb +13 -0
  292. data/spec/snippets/thread/into.rb +3 -4
  293. metadata +458 -386
  294. data/doc/README.html +0 -729
  295. data/doc/changes.txt +0 -5044
  296. data/doc/changes.xml +0 -5046
  297. data/lib/proto/public/error.zmr +0 -61
  298. data/lib/proto/src/element/page.rb +0 -17
  299. data/lib/proto/src/model.rb +0 -6
  300. data/lib/proto/template/index.xhtml +0 -15
  301. data/lib/ramaze/spec/helper/layout.rb +0 -58
  302. data/lib/ramaze/spec/helper/minimal.rb +0 -23
  303. data/lib/ramaze/spec/helper/wrap.rb +0 -198
  304. data/spec/snippets/kernel/aquire.rb +0 -71
@@ -3,6 +3,7 @@ require 'spec/helper'
3
3
  require 'examples/templates/template_ezamar'
4
4
 
5
5
  describe 'Template Ezamar' do
6
+ behaves_like 'http'
6
7
  ramaze
7
8
 
8
9
  it '/' do
@@ -13,7 +14,7 @@ describe 'Template Ezamar' do
13
14
  %w[/internal /external].each do |url|
14
15
  it url do
15
16
  html = get(url).body
16
- html.should_not == nil
17
+ html.should.not == nil
17
18
  html.should =~ %r{<title>Template::Ezamar (internal|external)</title>}
18
19
  html.should =~ %r{<h1>The (internal|external) Template for Ezamar</h1>}
19
20
  end
@@ -1,9 +1,10 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'haml'
3
+ spec_require 'haml'
4
4
  require 'examples/templates/template_haml'
5
5
 
6
6
  describe 'Template Haml' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/' do
@@ -14,7 +15,7 @@ describe 'Template Haml' do
14
15
  %w[/internal /external].each do |url|
15
16
  it url do
16
17
  html = get(url).body
17
- html.should_not == nil
18
+ html.should.not == nil
18
19
  html.should =~ %r{<title>Template::Haml (internal|external)</title>}
19
20
  html.should =~ %r{<h1>The (internal|external) Template for Haml</h1>}
20
21
  end
@@ -1,9 +1,10 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'liquid'
3
+ spec_require 'liquid'
4
4
  require 'examples/templates/template_liquid'
5
5
 
6
6
  describe 'Template Liquid' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/' do
@@ -17,7 +18,7 @@ describe 'Template Liquid' do
17
18
  response = get(url)
18
19
  response.status.should == 200
19
20
  html = response.body
20
- html.should_not == nil
21
+ html.should.not == nil
21
22
  html.should =~ %r(<title>Template::Liquid #{name}</title>)
22
23
  html.should =~ %r(<h1>The #{name} Template for Liquid</h1>)
23
24
  end
@@ -1,9 +1,10 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'markaby'
3
+ spec_require 'markaby'
4
4
  require 'examples/templates/template_markaby'
5
5
 
6
6
  describe 'Template Markaby' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/' do
@@ -14,7 +15,7 @@ describe 'Template Markaby' do
14
15
  %w[/internal /external].each do |url|
15
16
  it url do
16
17
  html = get(url).body
17
- html.should_not == nil
18
+ html.should.not == nil
18
19
  html.should =~ %r{<title>Template::Markaby (internal|external)</title>}
19
20
  html.should =~ %r{<h1>The (internal|external) Template for Markaby</h1>}
20
21
  end
@@ -1,9 +1,10 @@
1
1
  require 'spec/helper'
2
2
 
3
- testcase_requires 'remarkably/engines/html'
3
+ spec_require 'remarkably/engines/html'
4
4
  require 'examples/templates/template_remarkably'
5
5
 
6
6
  describe 'Template Remarkably' do
7
+ behaves_like 'http'
7
8
  ramaze
8
9
 
9
10
  it '/' do
@@ -14,7 +15,7 @@ describe 'Template Remarkably' do
14
15
  %w[/internal /external].each do |url|
15
16
  it url do
16
17
  html = get(url).body
17
- html.should_not == nil
18
+ html.should.not == nil
18
19
  html.should =~ %r{<title>Template::Remarkably (internal|external)</title>}
19
20
  html.should =~ %r{<h1>The (internal|external) Template for Remarkably</h1>}
20
21
  end
@@ -5,8 +5,8 @@ describe 'Action() basics' do
5
5
  action = Ramaze::Action()
6
6
 
7
7
  action.params.should == []
8
- action.method.should be_nil
9
- action.template.should be_nil
8
+ action.method.should == nil
9
+ action.template.should == nil
10
10
  end
11
11
 
12
12
  it 'should sanitize parameters' do
@@ -23,12 +23,12 @@ describe 'Action() basics' do
23
23
  # TODO: in Action.new() raise on init :controller or use a default
24
24
  hsh = Ramaze::Action(:controller=>Object).to_hash
25
25
  hsh[:method].should == nil
26
- hsh[:binding].should be_an_instance_of(Binding)
26
+ hsh[:binding].should.instance_of?(Binding)
27
27
  hsh[:controller].should == Object
28
28
  hsh[:engine].should == Ramaze::Template::Ezamar
29
29
  hsh[:params].should == []
30
30
  hsh[:path].should == nil
31
- hsh[:instance].should be_an_instance_of(Object)
31
+ hsh[:instance].should.instance_of?(Object)
32
32
  hsh[:template].should == nil
33
33
  end
34
34
 
@@ -21,25 +21,23 @@ class TCOtherCache < Ramaze::Controller
21
21
  end
22
22
 
23
23
  describe 'Action rendering' do
24
- before :all do
25
- @public_root = __DIR__ / :public
26
- FileUtils.mkdir_p @public_root
27
- ramaze :file_cache => true
28
- end
24
+ behaves_like 'http'
25
+
26
+ @public_root = __DIR__ / :public
27
+ FileUtils.mkdir_p @public_root
28
+ ramaze :file_cache => true
29
29
 
30
30
  def req(path) r = get(path); [r.content_type, r.body] end
31
31
 
32
32
  it 'should cache to file' do
33
- lambda{ req('/') }.should_not change{ req('/') }
34
- File.file?(@public_root/'index').should be_true
33
+ lambda{ req('/') }.should.not.change{ req('/') }
34
+ File.file?(@public_root/'index').should == true
35
35
  end
36
36
 
37
37
  it 'should create subdirs as needed' do
38
- lambda{ req('/other') }.should_not change{ req('/other') }
39
- File.file?(@public_root/'other'/'index').should be_true
38
+ lambda{ req('/other') }.should.not.change{ req('/other') }
39
+ File.file?(@public_root/'other'/'index').should == true
40
40
  end
41
41
 
42
- after :all do
43
- FileUtils.rm_rf @public_root
44
- end
45
- end
42
+ FileUtils.rm_rf @public_root
43
+ end
@@ -80,11 +80,46 @@ class TCActionSubLayout < Ramaze::Controller
80
80
  end
81
81
  end
82
82
 
83
- describe 'Action rendering' do
84
- before :all do
85
- ramaze
83
+ class TCReUseActionLayout < Ramaze::Controller
84
+ map '/reuse'
85
+ layout '/wrapper'
86
+
87
+ def index
88
+ 'hi'
89
+ end
90
+
91
+ def other_layout
92
+ "#@title: #@content"
93
+ end
94
+ end
95
+
96
+ class TCLayoutInstance < Ramaze::Controller
97
+ map '/reuse_instance'
98
+ layout '/reuse/other_layout'
99
+
100
+ def index
101
+ @title = 'hello'
102
+ 'world'
103
+ end
104
+ end
105
+
106
+ class TCLayoutInstanceVars < Ramaze::Controller
107
+ map '/instancevars'
108
+ layout :layout
109
+
110
+ def layout
111
+ @title = "layout"
86
112
  end
87
113
 
114
+ def test
115
+ 'test'
116
+ end
117
+ end
118
+
119
+ describe 'Action rendering' do
120
+ behaves_like 'http'
121
+ ramaze
122
+
88
123
  it 'should work with layouts' do
89
124
  get('/').body.should == "<pre>Hello, World!</pre>"
90
125
  get('/foo').body.should == "<pre>bar</pre>"
@@ -115,4 +150,13 @@ describe 'Action rendering' do
115
150
  it 'should apply relative layouts' do
116
151
  get('/sub').body.should == "<h1>SubWrapper</h1>"
117
152
  end
153
+
154
+ it 'should use instance vars defined in the layout action in external templates' do
155
+ get('/instancevars/test').body.should == 'layout: test'
156
+ end
157
+
158
+ it 'should allow re-using layouts from other controllers' do
159
+ get('/reuse').body.should == "<pre>hi</pre>"
160
+ get('/reuse_instance').body.should == "hello: world"
161
+ end
118
162
  end
@@ -16,10 +16,10 @@ class TCActionOne < Ramaze::Controller
16
16
  end
17
17
  end
18
18
 
19
+ ramaze
20
+
19
21
  describe 'Action rendering' do
20
- before :all do
21
- ramaze
22
- end
22
+ behaves_like "http"
23
23
 
24
24
  it 'should render' do
25
25
  action = Ramaze::Action(:method => :index, :controller => TCActionOne)
@@ -0,0 +1 @@
1
+ #@title: #@content
@@ -4,19 +4,19 @@
4
4
  require 'spec/helper'
5
5
 
6
6
  class TCAdapterController < Ramaze::Controller
7
+ map '/'
8
+
7
9
  def index
8
10
  "The index"
9
11
  end
10
12
  end
11
13
 
14
+ ramaze ramaze_options.merge(:spawn => 10)
15
+
12
16
  describe "Adapter" do
13
- ramaze ramaze_options.merge( :port => 7007, :spawn => 10, :mapping => {'/' => TCAdapterController} )
17
+ behaves_like "http"
14
18
 
15
- describe "multiple" do
16
- it "simple request" do
17
- browser do
18
- get('/').should == "The index"
19
- end
20
- end
19
+ it 'should do a simple request' do
20
+ get('/').body.should == 'The index'
21
21
  end
22
22
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'spec/helper'
5
5
 
6
- testcase_requires 'mongrel'
6
+ spec_require 'mongrel'
7
7
 
8
8
  def ramaze_options
9
9
  { :adapter => :mongrel }
@@ -13,18 +13,18 @@ class TCRecordController < Ramaze::Controller
13
13
  end
14
14
 
15
15
  describe 'Adapter recording' do
16
- setup do
17
- ramaze :adapter => :webrick, :record => lambda{|request|
18
- request.remote_addr == '127.0.0.1'
19
- }
16
+ behaves_like 'http'
20
17
 
21
- @record = Ramaze::Record
22
- end
18
+ ramaze :adapter => :webrick, :record => lambda{|request|
19
+ request.remote_addr == '127.0.0.1'
20
+ }
21
+
22
+ @record = Ramaze::Record
23
23
 
24
24
  it 'should record' do
25
25
  get('/').body.should == 'The index'
26
26
  get('/foo').body.should == 'The foo'
27
- @record.should have(2).requests
27
+ @record.size.should == 2
28
28
  @record.first.path_info.should == '/'
29
29
  @record.last.path_info.should == '/foo'
30
30
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'spec/helper'
5
5
 
6
- testcase_requires 'webrick'
6
+ spec_require 'webrick'
7
7
 
8
8
  def ramaze_options
9
9
  { :adapter => :webrick }
@@ -26,19 +26,15 @@ caches.each do |cache, name|
26
26
  end
27
27
 
28
28
  describe "#{name} modification" do
29
- setup do
29
+ before do
30
30
  Ramaze::Global.cache = cache
31
31
  @cache = Ramaze::Global.cache.new
32
32
  end
33
33
 
34
- after :each do
34
+ after do
35
35
  @cache.clear
36
36
  end
37
37
 
38
- after :all do
39
- FileUtils.rm(@cache.file) if cache == :yaml
40
- end
41
-
42
38
  it "should be assignable with #[]=" do
43
39
  @cache[:foo] = :bar
44
40
  @cache[:foo].should == :bar
@@ -52,7 +48,7 @@ caches.each do |cache, name|
52
48
  it "should delete keys" do
53
49
  @cache[:bar] = :duh
54
50
  @cache.delete(:bar)
55
- @cache[:bar].should be_nil
51
+ @cache[:bar].should == nil
56
52
  end
57
53
 
58
54
  it "should show values for multiple keys" do
@@ -69,7 +65,9 @@ caches.each do |cache, name|
69
65
  Ramaze::Cache.foo[key] = 'foo'
70
66
  Ramaze::Cache.bar[key] = 'bar'
71
67
 
72
- Ramaze::Cache.foo[key].should_not == Ramaze::Cache.bar[key]
68
+ Ramaze::Cache.foo[key].should.not == Ramaze::Cache.bar[key]
73
69
  end
70
+
71
+ FileUtils.rm(@cache.file) if cache == :yaml
74
72
  end
75
73
  end
@@ -40,70 +40,79 @@ describe "Controller" do
40
40
  resolve(*url).values_at(:method, :params, :template)
41
41
  end
42
42
 
43
- before :all do
44
- ramaze :error_page => false
45
- @hash = {
46
- '/' => [
47
- ["/", 'index', []]
48
- ],
49
-
50
- '/foo' => [
51
- ["/foo", 'index',[]],
52
- ['/', 'foo', []],
53
- ["/", 'index', ["foo"]],
54
- ],
55
-
56
- '/foo/bar' => [
57
- ["/foo/bar", "index", []],
58
-
59
- ["/foo", "bar", []],
60
- ["/foo", "index", ["bar"]],
61
-
62
- ["/", "foo__bar", []],
63
- ["/", "foo", ["bar"]],
64
- ["/", "index", ["foo", "bar"]],
65
- ],
66
-
67
- '/foo/bar/baz' => [
68
-
69
- ['/foo/bar/baz', 'index', []],
70
-
71
- ['/foo/bar', 'baz', []],
72
- ['/foo/bar', 'index', ['baz']],
73
-
74
- ['/foo', 'bar__baz', []],
75
- ['/foo', 'bar', ['baz']],
76
- ['/foo', 'index', ['bar', 'baz']],
77
-
78
- ['/', 'foo__bar__baz', []],
79
- ['/', 'foo__bar', ['baz']],
80
- ['/', 'foo', ['bar', 'baz']],
81
- ['/', 'index', ['foo', 'bar', 'baz']],
82
- ],
83
-
84
- '/foo/bar/baz/oof' => [
85
- ['/foo/bar/baz/oof', 'index', []],
86
-
87
- ['/foo/bar/baz', 'oof', []],
88
- ['/foo/bar/baz', 'index', ['oof']],
89
-
90
- ['/foo/bar', 'baz__oof', []],
91
- ['/foo/bar', 'baz', ['oof']],
92
- ['/foo/bar', 'index', ['baz', 'oof']],
93
-
94
- ['/foo', 'bar__baz__oof', []],
95
- ['/foo', 'bar__baz', ['oof']],
96
- ['/foo', 'bar', ['baz', 'oof']],
97
- ['/foo', 'index', ['bar', 'baz', 'oof']],
98
-
99
- ['/', 'foo__bar__baz__oof', []],
100
- ['/', 'foo__bar__baz', ['oof']],
101
- ['/', 'foo__bar', ['baz', 'oof']],
102
- ['/', 'foo', ['bar', 'baz', 'oof']],
103
- ['/', 'index', ['foo', 'bar', 'baz', 'oof']],
104
- ]
105
- }
106
- end
43
+ ramaze :error_page => false
44
+ @hash = {
45
+ '/' => [
46
+ ["/", 'index', []]
47
+ ],
48
+
49
+ '/foo' => [
50
+ ["/foo", "index", []],
51
+ ["/", "foo__index", []],
52
+ ["/", "foo", []],
53
+ ["/", "index", ["foo"]]
54
+
55
+ ],
56
+
57
+ '/foo/bar' => [
58
+ ["/foo/bar", "index", []],
59
+ ["/foo", "bar__index", []],
60
+ ["/foo", "bar", []],
61
+ ["/foo", "index", ["bar"]],
62
+ ["/", "foo__bar__index", []],
63
+ ["/", "foo__bar", []],
64
+ ["/", "foo__index", ["bar"]],
65
+ ["/", "foo", ["bar"]],
66
+ ["/", "index", ["foo", "bar"]]
67
+ ],
68
+
69
+ '/foo/bar/baz' => [
70
+ ["/foo/bar/baz", "index", []],
71
+ ["/foo/bar", "baz__index", []],
72
+ ["/foo/bar", "baz", []],
73
+ ["/foo/bar", "index", ["baz"]],
74
+ ["/foo", "bar__baz__index", []],
75
+ ["/foo", "bar__baz", []],
76
+ ["/foo", "bar__index", ["baz"]],
77
+ ["/foo", "bar", ["baz"]],
78
+ ["/foo", "index", ["bar", "baz"]],
79
+ ["/", "foo__bar__baz__index", []],
80
+ ["/", "foo__bar__baz", []],
81
+ ["/", "foo__bar__index", ["baz"]],
82
+ ["/", "foo__bar", ["baz"]],
83
+ ["/", "foo__index", ["bar", "baz"]],
84
+ ["/", "foo", ["bar", "baz"]],
85
+ ["/", "index", ["foo", "bar", "baz"]]
86
+ ],
87
+
88
+ '/foo/bar/baz/oof' => [
89
+ ["/foo/bar/baz/oof", "index", []],
90
+ ["/foo/bar/baz", "oof__index", []],
91
+ ["/foo/bar/baz", "oof", []],
92
+ ["/foo/bar/baz", "index", ["oof"]],
93
+ ["/foo/bar", "baz__oof__index", []],
94
+ ["/foo/bar", "baz__oof", []],
95
+ ["/foo/bar", "baz__index", ["oof"]],
96
+ ["/foo/bar", "baz", ["oof"]],
97
+ ["/foo/bar", "index", ["baz", "oof"]],
98
+ ["/foo", "bar__baz__oof__index", []],
99
+ ["/foo", "bar__baz__oof", []],
100
+ ["/foo", "bar__baz__index", ["oof"]],
101
+ ["/foo", "bar__baz", ["oof"]],
102
+ ["/foo", "bar__index", ["baz", "oof"]],
103
+ ["/foo", "bar", ["baz", "oof"]],
104
+ ["/foo", "index", ["bar", "baz", "oof"]],
105
+ ["/", "foo__bar__baz__oof__index", []],
106
+ ["/", "foo__bar__baz__oof", []],
107
+ ["/", "foo__bar__baz__index", ["oof"]],
108
+ ["/", "foo__bar__baz", ["oof"]],
109
+ ["/", "foo__bar__index", ["baz", "oof"]],
110
+ ["/", "foo__bar", ["baz", "oof"]],
111
+ ["/", "foo__index", ["bar", "baz", "oof"]],
112
+ ["/", "foo", ["bar", "baz", "oof"]],
113
+ ["/", "index", ["foo", "bar", "baz", "oof"]]
114
+ ],
115
+ }
107
116
 
108
117
  it "dry pattern_for" do
109
118
  @hash.each do |path, correct|
@@ -142,13 +151,16 @@ describe "Controller" do
142
151
  it "double underscore in templates" do
143
152
  handle('/some/long/action').should == 'some long action'
144
153
  handle('/another/long/action').should == 'another long action'
154
+ handle('/other').should == 'This is the index of /other'
145
155
  end
146
156
 
147
157
  TCControllerController.private_methods.sort.each do |action|
148
158
  it action do
149
159
  path = "/#{action}"
150
160
  message = "No Action found for `#{path}' on TCControllerController"
151
- lambda{ resolve(path) }.should raise_error(Ramaze::Error::NoAction, message)
161
+ lambda{ resolve(path) }.should.
162
+ raise(Ramaze::Error::NoAction).
163
+ message.should == message
152
164
  end
153
165
  end
154
166