hobo 0.5.3 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/bin/hobo +18 -4
  2. data/hobo_files/plugin/CHANGES.txt +511 -0
  3. data/hobo_files/plugin/README +8 -3
  4. data/hobo_files/plugin/Rakefile +81 -0
  5. data/hobo_files/plugin/generators/hobo/hobo_generator.rb +4 -4
  6. data/hobo_files/plugin/generators/hobo/templates/guest.rb +1 -1
  7. data/hobo_files/plugin/generators/hobo_front_controller/hobo_front_controller_generator.rb +1 -1
  8. data/hobo_files/plugin/generators/hobo_front_controller/templates/index.dryml +16 -22
  9. data/hobo_files/plugin/generators/hobo_front_controller/templates/login.dryml +4 -6
  10. data/hobo_files/plugin/generators/hobo_front_controller/templates/search.dryml +6 -5
  11. data/hobo_files/plugin/generators/hobo_front_controller/templates/signup.dryml +4 -6
  12. data/hobo_files/plugin/generators/hobo_migration/hobo_migration_generator.rb +237 -0
  13. data/hobo_files/plugin/generators/hobo_migration/templates/migration.rb +9 -0
  14. data/hobo_files/plugin/generators/hobo_model/USAGE +2 -3
  15. data/hobo_files/plugin/generators/hobo_model/hobo_model_generator.rb +1 -14
  16. data/hobo_files/plugin/generators/hobo_model/templates/fixtures.yml +1 -6
  17. data/hobo_files/plugin/generators/hobo_model/templates/model.rb +10 -4
  18. data/hobo_files/plugin/generators/hobo_rapid/hobo_rapid_generator.rb +7 -6
  19. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_base.css +68 -0
  20. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.css +93 -0
  21. data/hobo_files/plugin/generators/hobo_rapid/templates/hobo_rapid.js +11 -6
  22. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/images/plus.png +0 -0
  23. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/public/stylesheets/application.css +24 -14
  24. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/views/application.dryml +28 -44
  25. data/hobo_files/plugin/generators/hobo_user_model/USAGE +2 -12
  26. data/hobo_files/plugin/generators/hobo_user_model/hobo_user_model_generator.rb +1 -14
  27. data/hobo_files/plugin/generators/hobo_user_model/templates/fixtures.yml +0 -6
  28. data/hobo_files/plugin/generators/hobo_user_model/templates/model.rb +8 -1
  29. data/hobo_files/plugin/init.rb +6 -2
  30. data/hobo_files/plugin/lib/active_record/has_many_association.rb +23 -12
  31. data/hobo_files/plugin/lib/extensions.rb +134 -40
  32. data/hobo_files/plugin/lib/extensions/test_case.rb +0 -1
  33. data/hobo_files/plugin/lib/hobo.rb +77 -46
  34. data/hobo_files/plugin/lib/hobo/authenticated_user.rb +24 -2
  35. data/hobo_files/plugin/lib/hobo/authentication_support.rb +2 -1
  36. data/hobo_files/plugin/lib/hobo/controller.rb +35 -12
  37. data/hobo_files/plugin/lib/hobo/define_tags.rb +4 -4
  38. data/hobo_files/plugin/lib/hobo/dryml.rb +33 -51
  39. data/hobo_files/plugin/lib/hobo/dryml/dryml_builder.rb +47 -34
  40. data/hobo_files/plugin/lib/hobo/dryml/scoped_variables.rb +37 -0
  41. data/hobo_files/plugin/lib/hobo/dryml/taglib.rb +27 -5
  42. data/hobo_files/plugin/lib/hobo/dryml/template.rb +545 -302
  43. data/hobo_files/plugin/lib/hobo/dryml/template_environment.rb +305 -135
  44. data/hobo_files/plugin/lib/hobo/email_address.rb +5 -0
  45. data/hobo_files/plugin/lib/hobo/field_spec.rb +66 -0
  46. data/hobo_files/plugin/lib/hobo/hobo_helper.rb +325 -0
  47. data/hobo_files/plugin/lib/hobo/html_string.rb +2 -0
  48. data/hobo_files/plugin/lib/hobo/lazy_hash.rb +13 -1
  49. data/hobo_files/plugin/lib/hobo/markdown_string.rb +3 -1
  50. data/hobo_files/plugin/lib/hobo/model.rb +185 -66
  51. data/hobo_files/plugin/lib/hobo/model_controller.rb +56 -49
  52. data/hobo_files/plugin/lib/hobo/password_string.rb +2 -0
  53. data/hobo_files/plugin/lib/hobo/plugins.rb +75 -0
  54. data/hobo_files/plugin/lib/hobo/rapid_helper.rb +98 -0
  55. data/hobo_files/plugin/lib/hobo/static_tags +0 -3
  56. data/hobo_files/plugin/lib/hobo/textile_string.rb +11 -1
  57. data/hobo_files/plugin/lib/hobo/undefined.rb +1 -1
  58. data/hobo_files/plugin/lib/rexml.rb +166 -75
  59. data/hobo_files/plugin/spec/fixtures/users.yml +9 -0
  60. data/hobo_files/plugin/spec/spec.opts +6 -0
  61. data/hobo_files/plugin/spec/spec_helper.rb +28 -0
  62. data/hobo_files/plugin/spec/unit/hobo/dryml/template_spec.rb +650 -0
  63. data/hobo_files/plugin/tags/core.dryml +58 -4
  64. data/hobo_files/plugin/tags/rapid.dryml +289 -135
  65. data/hobo_files/plugin/tags/rapid_document_tags.dryml +49 -0
  66. data/hobo_files/plugin/tags/rapid_editing.dryml +92 -69
  67. data/hobo_files/plugin/tags/rapid_forms.dryml +242 -0
  68. data/hobo_files/plugin/tags/rapid_navigation.dryml +65 -65
  69. data/hobo_files/plugin/tags/rapid_pages.dryml +197 -124
  70. data/hobo_files/plugin/tags/rapid_support.dryml +23 -0
  71. metadata +29 -22
  72. data/hobo_files/plugin/generators/hobo_model/templates/migration.rb +0 -13
  73. data/hobo_files/plugin/generators/hobo_rapid/templates/themes/default/default_mapping.rb +0 -11
  74. data/hobo_files/plugin/generators/hobo_user_model/templates/migration.rb +0 -15
  75. data/hobo_files/plugin/lib/hobo/HtmlString +0 -3
  76. data/hobo_files/plugin/lib/hobo/controller_helpers.rb +0 -135
  77. data/hobo_files/plugin/lib/hobo/core.rb +0 -475
  78. data/hobo_files/plugin/lib/hobo/rapid.rb +0 -447
  79. data/hobo_files/plugin/test/hobo_dryml_template_test.rb +0 -7
  80. data/hobo_files/plugin/test/hobo_test.rb +0 -7
@@ -1,39 +1,67 @@
1
- # Hobo needs to process XML as transparently as possibe. In the case of tags
2
- # that are not defined by hobo (i.e. html tags), they should pass through just
3
- # as they were in the dryml source. Recontructing the tags from the DOM is not
4
- # good enough. The extensions to REXML in here allow Hobo to use the original
5
- # start tag source in the output.
6
- # There's also some fixes/extras to allow error messages with line numbers.
1
+ # Extensions to XML Parsing
2
+ #
3
+ # 1. Hobo needs to process XML as transparently as possibe. In the
4
+ # case of tags that are not defined (i.e. html tags), they should pass
5
+ # through just as they were in the dryml source. Recontructing the
6
+ # tags from the DOM is not good enough. The extensions to REXML in
7
+ # here allow Hobo to use the original start tag source in the output.
8
+ #
9
+ # 2. some fixes/extras to allow error messages with line numbers.
10
+ #
11
+ # 3. Attributes without a RHS are allowed. They are returned as having
12
+ # a value of +true+ (the Ruby value, not the string 'true')
13
+ #
14
+ # 1 and 2 are achieved by adding two instance variables to Element
15
+ # nodes : @start_tag_source and @source_offset
16
+ #
17
+ # So cool that Ruby allows us to redefine a method. Such a shame the method
18
+ # we needed to change happened to be 200 lines long :-(
7
19
 
8
- # The main hack is that Element nodes have two instance variables added:
9
- # @start_tag_source and @source_offset
20
+ require 'rexml/document'
10
21
 
11
- # So cool that Ruby allows us to redfine a method. Such a shame the method
12
- # happened to be 200 lines long :-(
13
22
 
14
- require 'rexml/document'
15
23
 
16
24
  module REXML
17
25
  module Parsers
26
+
27
+ class TreeParser
28
+ def initialize( source, build_context = Document.new )
29
+ @build_context = build_context
30
+ @parser = Parsers::BaseParser.new(source)
31
+ @parser.dryml_mode = build_context.context[:dryml_mode]
32
+ end
33
+ end
34
+
18
35
  class BaseParser
36
+
37
+ DRYML_ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})(?:\s*=\s*(["'])(.*?)\2)?/um
38
+
39
+ DRYML_TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{NAME_STR}(?:\s*=\s*(["']).*?\3)?)*)\s*(\/)?>/um
40
+
41
+ attr_writer :dryml_mode
42
+ def dryml_mode?
43
+ @dryml_mode
44
+ end
45
+
46
+
19
47
  def pull
20
48
  if @closed
21
49
  x, @closed = @closed, nil
22
- return [ :end_element, x ]
50
+ return [ :end_element, x, false ]
23
51
  end
24
52
  return [ :end_document ] if empty?
25
53
  return @stack.shift if @stack.size > 0
26
54
  @source.read if @source.buffer.size<2
27
55
  if @document_status == nil
28
- @source.consume( /^\s*/um )
29
- word = @source.match( /(<[^>]*)>/um )
56
+ @source.consume(/^\s*/um)
57
+ word = @source.match(/(<[^>]*)>/um)
30
58
  word = word[1] unless word.nil?
31
59
  case word
32
60
  when COMMENT_START
33
- return [ :comment, @source.match( COMMENT_PATTERN, true )[1] ]
61
+ return [ :comment, @source.match(COMMENT_PATTERN, true)[1] ]
34
62
  when XMLDECL_START
35
- results = @source.match( XMLDECL_PATTERN, true )[1]
36
- version = VERSION.match( results )
63
+ results = @source.match(XMLDECL_PATTERN, true)[1]
64
+ version = VERSION.match(results)
37
65
  version = version[1] unless version.nil?
38
66
  encoding = ENCODING.match(results)
39
67
  encoding = encoding[1] unless encoding.nil?
@@ -44,7 +72,7 @@ module REXML
44
72
  when INSTRUCTION_START
45
73
  return [ :processing_instruction, *@source.match(INSTRUCTION_PATTERN, true)[1,2] ]
46
74
  when DOCTYPE_START
47
- md = @source.match( DOCTYPE_PATTERN, true )
75
+ md = @source.match(DOCTYPE_PATTERN, true)
48
76
  identity = md[1]
49
77
  close = md[2]
50
78
  identity =~ IDENTITY
@@ -73,14 +101,14 @@ module REXML
73
101
  md = @source.match(/\s*(.*?>)/um)
74
102
  case md[1]
75
103
  when SYSTEMENTITY
76
- match = @source.match( SYSTEMENTITY, true )[1]
104
+ match = @source.match(SYSTEMENTITY, true)[1]
77
105
  return [ :externalentity, match ]
78
106
 
79
107
  when ELEMENTDECL_START
80
- return [ :elementdecl, @source.match( ELEMENTDECL_PATTERN, true )[1] ]
108
+ return [ :elementdecl, @source.match(ELEMENTDECL_PATTERN, true)[1] ]
81
109
 
82
110
  when ENTITY_START
83
- match = @source.match( ENTITYDECL, true ).to_a.compact
111
+ match = @source.match(ENTITYDECL, true).to_a.compact
84
112
  match[0] = :entitydecl
85
113
  ref = false
86
114
  if match[1] == '%'
@@ -106,13 +134,13 @@ module REXML
106
134
  match << '%' if ref
107
135
  return match
108
136
  when ATTLISTDECL_START
109
- md = @source.match( ATTLISTDECL_PATTERN, true )
110
- raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
137
+ md = @source.match(ATTLISTDECL_PATTERN, true)
138
+ raise REXML::ParseException.new("Bad ATTLIST declaration!", @source) if md.nil?
111
139
  element = md[1]
112
140
  contents = md[0]
113
141
 
114
142
  pairs = {}
115
- values = md[0].scan( ATTDEF_RE )
143
+ values = md[0].scan(ATTDEF_RE)
116
144
  values.each do |attdef|
117
145
  unless attdef[3] == "#IMPLIED"
118
146
  attdef.compact!
@@ -124,17 +152,17 @@ module REXML
124
152
  return [ :attlistdecl, element, pairs, contents ]
125
153
  when NOTATIONDECL_START
126
154
  md = nil
127
- if @source.match( PUBLIC )
128
- md = @source.match( PUBLIC, true )
129
- elsif @source.match( SYSTEM )
130
- md = @source.match( SYSTEM, true )
155
+ if @source.match(PUBLIC)
156
+ md = @source.match(PUBLIC, true)
157
+ elsif @source.match(SYSTEM)
158
+ md = @source.match(SYSTEM, true)
131
159
  else
132
- raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source )
160
+ raise REXML::ParseException.new("error parsing notation: no matching pattern", @source)
133
161
  end
134
162
  return [ :notationdecl, md[1], md[2], md[3] ]
135
163
  when CDATA_END
136
164
  @document_status = :after_doctype
137
- @source.match( CDATA_END, true )
165
+ @source.match(CDATA_END, true)
138
166
  return [ :end_doctype ]
139
167
  end
140
168
  end
@@ -142,36 +170,42 @@ module REXML
142
170
  if @source.buffer[0] == ?<
143
171
  if @source.buffer[1] == ?/
144
172
  last_tag, line_no = @tags.pop
145
- #md = @source.match_to_consume( '>', CLOSE_MATCH)
146
- md = @source.match( CLOSE_MATCH, true )
173
+ #md = @source.match_to_consume('>', CLOSE_MATCH)
174
+ md = @source.match(CLOSE_MATCH, true)
175
+
176
+ valid_end_tag = if dryml_mode?
177
+ last_tag =~ /^#{Regexp.escape(md[1])}(:.*)?/
178
+ else
179
+ last_tag == md[1]
180
+ end
147
181
  raise REXML::ParseException.new("Missing end tag for "+
148
182
  "'#{last_tag}' (line #{line_no}) (got \"#{md[1]}\")",
149
- @source) unless last_tag == md[1]
150
- return [ :end_element, last_tag ]
183
+ @source) unless valid_end_tag
184
+ return [ :end_element, last_tag, true ]
151
185
  elsif @source.buffer[1] == ?!
152
186
  md = @source.match(/\A(\s*[^>]*>)/um)
153
187
  raise REXML::ParseException.new("Malformed node", @source) unless md
154
188
  if md[0][2] == ?-
155
- md = @source.match( COMMENT_PATTERN, true )
189
+ md = @source.match(COMMENT_PATTERN, true)
156
190
  return [ :comment, md[1] ] if md
157
191
  else
158
- md = @source.match( CDATA_PATTERN, true )
192
+ md = @source.match(CDATA_PATTERN, true)
159
193
  return [ :cdata, md[1] ] if md
160
194
  end
161
- raise REXML::ParseException.new( "Declarations can only occur "+
195
+ raise REXML::ParseException.new("Declarations can only occur "+
162
196
  "in the doctype declaration.", @source)
163
197
  elsif @source.buffer[1] == ??
164
- md = @source.match( INSTRUCTION_PATTERN, true )
198
+ md = @source.match(INSTRUCTION_PATTERN, true)
165
199
  return [ :processing_instruction, md[1], md[2] ] if md
166
- raise REXML::ParseException.new( "Bad instruction declaration",
200
+ raise REXML::ParseException.new("Bad instruction declaration",
167
201
  @source)
168
202
  else
169
203
  # Get the next tag
170
- md = @source.match(TAG_MATCH, true)
204
+ md = @source.match(dryml_mode? ? DRYML_TAG_MATCH : TAG_MATCH, true)
171
205
  raise REXML::ParseException.new("malformed XML: missing tag start", @source) unless md
172
206
  attrs = []
173
207
  if md[2].size > 0
174
- attrs = md[2].scan( ATTRIBUTE_PATTERN )
208
+ attrs = md[2].scan(dryml_mode? ? DRYML_ATTRIBUTE_PATTERN : ATTRIBUTE_PATTERN)
175
209
  raise REXML::ParseException.new("error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"",
176
210
  @source) if $' and $'.strip.size > 0
177
211
  end
@@ -183,25 +217,24 @@ module REXML
183
217
  @tags.push([md[1], cl && cl[2]])
184
218
  end
185
219
  attributes = {}
186
- attrs.each { |a,b,c| attributes[a] = c }
220
+ attrs.each { |a,b,c| attributes[a] = (c || true) }
187
221
  return [ :start_element, md[1], attributes, md[0],
188
222
  @source.respond_to?(:last_match_offset) && @source.last_match_offset ]
189
223
  end
190
224
  else
191
- md = @source.match( TEXT_PATTERN, true )
225
+ md = @source.match(TEXT_PATTERN, true)
192
226
  if md[0].length == 0
193
- @source.match( /(\s+)/, true )
227
+ @source.match(/(\s+)/, true)
194
228
  end
195
229
  #return [ :text, "" ] if md[0].length == 0
196
- # unnormalized = Text::unnormalize( md[1], self )
197
- # return PullEvent.new( :text, md[1], unnormalized )
230
+ # unnormalized = Text::unnormalize(md[1], self)
231
+ # return PullEvent.new(:text, md[1], unnormalized)
198
232
  return [ :text, md[1] ]
199
233
  end
200
234
  rescue REXML::ParseException
201
235
  raise
202
236
  rescue Exception, NameError => error
203
- raise REXML::ParseException.new( "Exception parsing",
204
- @source, self, (error ? error : $!) )
237
+ raise REXML::ParseException.new("Exception parsing", @source, self, (error ? error : $!))
205
238
  end
206
239
  return [ :dummy ]
207
240
  end
@@ -221,70 +254,127 @@ module REXML
221
254
  when :start_element
222
255
  tag_stack.push(event[1])
223
256
  # find the observers for namespaces
224
- @build_context = @build_context.add_element( event[1], event[2] )
225
- @build_context.instance_variable_set("@start_tag_source", event[3])
226
- @build_context.instance_variable_set("@source_offset", event[4])
257
+ @build_context = @build_context.add_element(event[1], event[2])
258
+ @build_context.start_tag_source = event[3]
259
+ @build_context.source_offset = event[4]
227
260
  when :end_element
228
261
  tag_stack.pop
262
+ @build_context.has_end_tag = event[2]
229
263
  @build_context = @build_context.parent
230
264
  when :text
231
265
  if not in_doctype
232
266
  if @build_context[-1].instance_of? Text
233
267
  @build_context[-1] << event[1]
234
268
  else
235
- @build_context.add(
236
- Text.new( event[1], @build_context.whitespace, nil, true )
237
- ) unless (
269
+ @build_context.add(
270
+ Text.new(event[1], @build_context.whitespace, nil, true)
271
+ ) unless (
238
272
  event[1].strip.size==0 and
239
273
  @build_context.ignore_whitespace_nodes
240
- )
274
+ )
241
275
  end
242
276
  end
243
277
  when :comment
244
- c = Comment.new( event[1] )
245
- @build_context.add( c )
278
+ c = Comment.new(event[1])
279
+ @build_context.add(c)
246
280
  when :cdata
247
- c = CData.new( event[1] )
248
- @build_context.add( c )
281
+ c = CData.new(event[1])
282
+ @build_context.add(c)
249
283
  when :processing_instruction
250
- @build_context.add( Instruction.new( event[1], event[2] ) )
284
+ @build_context.add(Instruction.new(event[1], event[2]))
251
285
  when :end_doctype
252
286
  in_doctype = false
253
287
  entities.each { |k,v| entities[k] = @build_context.entities[k].value }
254
288
  @build_context = @build_context.parent
255
289
  when :start_doctype
256
- doctype = DocType.new( event[1..-1], @build_context )
290
+ doctype = DocType.new(event[1..-1], @build_context)
257
291
  @build_context = doctype
258
292
  entities = {}
259
293
  in_doctype = true
260
294
  when :attlistdecl
261
- n = AttlistDecl.new( event[1..-1] )
262
- @build_context.add( n )
295
+ n = AttlistDecl.new(event[1..-1])
296
+ @build_context.add(n)
263
297
  when :externalentity
264
- n = ExternalEntity.new( event[1] )
265
- @build_context.add( n )
298
+ n = ExternalEntity.new(event[1])
299
+ @build_context.add(n)
266
300
  when :elementdecl
267
- n = ElementDecl.new( event[1] )
301
+ n = ElementDecl.new(event[1])
268
302
  @build_context.add(n)
269
303
  when :entitydecl
270
304
  entities[ event[1] ] = event[2] unless event[2] =~ /PUBLIC|SYSTEM/
271
305
  @build_context.add(Entity.new(event))
272
306
  when :notationdecl
273
- n = NotationDecl.new( *event[1..-1] )
274
- @build_context.add( n )
307
+ n = NotationDecl.new(*event[1..-1])
308
+ @build_context.add(n)
275
309
  when :xmldecl
276
- x = XMLDecl.new( event[1], event[2], event[3] )
277
- @build_context.add( x )
310
+ x = XMLDecl.new(event[1], event[2], event[3])
311
+ @build_context.add(x)
278
312
  end
279
313
  end
280
314
  rescue REXML::Validation::ValidationException
281
315
  raise
282
316
  rescue
283
- raise ParseException.new( $!.message, @parser.source, @parser, $! )
317
+ raise ParseException.new($!.message, @parser.source, @parser, $!)
284
318
  end
285
319
  end
286
320
  end
287
321
  end
322
+
323
+ class Document
324
+
325
+ attr_accessor :default_attribute_value
326
+
327
+ end
328
+
329
+ class Element
330
+
331
+ def dryml_name
332
+ expanded_name.sub(/:.*/, "")
333
+ end
334
+
335
+ attr_accessor :start_tag_source, :source_offset
336
+
337
+ attr_writer :has_end_tag
338
+ def has_end_tag?
339
+ @has_end_tag
340
+ end
341
+
342
+ end
343
+
344
+ class Attribute
345
+
346
+ def initialize_with_dryml(first, second=nil, parent=nil)
347
+ initialize_without_dryml(first, second, parent)
348
+ if first.is_a?(String) && second == true
349
+ @value = true
350
+ end
351
+ end
352
+ alias_method_chain :initialize, :dryml
353
+
354
+ def value_with_dryml
355
+ if has_rhs?
356
+ value_without_dryml
357
+ else
358
+ element.document.default_attribute_value
359
+ end
360
+ end
361
+ alias_method_chain :value, :dryml
362
+
363
+ def to_string_with_dryml
364
+ if has_rhs?
365
+ to_string_without_dryml
366
+ else
367
+ @expanded_name
368
+ end
369
+ end
370
+ alias_method_chain :to_string, :dryml
371
+
372
+ def has_rhs?
373
+ @value != true
374
+ end
375
+
376
+ end
377
+
288
378
  end
289
379
 
290
380
  module Hobo::Dryml
@@ -322,8 +412,8 @@ module Hobo::Dryml
322
412
  rv
323
413
  end
324
414
 
325
- def consume( pattern )
326
- md = remember_match(pattern.match( @buffer ))
415
+ def consume(pattern)
416
+ md = remember_match(pattern.match(@buffer))
327
417
  if md
328
418
  advance_buffer(md)
329
419
  @buffer
@@ -337,9 +427,10 @@ module Hobo::Dryml
337
427
  end
338
428
 
339
429
  def current_line
340
- pos = last_match_offset
341
- [0, 0, @orig[0..pos].count("\n") + 1]
430
+ pos = last_match_offset || 0
431
+ [0, 0, @orig[0..pos].count("\n") + 1]
342
432
  end
343
433
 
344
434
  end
435
+
345
436
  end
@@ -0,0 +1,9 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+ one:
3
+ id: 1
4
+ created_at: 2007-06-21 13:10:55
5
+ updated_at: 2007-06-21 13:10:55
6
+ two:
7
+ id: 2
8
+ created_at: 2007-06-21 13:10:55
9
+ updated_at: 2007-06-21 13:10:55
@@ -0,0 +1,6 @@
1
+ --colour
2
+ --format
3
+ progress
4
+ --loadby
5
+ mtime
6
+ --reverse
@@ -0,0 +1,28 @@
1
+ ENV['RAILS_ENV'] ||= 'mysql'
2
+ require File.dirname(__FILE__) + '/rails_root/config/environment.rb'
3
+
4
+ # Run the migrations
5
+ ActiveRecord::Migrator.migrate("#{RAILS_ROOT}/db/migrate")
6
+
7
+ require 'spec/rails'
8
+
9
+ Spec::Runner.configure do |config|
10
+ config.use_transactional_fixtures = true
11
+ config.use_instantiated_fixtures = false
12
+ config.fixture_path = File.dirname(__FILE__) + "/fixtures/"
13
+ config.before(:each, :behaviour_type => :controller) do
14
+ raise_controller_errors
15
+ end
16
+
17
+ # You can declare fixtures for each behaviour like this:
18
+ # describe "...." do
19
+ # fixtures :table_a, :table_b
20
+ #
21
+ # Alternatively, if you prefer to declare them only once, you can
22
+ # do so here, like so ...
23
+ #
24
+ # config.global_fixtures = :table_a, :table_b
25
+ #
26
+ # If you declare global fixtures, be aware that they will be declared
27
+ # for all of your examples, even those that don't use them.
28
+ end