ramaze 2009.06.12 → 2009.07

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. data/MANIFEST +10 -0
  2. data/README.md +4 -9
  3. data/Rakefile +30 -21
  4. data/doc/AUTHORS +1 -1
  5. data/doc/CHANGELOG +144 -0
  6. data/doc/meta/announcement.txt +47 -76
  7. data/examples/misc/css.rb +6 -12
  8. data/lib/proto/app.rb +4 -5
  9. data/lib/proto/controller/init.rb +1 -1
  10. data/lib/proto/spec/main.rb +3 -4
  11. data/lib/ramaze.rb +0 -2
  12. data/lib/ramaze/app.rb +4 -3
  13. data/lib/ramaze/cache.rb +1 -0
  14. data/lib/ramaze/cache/lru.rb +42 -0
  15. data/lib/ramaze/contrib/addressable_route.rb +10 -9
  16. data/lib/ramaze/controller.rb +1 -3
  17. data/lib/ramaze/helper/blue_form.rb +214 -0
  18. data/lib/ramaze/helper/cache.rb +44 -9
  19. data/lib/ramaze/helper/formatting.rb +5 -2
  20. data/lib/ramaze/helper/layout.rb +2 -2
  21. data/lib/ramaze/helper/paginate.rb +28 -33
  22. data/lib/ramaze/request.rb +1 -1
  23. data/lib/ramaze/snippets/ramaze/lru_hash.rb +248 -0
  24. data/lib/ramaze/spec/bacon.rb +5 -0
  25. data/lib/ramaze/spec/helper/template_examples.rb +4 -1
  26. data/lib/ramaze/version.rb +1 -1
  27. data/lib/ramaze/view.rb +4 -3
  28. data/lib/ramaze/view/less.rb +12 -0
  29. data/ramaze.gemspec +27 -24
  30. data/spec/contrib/addressable_route.rb +3 -5
  31. data/spec/contrib/rest.rb +1 -1
  32. data/spec/examples/caching.rb +2 -2
  33. data/spec/examples/css.rb +2 -2
  34. data/spec/examples/element.rb +2 -2
  35. data/spec/examples/hello.rb +2 -2
  36. data/spec/examples/helpers/httpdigest.rb +2 -2
  37. data/spec/examples/linking.rb +2 -2
  38. data/spec/examples/simple.rb +2 -2
  39. data/spec/examples/templates/template_erubis.rb +5 -2
  40. data/spec/examples/templates/template_ezamar.rb +5 -2
  41. data/spec/examples/templates/template_haml.rb +5 -2
  42. data/spec/examples/templates/template_liquid.rb +5 -2
  43. data/spec/examples/templates/template_markaby.rb +5 -2
  44. data/spec/examples/templates/template_nagoro.rb +5 -2
  45. data/spec/examples/templates/template_redcloth.rb +5 -2
  46. data/spec/examples/templates/template_remarkably.rb +5 -2
  47. data/spec/examples/templates/template_tenjin.rb +5 -2
  48. data/spec/ramaze/action/render.rb +4 -1
  49. data/spec/ramaze/app.rb +4 -1
  50. data/spec/ramaze/app/location.rb +43 -0
  51. data/spec/ramaze/bin/ramaze.rb +7 -2
  52. data/spec/ramaze/cache/localmemcache.rb +1 -1
  53. data/spec/ramaze/cache/lru.rb +48 -0
  54. data/spec/ramaze/cache/memcache.rb +1 -1
  55. data/spec/ramaze/cache/sequel.rb +1 -1
  56. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  57. data/spec/ramaze/controller/lonely_mapping.rb +3 -1
  58. data/spec/ramaze/controller/mapping.rb +4 -1
  59. data/spec/ramaze/controller/provide_inheritance.rb +4 -1
  60. data/spec/ramaze/controller/resolve.rb +1 -1
  61. data/spec/ramaze/controller/subclass.rb +1 -1
  62. data/spec/ramaze/controller/template_resolving.rb +1 -1
  63. data/spec/ramaze/dispatcher/directory.rb +4 -1
  64. data/spec/ramaze/dispatcher/file.rb +8 -8
  65. data/spec/ramaze/error.rb +1 -1
  66. data/spec/ramaze/files.rb +4 -1
  67. data/spec/ramaze/gestalt.rb +4 -1
  68. data/spec/ramaze/helper/auth.rb +1 -1
  69. data/spec/ramaze/helper/bench.rb +4 -1
  70. data/spec/ramaze/helper/blue_form.rb +433 -0
  71. data/spec/ramaze/helper/cache.rb +2 -2
  72. data/spec/ramaze/helper/flash.rb +1 -1
  73. data/spec/ramaze/helper/form.rb +4 -1
  74. data/spec/ramaze/helper/formatting.rb +4 -1
  75. data/spec/ramaze/helper/gestalt.rb +4 -1
  76. data/spec/ramaze/helper/gravatar.rb +4 -1
  77. data/spec/ramaze/helper/httpdigest.rb +4 -1
  78. data/spec/ramaze/helper/layout.rb +1 -1
  79. data/spec/ramaze/helper/link.rb +1 -1
  80. data/spec/ramaze/helper/localize.rb +4 -1
  81. data/spec/ramaze/helper/maruku.rb +4 -1
  82. data/spec/ramaze/helper/pager.rb +1 -1
  83. data/spec/ramaze/helper/paginate.rb +4 -1
  84. data/spec/ramaze/helper/request_accessor.rb +4 -1
  85. data/spec/ramaze/helper/sequel_form.rb +4 -1
  86. data/spec/ramaze/helper/simple_captcha.rb +1 -1
  87. data/spec/ramaze/helper/stack.rb +1 -1
  88. data/spec/ramaze/helper/user.rb +4 -1
  89. data/spec/ramaze/helper/xhtml.rb +4 -1
  90. data/spec/ramaze/log/informer.rb +1 -1
  91. data/spec/ramaze/log/logging.rb +4 -1
  92. data/spec/ramaze/log/syslog.rb +6 -6
  93. data/spec/ramaze/params.rb +1 -1
  94. data/spec/ramaze/request.rb +4 -1
  95. data/spec/ramaze/session/memcache.rb +1 -1
  96. data/spec/ramaze/struct.rb +4 -1
  97. data/spec/ramaze/view.rb +1 -1
  98. data/spec/ramaze/view/erubis.rb +1 -1
  99. data/spec/ramaze/view/ezamar.rb +1 -1
  100. data/spec/ramaze/view/gestalt.rb +2 -2
  101. data/spec/ramaze/view/haml.rb +1 -1
  102. data/spec/ramaze/view/less.rb +60 -0
  103. data/spec/ramaze/view/less/file.css.less +8 -0
  104. data/spec/ramaze/view/liquid.rb +1 -1
  105. data/spec/ramaze/view/nagoro.rb +1 -1
  106. data/spec/ramaze/view/redcloth.rb +1 -1
  107. data/spec/ramaze/view/remarkably.rb +1 -1
  108. data/spec/ramaze/view/sass.rb +1 -1
  109. data/spec/ramaze/view/tagz.rb +1 -1
  110. data/spec/ramaze/view/tenjin.rb +1 -1
  111. data/spec/snippets/array/put_within.rb +30 -25
  112. data/spec/snippets/binding/locals.rb +4 -1
  113. data/spec/snippets/numeric/filesize_format.rb +4 -1
  114. data/spec/snippets/numeric/time.rb +5 -2
  115. data/spec/snippets/object/__dir__.rb +4 -1
  116. data/spec/snippets/ordered_set.rb +4 -1
  117. data/spec/snippets/ramaze/acquire.rb +4 -1
  118. data/spec/snippets/ramaze/dictionary.rb +4 -1
  119. data/spec/snippets/ramaze/lru_hash.rb +88 -0
  120. data/spec/snippets/ramaze/struct.rb +4 -1
  121. data/spec/snippets/string/camel_case.rb +4 -1
  122. data/spec/snippets/string/color.rb +4 -1
  123. data/spec/snippets/string/snake_case.rb +4 -1
  124. data/spec/snippets/string/unindent.rb +4 -1
  125. data/spec/snippets/thread/into.rb +4 -1
  126. data/tasks/bacon.rake +8 -2
  127. data/tasks/gem_setup.rake +21 -8
  128. data/tasks/setup.rake +8 -2
  129. metadata +29 -9
@@ -1,4 +1,7 @@
1
- require 'spec/helper'
1
+ # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require File.expand_path('../../../../spec/helper', __FILE__)
2
5
 
3
6
  spec_require 'hpricot'
4
7
 
@@ -1,18 +1,18 @@
1
1
  # Copyright (c) 2009 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/helper'
4
+ require File.expand_path('../../../../spec/helper', __FILE__)
5
5
 
6
6
  # This spec more or less tries to ensure that we integrate with rack and
7
7
  # rack-contrib in regards to static file serving.
8
8
 
9
- module Ramaze
10
- # minimal middleware, no exception handling
11
- middleware!(:spec){|m|
12
- m.apps Rack::ConditionalGet, Rack::ETag
13
- m.innate
14
- }
15
- end
9
+ spec_require 'rack/contrib'
10
+
11
+ # minimal middleware, no exception handling
12
+ Ramaze.middleware!(:spec){|m|
13
+ m.apps Rack::ConditionalGet, Rack::ETag
14
+ m.run Ramaze::AppMap
15
+ }
16
16
 
17
17
  describe 'Serving static files' do
18
18
  behaves_like :rack_test
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2009 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/helper'
4
+ require File.expand_path('../../../spec/helper', __FILE__)
5
5
  require 'rexml/document'
6
6
  require 'rexml/xpath'
7
7
 
@@ -1,4 +1,7 @@
1
- require 'spec/helper'
1
+ # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require File.expand_path('../../../spec/helper', __FILE__)
2
5
 
3
6
  class SpecFilesCore < Ramaze::Controller
4
7
  map '/', :core
@@ -1,6 +1,9 @@
1
1
  # * Encoding: UTF-8
2
+ #
3
+ # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
4
+ # All files in this distribution are subject to the terms of the Ruby license.
2
5
 
3
- require 'spec/helper'
6
+ require File.expand_path('../../../spec/helper', __FILE__)
4
7
  require 'ramaze/gestalt'
5
8
 
6
9
  describe "Gestalt" do
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2009 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/helper'
4
+ require File.expand_path('../../../../spec/helper', __FILE__)
5
5
 
6
6
  $password = Digest::SHA1.hexdigest('pass')
7
7
 
@@ -1,4 +1,7 @@
1
- require 'spec/helper'
1
+ # Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ require File.expand_path('../../../../spec/helper', __FILE__)
2
5
  require 'ramaze/helper/bench'
3
6
 
4
7
  describe Ramaze::Helper::Bench do
@@ -0,0 +1,433 @@
1
+ require File.expand_path('../../../../lib/ramaze/helper/blue_form', __FILE__)
2
+
3
+ require 'bacon'
4
+ Bacon.summary_at_exit
5
+
6
+ describe BF = Ramaze::Helper::BlueForm do
7
+ extend BF
8
+
9
+ def tidy(html)
10
+ require 'open3'
11
+ Open3.popen3('tidy -i'){|sin, sout, serr|
12
+ sin.print(html)
13
+ sin.close
14
+ sout.read[/<body>(.+)<\/body>/m, 1]
15
+ }
16
+ end
17
+
18
+ # very strange comparision, sort all characters and compare, so we don't have
19
+ # order issues.
20
+ def assert(expected, output)
21
+ left = expected.to_s.gsub(/\s+/, ' ').gsub(/>\s+</, '><').strip
22
+ right = output.to_s.gsub(/\s+/, ' ').gsub(/>\s+</, '><').strip
23
+ left.scan(/./).sort.should == right.scan(/./).sort
24
+ #
25
+ # unless left == right
26
+ # puts "", "Expected:"
27
+ # puts left
28
+ # puts tidy(left)
29
+ # puts "", "Got:"
30
+ # puts right
31
+ # puts tidy(right)
32
+ # puts
33
+ # end
34
+ # left.should == right
35
+ end
36
+
37
+ it 'makes form with method' do
38
+ out = form(:method => :post)
39
+ assert(<<-FORM, out)
40
+ <form method="post"></form>
41
+ FORM
42
+ end
43
+
44
+ it 'makes form with method and action' do
45
+ out = form(:method => :post, :action => '/')
46
+ assert(<<-FORM, out)
47
+ <form method="post" action="/"></form>
48
+ FORM
49
+ end
50
+
51
+ it 'makes form with method, action, and name' do
52
+ out = form(:method => :post, :action => '/', :name => :spec)
53
+ assert(<<-FORM, out)
54
+ <form method="post" action="/" name="spec">
55
+ </form>
56
+ FORM
57
+ end
58
+
59
+ it 'makes form with class and id' do
60
+ out = form(:class => :foo, :id => :bar)
61
+ assert(<<-FORM, out)
62
+ <form class="foo" id="bar">
63
+ </form>
64
+ FORM
65
+ end
66
+
67
+ it 'makes form with legend' do
68
+ out = form(:method => :get){|f|
69
+ f.legend('The Form')
70
+ }
71
+ assert(<<-FORM, out)
72
+ <form method="get">
73
+ <fieldset>
74
+ <legend>The Form</legend>
75
+ </fieldset>
76
+ </form>
77
+ FORM
78
+ end
79
+
80
+ it 'makes form with input_text(label, name, value)' do
81
+ out = form(:method => :get){|f|
82
+ f.input_text 'Username', :username, 'mrfoo'
83
+ }
84
+ assert(<<-FORM, out)
85
+ <form method="get">
86
+ <fieldset>
87
+ <p>
88
+ <label for="form-username">Username</label>
89
+ <input type="text" name="username" class="text" id="form-username" value="mrfoo" />
90
+ </p>
91
+ </fieldset>
92
+ </form>
93
+ FORM
94
+ end
95
+
96
+ it 'makes form with input_text(label, name)' do
97
+ out = form(:method => :get){|f|
98
+ f.input_text 'Username', :username
99
+ }
100
+ assert(<<-FORM, out)
101
+ <form method="get">
102
+ <fieldset>
103
+ <p>
104
+ <label for="form-username">Username</label>
105
+ <input type="text" name="username" class="text" id="form-username" />
106
+ </p>
107
+ </fieldset>
108
+ </form>
109
+ FORM
110
+ end
111
+
112
+ it 'makes form with input_text(label, name, value, hash)' do
113
+ out = form(:method => :get){|f|
114
+ f.input_text 'Username', :username, nil, :size => 10
115
+ }
116
+ assert(<<-FORM, out)
117
+ <form method="get">
118
+ <fieldset>
119
+ <p>
120
+ <label for="form-username">Username</label>
121
+ <input size="10" type="text" name="username" class="text" id="form-username" />
122
+ </p>
123
+ </fieldset>
124
+ </form>
125
+ FORM
126
+ end
127
+
128
+ it 'makes form with input_password(label, name)' do
129
+ out = form(:method => :get){|f|
130
+ f.input_password 'Password', :password
131
+ }
132
+ assert(<<-FORM, out)
133
+ <form method="get">
134
+ <fieldset>
135
+ <p>
136
+ <label for="form-password">Password</label>
137
+ <input type="password" name="password" class="text" id="form-password" />
138
+ </p>
139
+ </fieldset>
140
+ </form>
141
+ FORM
142
+ end
143
+
144
+ it 'makes form with input_submit()' do
145
+ out = form(:method => :get){|f|
146
+ f.input_submit
147
+ }
148
+ assert(<<-FORM, out)
149
+ <form method="get">
150
+ <fieldset>
151
+ <p>
152
+ <input type="submit" class="button submit" />
153
+ </p>
154
+ </fieldset>
155
+ </form>
156
+ FORM
157
+ end
158
+
159
+ it 'makes form with input_submit(value)' do
160
+ out = form(:method => :get){|f|
161
+ f.input_submit 'Send'
162
+ }
163
+ assert(<<-FORM, out)
164
+ <form method="get">
165
+ <fieldset>
166
+ <p>
167
+ <input type="submit" class="button submit" value="Send" />
168
+ </p>
169
+ </fieldset>
170
+ </form>
171
+ FORM
172
+ end
173
+
174
+ it 'makes form with input_checkbox(label, name)' do
175
+ out = form(:method => :get){|f|
176
+ f.input_checkbox 'Assigned', :assigned
177
+ }
178
+ assert(<<-FORM, out)
179
+ <form method="get">
180
+ <fieldset>
181
+ <p>
182
+ <label for="form-assigned">Assigned</label>
183
+ <input type="checkbox" name="assigned" class="checkbox" id="form-assigned" />
184
+ </p>
185
+ </fieldset>
186
+ </form>
187
+ FORM
188
+ end
189
+
190
+ it 'makes form with input_checkbox(label, name, checked = false)' do
191
+ out = form(:method => :get){|f|
192
+ f.input_checkbox 'Assigned', :assigned, false
193
+ }
194
+ assert(<<-FORM, out)
195
+ <form method="get">
196
+ <fieldset>
197
+ <p>
198
+ <label for="form-assigned">Assigned</label>
199
+ <input type="checkbox" name="assigned" class="checkbox" id="form-assigned" />
200
+ </p>
201
+ </fieldset>
202
+ </form>
203
+ FORM
204
+ end
205
+
206
+ it 'makes form with input_checkbox(label, name, checked = true)' do
207
+ out = form(:method => :get){|f|
208
+ f.input_checkbox 'Assigned', :assigned, true
209
+ }
210
+ assert(<<-FORM, out)
211
+ <form method="get">
212
+ <fieldset>
213
+ <p>
214
+ <label for="form-assigned">Assigned</label>
215
+ <input type="checkbox" name="assigned" class="checkbox" id="form-assigned" checked="checked" />
216
+ </p>
217
+ </fieldset>
218
+ </form>
219
+ FORM
220
+ end
221
+
222
+ it 'makes form with input_checkbox(label, name, checked = nil)' do
223
+ out = form(:method => :get){|f|
224
+ f.input_checkbox 'Assigned', :assigned, nil
225
+ }
226
+ assert(<<-FORM, out)
227
+ <form method="get">
228
+ <fieldset>
229
+ <p>
230
+ <label for="form-assigned">Assigned</label>
231
+ <input type="checkbox" name="assigned" class="checkbox" id="form-assigned" />
232
+ </p>
233
+ </fieldset>
234
+ </form>
235
+ FORM
236
+ end
237
+
238
+ it 'makes form with textarea(label, name)' do
239
+ out = form(:method => :get){|f|
240
+ f.textarea 'Message', :message
241
+ }
242
+ assert(<<-FORM, out)
243
+ <form method="get">
244
+ <fieldset>
245
+ <p>
246
+ <label for="form-message">Message</label>
247
+ <textarea name="message" id="form-message"></textarea>
248
+ </p>
249
+ </fieldset>
250
+ </form>
251
+ FORM
252
+ end
253
+
254
+ it 'makes form with textarea(label, name, value)' do
255
+ out = form(:method => :get){|f|
256
+ f.textarea 'Message', :message, 'stuff'
257
+ }
258
+ assert(<<-FORM, out)
259
+ <form method="get">
260
+ <fieldset>
261
+ <p>
262
+ <label for="form-message">Message</label>
263
+ <textarea name="message" id="form-message">stuff</textarea>
264
+ </p>
265
+ </fieldset>
266
+ </form>
267
+ FORM
268
+ end
269
+
270
+ it 'makes form with input_file(label, name)' do
271
+ out = form(:method => :get){|f|
272
+ f.input_file 'Avatar', :avatar
273
+ }
274
+ assert(<<-FORM, out)
275
+ <form method="get">
276
+ <fieldset>
277
+ <p>
278
+ <label for="form-avatar">Avatar</label>
279
+ <input type="file" name="avatar" class="file" id="form-avatar" />
280
+ </p>
281
+ </fieldset>
282
+ </form>
283
+ FORM
284
+ end
285
+
286
+ it 'makes form with input_hidden(name)' do
287
+ out = form(:method => :get){|f|
288
+ f.input_hidden :post_id
289
+ }
290
+ assert(<<-FORM, out)
291
+ <form method="get">
292
+ <fieldset>
293
+ <input type="hidden" name="post_id" />
294
+ </fieldset>
295
+ </form>
296
+ FORM
297
+ end
298
+
299
+ it 'makes form with input_hidden(name, value)' do
300
+ out = form(:method => :get){|f|
301
+ f.input_hidden :post_id, 15
302
+ }
303
+ assert(<<-FORM, out)
304
+ <form method="get">
305
+ <fieldset>
306
+ <input type="hidden" name="post_id" value="15" />
307
+ </fieldset>
308
+ </form>
309
+ FORM
310
+ end
311
+
312
+ servers_hash = {
313
+ :webrick => 'WEBrick',
314
+ :mongrel => 'Mongrel',
315
+ :thin => 'Thin',
316
+ }
317
+
318
+ it 'makes form with select(label, name, values) from hash' do
319
+ out = form(:method => :get){|f|
320
+ f.select 'Server', :server, servers_hash
321
+ }
322
+ assert(<<-FORM, out)
323
+ <form method="get">
324
+ <fieldset>
325
+ <p>
326
+ <label for="form-server">Server</label>
327
+ <select id="form-server" size="1" name="server">
328
+ <option value="webrick">WEBrick</option>
329
+ <option value="mongrel">Mongrel</option>
330
+ <option value="thin">Thin</option>
331
+ </select>
332
+ </p>
333
+ </fieldset>
334
+ </form>
335
+ FORM
336
+ end
337
+
338
+ it 'makes form with select(label, name, values) with selection from hash' do
339
+ out = form(:method => :get){|f|
340
+ f.select 'Server', :server, servers_hash, :selected => :mongrel
341
+ }
342
+ assert(<<-FORM, out)
343
+ <form method="get">
344
+ <fieldset>
345
+ <p>
346
+ <label for="form-server">Server</label>
347
+ <select id="form-server" size="1" name="server">
348
+ <option value="webrick">WEBrick</option>
349
+ <option value="mongrel" selected="selected">Mongrel</option>
350
+ <option value="thin">Thin</option>
351
+ </select>
352
+ </p>
353
+ </fieldset>
354
+ </form>
355
+ FORM
356
+ end
357
+
358
+ servers_array = %w[ WEBrick Mongrel Thin]
359
+
360
+ it 'makes form with select(label, name, values) from array' do
361
+ out = form(:method => :get){|f|
362
+ f.select 'Server', :server, servers_array
363
+ }
364
+ assert(<<-FORM, out)
365
+ <form method="get">
366
+ <fieldset>
367
+ <p>
368
+ <label for="form-server">Server</label>
369
+ <select id="form-server" size="1" name="server">
370
+ <option value="WEBrick">WEBrick</option>
371
+ <option value="Mongrel">Mongrel</option>
372
+ <option value="Thin">Thin</option>
373
+ </select>
374
+ </p>
375
+ </fieldset>
376
+ </form>
377
+ FORM
378
+ end
379
+
380
+ it 'makes form with select(label, name, values) with selection from array' do
381
+ out = form(:method => :get){|f|
382
+ f.select 'Server', :server, servers_array, :selected => 'Mongrel'
383
+ }
384
+ assert(<<-FORM, out)
385
+ <form method="get">
386
+ <fieldset>
387
+ <p>
388
+ <label for="form-server">Server</label>
389
+ <select id="form-server" size="1" name="server">
390
+ <option value="WEBrick">WEBrick</option>
391
+ <option value="Mongrel" selected="selected">Mongrel</option>
392
+ <option value="Thin">Thin</option>
393
+ </select>
394
+ </p>
395
+ </fieldset>
396
+ </form>
397
+ FORM
398
+ end
399
+
400
+ it 'makes form with radio(label, name, values) with selection from array' do
401
+ out = form(:method => :get){|f|
402
+ f.radio 'Server', :server, servers_array, :checked => 'Mongrel'
403
+ }
404
+ assert(<<-FORM, out)
405
+ <form method="get">
406
+ <fieldset>
407
+ <p>
408
+ <label for="form-server-0"><input type="radio" value="WEBrick" id="form-server-0" name="server" />WEBrick</label>
409
+ <label for="form-server-1"><input type="radio" value="Mongrel" id="form-server-1" name="server" checked="checked" />Mongrel</label>
410
+ <label for="form-server-2"><input type="radio" value="Thin" id="form-server-2" name="server" />Thin</label>
411
+ </p>
412
+ </fieldset>
413
+ </form>
414
+ FORM
415
+ end
416
+
417
+ it 'inserts error messages' do
418
+ form_error :username, 'May not be empty'
419
+ out = form(:method => :get){|f|
420
+ f.input_text 'Username', :username
421
+ }
422
+ assert(<<-FORM, out)
423
+ <form method="get">
424
+ <fieldset>
425
+ <p>
426
+ <label for="form-username">Username <span class="error">May not be empty</span></label>
427
+ <input type="text" name="username" class="text" id="form-username" />
428
+ </p>
429
+ </fieldset>
430
+ </form>
431
+ FORM
432
+ end
433
+ end