rhubarb 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,632 @@
1
+ # Test cases for Rhubarb, which is is a simple persistence layer for
2
+ # Ruby objects and SQLite.
3
+ #
4
+ # Copyright (c) 2009 Red Hat, Inc.
5
+ #
6
+ # Author: William Benton (willb@redhat.com)
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ require 'rhubarb/rhubarb'
15
+ require 'test/unit'
16
+
17
+ class TestClass
18
+ include Rhubarb::Persisting
19
+ declare_column :foo, :integer
20
+ declare_column :bar, :string
21
+ end
22
+
23
+ module RhubarbNamespace
24
+ class NMTC
25
+ include Rhubarb::Persisting
26
+ declare_column :foo, :integer
27
+ declare_column :bar, :string
28
+ end
29
+
30
+ class NMTC2
31
+ include Rhubarb::Persisting
32
+ declare_column :foo, :integer
33
+ declare_column :bar, :string
34
+ declare_table_name('namespacetestcase')
35
+ end
36
+ end
37
+
38
+ class TestClass2
39
+ include Rhubarb::Persisting
40
+ declare_column :fred, :integer
41
+ declare_column :barney, :string
42
+ declare_index_on :fred
43
+ end
44
+
45
+ class TC3
46
+ include Rhubarb::Persisting
47
+ declare_column :ugh, :datetime
48
+ declare_column :yikes, :integer
49
+ declare_constraint :yikes_pos, check("yikes >= 0")
50
+ end
51
+
52
+ class TC4
53
+ include Rhubarb::Persisting
54
+ declare_column :t1, :integer, references(TestClass)
55
+ declare_column :t2, :integer, references(TestClass2)
56
+ declare_column :enabled, :boolean, :default, :true
57
+ end
58
+
59
+ class SelfRef
60
+ include Rhubarb::Persisting
61
+ declare_column :one, :integer, references(SelfRef)
62
+ end
63
+
64
+ class CustomQueryTable
65
+ include Rhubarb::Persisting
66
+ declare_column :one, :integer
67
+ declare_column :two, :integer
68
+ declare_query :ltcols, "one < two"
69
+ declare_query :ltvars, "one < ? and two < ?"
70
+ declare_custom_query :cltvars, "select * from __TABLE__ where one < ? and two < ?"
71
+ end
72
+
73
+ class ToRef
74
+ include Rhubarb::Persisting
75
+ declare_column :foo, :string
76
+ end
77
+
78
+ class FromRef
79
+ include Rhubarb::Persisting
80
+ declare_column :t, :integer, references(ToRef, :on_delete=>:cascade)
81
+ end
82
+
83
+ class FreshTestTable
84
+ include Rhubarb::Persisting
85
+ declare_column :fee, :integer
86
+ declare_column :fie, :integer
87
+ declare_column :foe, :integer
88
+ declare_column :fum, :integer
89
+ end
90
+
91
+ class BackendBasicTests < Test::Unit::TestCase
92
+ def setup
93
+ Rhubarb::Persistence::open(":memory:")
94
+ klasses = []
95
+ klasses << TestClass
96
+ klasses << TestClass2
97
+ klasses << TC3
98
+ klasses << TC4
99
+ klasses << SelfRef
100
+ klasses << CustomQueryTable
101
+ klasses << ToRef
102
+ klasses << FromRef
103
+ klasses << FreshTestTable
104
+ klasses << RhubarbNamespace::NMTC
105
+ klasses << RhubarbNamespace::NMTC2
106
+
107
+ klasses.each { |klass| klass.create_table }
108
+
109
+ @flist = []
110
+ end
111
+
112
+ def teardown
113
+ Rhubarb::Persistence::close()
114
+ end
115
+
116
+ def test_persistence_setup
117
+ assert Rhubarb::Persistence::db.type_translation, "type translation not enabled for db"
118
+ assert Rhubarb::Persistence::db.results_as_hash, "rows-as-hashes not enabled for db"
119
+ end
120
+
121
+ def test_reference_ctor_klass
122
+ r = Rhubarb::Reference.new(TestClass)
123
+ assert(r.referent == TestClass, "Referent of managed reference instance incorrect")
124
+ assert(r.column == "row_id", "Column of managed reference instance incorrect")
125
+ assert(r.to_s == "references TestClass(row_id)", "string representation of managed reference instance incorrect")
126
+ assert(r.managed_ref?, "managed reference should return true for managed_ref?")
127
+ end
128
+
129
+ def test_namespace_table_name
130
+ assert_equal "nmtc", RhubarbNamespace::NMTC.table_name
131
+ end
132
+
133
+ def test_set_table_name
134
+ assert_equal "namespacetestcase", RhubarbNamespace::NMTC2.table_name
135
+ end
136
+
137
+ def test_reference_ctor_string
138
+ r = Rhubarb::Reference.new("TestClass")
139
+ assert(r.referent == "TestClass", "Referent of string-backed reference instance incorrect")
140
+ assert(r.column == "row_id", "Column of string-backed reference instance incorrect")
141
+ assert(r.to_s == "references TestClass(row_id)", "string representation of string-backed reference instance incorrect")
142
+ assert(r.managed_ref? == false, "unmanaged reference should return false for managed_ref?")
143
+ end
144
+
145
+ def test_instance_methods
146
+ ["foo", "bar"].each do |prefix|
147
+ ["#{prefix}", "#{prefix}="].each do |m|
148
+ assert TestClass.instance_methods.include?(m), "#{m} method not declared in TestClass"
149
+ end
150
+ end
151
+ end
152
+
153
+ def test_instance_methods2
154
+ ["fred", "barney"].each do |prefix|
155
+ ["#{prefix}", "#{prefix}="].each do |m|
156
+ assert TestClass2.instance_methods.include?(m), "#{m} method not declared in TestClass2"
157
+ end
158
+ end
159
+ end
160
+
161
+ def test_instance_methods_neg
162
+ ["fred", "barney"].each do |prefix|
163
+ ["#{prefix}", "#{prefix}="].each do |m|
164
+ bogus_include = TestClass.instance_methods.include? m
165
+ assert(bogus_include == false, "#{m} method declared in TestClass; shouldn't be")
166
+ end
167
+ end
168
+ end
169
+
170
+ def test_instance_methods_dont_include_class_methods
171
+ ["foo", "bar"].each do |prefix|
172
+ ["find_by_#{prefix}", "find_first_by_#{prefix}"].each do |m|
173
+ bogus_include = TestClass.instance_methods.include? m
174
+ assert(bogus_include == false, "#{m} method declared in TestClass; shouldn't be")
175
+ end
176
+ end
177
+ end
178
+
179
+ def test_class_methods
180
+ ["foo", "bar"].each do |prefix|
181
+ ["find_by_#{prefix}", "find_first_by_#{prefix}"].each do |m|
182
+ klass = class << TestClass; self end
183
+ assert klass.instance_methods.include?(m), "#{m} method not declared in TestClass' eigenclass"
184
+ end
185
+ end
186
+ end
187
+
188
+ def test_class_methods2
189
+ ["fred", "barney"].each do |prefix|
190
+ ["find_by_#{prefix}", "find_first_by_#{prefix}"].each do |m|
191
+ klass = class << TestClass2; self end
192
+ assert klass.instance_methods.include?(m), "#{m} method not declared in TestClass2's eigenclass"
193
+ end
194
+ end
195
+ end
196
+
197
+ def test_table_class_methods_neg
198
+ ["foo", "bar", "fred", "barney"].each do |prefix|
199
+ ["find_by_#{prefix}", "find_first_by_#{prefix}"].each do |m|
200
+ klass = Class.new
201
+
202
+ klass.class_eval do
203
+ include Rhubarb::Persisting
204
+ end
205
+
206
+ bogus_include = klass.instance_methods.include?(m)
207
+ assert(bogus_include == false, "#{m} method declared in eigenclass of class including Rhubarb::Persisting; shouldn't be")
208
+ end
209
+ end
210
+ end
211
+
212
+ def test_class_methods_neg
213
+ ["fred", "barney"].each do |prefix|
214
+ ["find_by_#{prefix}", "find_first_by_#{prefix}"].each do |m|
215
+ klass = class << TestClass; self end
216
+ bogus_include = klass.instance_methods.include?(m)
217
+ assert(bogus_include == false, "#{m} method declared in TestClass' eigenclass; shouldn't be")
218
+ end
219
+ end
220
+ end
221
+
222
+ def test_column_size
223
+ assert(TestClass.columns.size == 5, "TestClass has wrong number of columns")
224
+ end
225
+
226
+ def test_tc2_column_size
227
+ assert(TestClass2.columns.size == 5, "TestClass2 has wrong number of columns")
228
+ end
229
+
230
+ def test_table_column_size
231
+ klass = Class.new
232
+ klass.class_eval do
233
+ include Rhubarb::Persisting
234
+ end
235
+ if klass.respond_to? :columns
236
+ assert(Frotz.columns.size == 0, "A persisting class with no declared columns has the wrong number of columns")
237
+ end
238
+ end
239
+
240
+ def test_constraints_size
241
+ k = Class.new
242
+
243
+ k.class_eval do
244
+ include Rhubarb::Persisting
245
+ end
246
+
247
+ {k => 0, TestClass => 0, TestClass2 => 0, TC3 => 1}.each do |klass, cts|
248
+ if klass.respond_to? :constraints
249
+ assert(klass.constraints.size == cts, "#{klass} has wrong number of constraints")
250
+ end
251
+ end
252
+ end
253
+
254
+ def test_cols_and_constraints_understood
255
+ [TestClass, TestClass2, TC3, TC4].each do |klass|
256
+ assert(klass.respond_to?(:constraints), "#{klass} should have accessor for constraints")
257
+ assert(klass.respond_to?(:columns), "#{klass} should have accessor for columns")
258
+ end
259
+ end
260
+
261
+ def test_column_contents
262
+ [:row_id, :foo, :bar].each do |col|
263
+ assert(TestClass.columns.map{|c| c.name}.include?(col), "TestClass doesn't contain column #{col}")
264
+ end
265
+ end
266
+
267
+ def test_create_proper_type
268
+ tc = TestClass.create(:foo => 1, :bar => "argh")
269
+ assert(tc.class == TestClass, "TestClass.create should return an instance of TestClass")
270
+ end
271
+
272
+ def test_create_multiples
273
+ tc_list = [nil]
274
+ 1.upto(9) do |num|
275
+ tc_list.push TestClass.create(:foo => num, :bar => "argh#{num}")
276
+ end
277
+
278
+ 1.upto(9) do |num|
279
+ assert(tc_list[num].foo == num, "multiple TestClass.create invocations should return records with proper foo values")
280
+ assert(tc_list[num].bar == "argh#{num}", "multiple TestClass.create invocations should return records with proper bar values")
281
+
282
+ tmp = TestClass.find(num)
283
+
284
+ assert(tmp.foo == num, "multiple TestClass.create invocations should add records with proper foo values to the db")
285
+ assert(tmp.bar == "argh#{num}", "multiple TestClass.create invocations should add records with proper bar values to the db")
286
+ end
287
+ end
288
+
289
+ def test_delete
290
+ range = []
291
+ 1.upto(9) do |num|
292
+ range << num
293
+ TestClass.create(:foo => num, :bar => "argh#{num}")
294
+ end
295
+
296
+ assert(TestClass.count == range.size, "correct number of rows inserted prior to delete")
297
+
298
+ TestClass.find(2).delete
299
+
300
+ assert(TestClass.count == range.size - 1, "correct number of rows inserted after delete")
301
+ end
302
+
303
+ def test_delete_2
304
+ TestClass.create(:foo => 42, :bar => "Wait, what was the question?")
305
+ tc1 = TestClass.find_first_by_foo(42)
306
+ tc2 = TestClass.find_first_by_foo(42)
307
+
308
+ [tc1,tc2].each do |obj|
309
+ assert obj
310
+ assert_kind_of TestClass, obj
311
+ assert_equal false, obj.instance_eval {needs_refresh?}
312
+ end
313
+
314
+ [:foo, :bar, :row_id].each do |msg|
315
+ assert_equal tc1.send(msg), tc2.send(msg)
316
+ end
317
+
318
+ tc1.delete
319
+
320
+ tc3 = TestClass.find_by_foo(42)
321
+ assert_equal [], tc3
322
+
323
+ tc3 = TestClass.find_first_by_foo(42)
324
+ assert_equal nil, tc3
325
+
326
+ [tc1, tc2].each do |obj|
327
+ assert obj.deleted?
328
+ [:foo, :bar, :row_id].each do |msg|
329
+ assert_equal nil, obj.send(msg)
330
+ end
331
+ end
332
+ end
333
+
334
+ def test_count_base
335
+ assert(TestClass.count == 0, "a new table should have no rows")
336
+ end
337
+
338
+ def test_count_inc
339
+ 1.upto(9) do |num|
340
+ TestClass.create(:foo => num, :bar => "argh#{num}")
341
+ assert(TestClass.count == num, "table row count should increment after each row create")
342
+ end
343
+ end
344
+
345
+ def test_create_proper_values
346
+ vals = {:foo => 1, :bar => "argh"}
347
+ tc = TestClass.create(vals)
348
+ assert(tc.foo == 1, "tc.foo (newly-created) should have the value 1")
349
+ assert(tc.bar == "argh", "tc.bar (newly-created) should have the value \"argh\"")
350
+ end
351
+
352
+ def test_create_and_find_by_id
353
+ vals = {:foo => 2, :bar => "argh"}
354
+ TestClass.create(vals)
355
+
356
+ tc = TestClass.find(1)
357
+ assert(tc.foo == 2, "tc.foo (found by id) should have the value 2")
358
+ assert(tc.bar == "argh", "tc.bar (found by id) should have the value \"argh\"")
359
+ end
360
+
361
+ def test_find_by_id_bogus
362
+ tc = TestClass.find(1)
363
+ assert(tc == nil, "TestClass table should be empty")
364
+ end
365
+
366
+ def test_create_and_find_by_foo
367
+ vals = {:foo => 2, :bar => "argh"}
368
+ TestClass.create(vals)
369
+
370
+ result = TestClass.find_by_foo(2)
371
+ tc = result[0]
372
+ assert(result.size == 1, "TestClass.find_by_foo(2) should return exactly one result")
373
+ assert(tc.foo == 2, "tc.foo (found by foo) should have the value 2")
374
+ assert(tc.bar == "argh", "tc.bar (found by foo) should have the value \"argh\"")
375
+ end
376
+
377
+ def test_create_and_find_first_by_foo
378
+ vals = {:foo => 2, :bar => "argh"}
379
+ TestClass.create(vals)
380
+
381
+ tc = (TestClass.find_first_by_foo(2))
382
+ assert(tc.foo == 2, "tc.foo (found by foo) should have the value 2")
383
+ assert(tc.bar == "argh", "tc.bar (found by foo) should have the value \"argh\"")
384
+ end
385
+
386
+ def test_create_and_find_by_bar
387
+ vals = {:foo => 2, :bar => "argh"}
388
+ TestClass.create(vals)
389
+ result = TestClass.find_by_bar("argh")
390
+ tc = result[0]
391
+ assert(result.size == 1, "TestClass.find_by_bar(\"argh\") should return exactly one result")
392
+ assert(tc.foo == 2, "tc.foo (found by bar) should have the value 2")
393
+ assert(tc.bar == "argh", "tc.bar (found by bar) should have the value \"argh\"")
394
+ end
395
+
396
+ def test_create_and_find_first_by_bar
397
+ vals = {:foo => 2, :bar => "argh"}
398
+ TestClass.create(vals)
399
+
400
+ tc = (TestClass.find_first_by_bar("argh"))
401
+ assert(tc.foo == 2, "tc.foo (found by bar) should have the value 2")
402
+ assert(tc.bar == "argh", "tc.bar (found by bar) should have the value \"argh\"")
403
+ end
404
+
405
+ def test_create_and_update_modifies_object
406
+ vals = {:foo => 1, :bar => "argh"}
407
+ TestClass.create(vals)
408
+
409
+ tc = TestClass.find(1)
410
+ tc.foo = 2
411
+ assert("#{tc.foo}" == "2", "tc.foo should have the value 2 after modifying object")
412
+ end
413
+
414
+ def test_create_and_update_modifies_db
415
+ vals = {:foo => 1, :bar => "argh"}
416
+ TestClass.create(vals)
417
+
418
+ tc = TestClass.find(1)
419
+ tc.foo = 2
420
+
421
+ tc_fresh = TestClass.find(1)
422
+ assert(tc_fresh.foo == 2, "foo value in first row of db should have the value 2 after modifying tc object")
423
+ end
424
+
425
+ def test_create_and_update_freshen
426
+ vals = {:foo => 1, :bar => "argh"}
427
+ TestClass.create(vals)
428
+
429
+ tc_fresh = TestClass.find(1)
430
+ tc = TestClass.find(1)
431
+
432
+ tc.foo = 2
433
+
434
+ assert(tc_fresh.foo == 2, "object backed by db row isn't freshened")
435
+ end
436
+
437
+ def test_reference_tables
438
+ assert(TC4.refs.size == 2, "TC4 should have 2 refs, instead has #{TC4.refs.size}")
439
+ end
440
+
441
+ def test_reference_classes
442
+ t_vals = []
443
+ t2_vals = []
444
+
445
+ 1.upto(9) do |n|
446
+ t_vals.push({:foo => n, :bar => "item-#{n}"})
447
+ TestClass.create t_vals[-1]
448
+ end
449
+
450
+ 9.downto(1) do |n|
451
+ t2_vals.push({:fred => n, :barney => "barney #{n}"})
452
+ TestClass2.create t2_vals[-1]
453
+ end
454
+
455
+ 1.upto(9) do |n|
456
+ m = 10-n
457
+ k = TC4.create(:t1 => n, :t2 => m)
458
+ assert(k.t1.class == TestClass, "k.t1.class is #{k.t1.class}; should be TestClass")
459
+ assert(k.t2.class == TestClass2, "k.t2.class is #{k.t2.class}; should be TestClass2")
460
+ assert(k.enabled)
461
+ k.enabled = false
462
+ assert(k.enabled==false)
463
+ end
464
+ end
465
+
466
+ def test_references_simple
467
+ t_vals = []
468
+ t2_vals = []
469
+
470
+ 1.upto(9) do |n|
471
+ t_vals.push({:foo => n, :bar => "item-#{n}"})
472
+ TestClass.create t_vals[-1]
473
+ end
474
+
475
+ 9.downto(1) do |n|
476
+ t2_vals.push({:fred => n, :barney => "barney #{n}"})
477
+ TestClass2.create t2_vals[-1]
478
+ end
479
+
480
+ 1.upto(9) do |n|
481
+ k = TC4.create(:t1 => n, :t2 => (10 - n))
482
+ assert(k.t1.foo == k.t2.fred, "references don't work")
483
+ end
484
+ end
485
+
486
+ def test_references_sameclass
487
+ SelfRef.create :one => nil
488
+ 1.upto(3) do |num|
489
+ SelfRef.create :one => num
490
+ end
491
+ 4.downto(2) do |num|
492
+ sr = SelfRef.find num
493
+ assert(sr.one.class == SelfRef, "SelfRef with row ID #{num} should have a one field of type SelfRef; is #{sr.one.class} instead")
494
+ assert(sr.one.row_id == sr.row_id - 1, "SelfRef with row ID #{num} should have a one field with a row id of #{sr.row_id - 1}; is #{sr.one.row_id} instead")
495
+ end
496
+ end
497
+
498
+ def test_references_circular_id
499
+ sr = SelfRef.create :one => nil
500
+ sr.one = sr.row_id
501
+ assert(sr == sr.one, "self-referential rows should work; instead #{sr} isn't the same as #{sr.one}")
502
+ end
503
+
504
+ def test_references_circular_obj
505
+ sr = SelfRef.create :one => nil
506
+ sr.one = sr
507
+ assert(sr == sr.one, "self-referential rows should work; instead #{sr} isn't the same as #{sr.one}")
508
+ end
509
+
510
+ def test_referential_integrity
511
+ assert_raise SQLite3::SQLException do
512
+ FromRef.create(:t => 42)
513
+ end
514
+
515
+ assert_nothing_thrown do
516
+ 1.upto(20) do |x|
517
+ ToRef.create(:foo => "#{x}")
518
+ FromRef.create(:t => x)
519
+ assert_equal ToRef.count, FromRef.count
520
+ end
521
+ end
522
+
523
+ 20.downto(1) do |x|
524
+ ct = ToRef.count
525
+ tr = ToRef.find(x)
526
+ tr.delete
527
+ assert_equal ToRef.count, ct - 1
528
+ assert_equal ToRef.count, FromRef.count
529
+ end
530
+ end
531
+
532
+ def test_custom_query
533
+ colresult = 0
534
+ varresult = 0
535
+
536
+ 1.upto(20) do |i|
537
+ 1.upto(20) do |j|
538
+ CustomQueryTable.create(:one => i, :two => j)
539
+ colresult = colresult.succ if i < j
540
+ varresult = varresult.succ if i < 5 && j < 7
541
+ end
542
+ end
543
+
544
+ f = CustomQueryTable.ltcols
545
+ assert(f.size() == colresult, "f.size() should equal colresult, but #{f.size()} != #{colresult}")
546
+ f.each {|r| assert(r.one < r.two, "#{r.one}, #{r.two} should only be in ltcols custom query if #{r.one} < #{r.two}") }
547
+
548
+ f = CustomQueryTable.ltvars 5, 7
549
+ f2 = CustomQueryTable.cltvars 5, 7
550
+
551
+ [f,f2].each do |obj|
552
+ assert(obj.size() == varresult, "query result size should equal varresult, but #{obj.size()} != #{varresult}")
553
+ obj.each {|r| assert(r.one < 5 && r.two < 7, "#{r.one}, #{r.two} should only be in ltvars/cltvars custom query if #{r.one} < 5 && #{r.two} < 7") }
554
+ end
555
+
556
+ end
557
+
558
+ def freshness_query_fixture
559
+ @flist = []
560
+
561
+ 0.upto(99) do |x|
562
+ @flist << FreshTestTable.create(:fee=>x, :fie=>(x%7), :foe=>(x%11), :fum=>(x%13))
563
+ end
564
+ end
565
+
566
+ def test_freshness_query_basic
567
+ freshness_query_fixture
568
+ # basic test
569
+ basic = FreshTestTable.find_freshest(:group_by=>[:fee])
570
+
571
+ assert_equal(@flist.size, basic.size)
572
+ 0.upto(99) do |x|
573
+ [:fee,:fie,:foe,:fum,:created,:updated,:row_id].each do |msg|
574
+ assert_equal(@flist[x].send(msg), basic[x].send(msg))
575
+ end
576
+ end
577
+ end
578
+
579
+ def test_freshness_query_basic_restricted
580
+ freshness_query_fixture
581
+ # basic test
582
+
583
+ basic = FreshTestTable.find_freshest(:group_by=>[:fee], :version=>@flist[30].created, :debug=>true)
584
+
585
+ assert_equal(31, basic.size)
586
+ 0.upto(30) do |x|
587
+ [:fee,:fie,:foe,:fum,:created,:updated,:row_id].each do |msg|
588
+ assert_equal(@flist[x].send(msg), basic[x].send(msg))
589
+ end
590
+ end
591
+ end
592
+
593
+ def test_freshness_query_basic_select
594
+ freshness_query_fixture
595
+ # basic test
596
+
597
+ basic = FreshTestTable.find_freshest(:group_by=>[:fee], :select_by=>{:fie=>0}, :debug=>true)
598
+
599
+ expected_ct = 99/7 + 1;
600
+
601
+ assert_equal(expected_ct, basic.size)
602
+
603
+ 0.upto(expected_ct - 1) do |x|
604
+ [:fee,:fie,:foe,:fum,:created,:updated,:row_id].each do |msg|
605
+ assert_equal(@flist[x*7].send(msg), basic[x].send(msg))
606
+ end
607
+ end
608
+ end
609
+
610
+ def test_freshness_query_group_single
611
+ freshness_query_fixture
612
+ # more basic tests
613
+ pairs = {:fie=>7,:foe=>11,:fum=>13}
614
+ pairs.each do |col,ct|
615
+ basic = FreshTestTable.find_freshest(:group_by=>[col])
616
+ assert_equal(ct,basic.size)
617
+
618
+ expected_objs = {}
619
+
620
+ 99.downto(99-ct+1) do |x|
621
+ expected_objs[x%ct] = @flist[x]
622
+ end
623
+
624
+ basic.each do |row|
625
+ res = expected_objs[row.send(col)]
626
+ [:fee,:fie,:foe,:fum,:created,:updated,:row_id].each do |msg|
627
+ assert_equal(res.send(msg), row.send(msg))
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rhubarb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - William Benton
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-02 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.9
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3-ruby
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.2
34
+ version:
35
+ description: Rhubarb is a simple object-graph persistence library implemented as a mixin. It also works with the SPQR library for straightforward object publishing over QMF.
36
+ email: willb@redhat.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ - TODO
45
+ files:
46
+ - .document
47
+ - .gitignore
48
+ - CHANGES
49
+ - LICENSE
50
+ - README.rdoc
51
+ - Rakefile
52
+ - TODO
53
+ - VERSION
54
+ - lib/rhubarb/rhubarb.rb
55
+ - test/helper.rb
56
+ - test/test_rhubarb.rb
57
+ has_rdoc: true
58
+ homepage: http://git.fedorahosted.org/git/grid/rhubarb.git
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --charset=UTF-8
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ version:
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ requirements: []
79
+
80
+ rubyforge_project:
81
+ rubygems_version: 1.3.5
82
+ signing_key:
83
+ specification_version: 3
84
+ summary: "Rhubarb: object graph persistence, easy as pie"
85
+ test_files:
86
+ - test/helper.rb
87
+ - test/test_rhubarb.rb