has_mock_objects 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -5,7 +5,7 @@ After reading Practical Object-Oriented Design in Ruby: An Agile Primer by Sandi
5
5
 
6
6
  I wanted a very simple syntax for saying, "I know I will want this object to the associated with this other thing, but I don't yet know what columns or methods it will really need." Also known as the Fake-It-Until-You-Make-It method.
7
7
 
8
- I also wanted soemthing very simple to search for ina project tops ee where and how it is being used, since something like this is only useful at early staginges and would be replaced over time with the actual implementation of the things it is faking.
8
+ I also wanted something very simple to search for in a project top see where and how it is being used, since something like this is only useful at early stages and would be replaced over time with the actual implementation of the things it is faking.
9
9
 
10
10
  Installation
11
11
  -----------
@@ -22,9 +22,10 @@ Call the method has_mock_objects in any ActiveRecord model. That will add two me
22
22
 
23
23
  attr_accessible :description, :title
24
24
 
25
- has_many_mocks :chapters, 5, title: :words, content: :paragraphs
26
- has_many_mocks :testimonials, 10, testify: :words
27
- has_one_mock :author, name: :name, email: :email
25
+ has_many_mocks :chapters, 5, title: :words, content: :paragraphs #returns 0 to 5 Chapters
26
+ has_many_mocks :testimonials, 10, testify: :words #returns 0 to 10 Testimonials
27
+ has_one_mock :author, name: :name, email: :email #returns 1 Author
28
+ has_many_mocks :bibliographies, 4..5, name: :words, content: :paragraph #returns 4 to 5 Bibliographies
28
29
 
29
30
  validates :title, presence: true, uniqueness: true
30
31
 
@@ -32,7 +33,7 @@ Call the method has_mock_objects in any ActiveRecord model. That will add two me
32
33
 
33
34
  Any instance of Book would respond to chapters, returning an array of OpenStruct Chapter objects, randomly generatingfrom 0 up to 5 of them, and they would each have a title attribute and content, with each of those generated by Faker using the methods specified.
34
35
 
35
- This makes it possible to do this ina view:
36
+ This makes it possible to do this in a view:
36
37
 
37
38
  <h2>Chapters(<%= @book.chapters.count %>)</h2>
38
39
  <ul>
@@ -48,7 +49,7 @@ And since the chapters are stored in an attribute on the instance the @book.chap
48
49
 
49
50
  The call to has_one_mock works similarly, but always returns a single OpenStruct object (no chance of nil).
50
51
 
51
- Not every Faker method is currently supported. In an effort to simply the syntax as much as possible, a constant is defined for these methods with their corresponding Faker equivalent:
52
+ Not every Faker method is currently supported. In an effort to simplify the syntax as much as possible, a constant is defined for these methods with their corresponding Faker equivalent:
52
53
 
53
54
  word: Faker::Lorem.word
54
55
  words: Faker::Lorem.words.join(' ')
@@ -64,8 +65,13 @@ Not every Faker method is currently supported. In an effort to simply the syntax
64
65
  credit_card_number: Faker::Business.credit_card_number
65
66
  credit_card_type: Faker::Business.credit_card_type
66
67
 
67
- ##TODO:
68
- Allow has_many_mocks to use a range, so rather than always being 0 to x it could be more specific and always return 2..5 objects for example.
68
+ Additionally, methods to return Time Objects have been added:
69
+
70
+ today: always returns Time.now
71
+ recent_date: Returns a Time Object set sometime within the last year
72
+ historical_date: Returns a Time Object set sometime within the last decade
73
+
74
+
69
75
 
70
76
  ## License
71
77
 
@@ -2,6 +2,7 @@ require 'ostruct'
2
2
  require 'faker'
3
3
 
4
4
  module HasMockObjects
5
+ SECONDS_IN_YEAR = 31536000
5
6
  extend ActiveSupport::Concern
6
7
 
7
8
  def has_mock_objects
@@ -25,7 +26,10 @@ module HasMockObjects
25
26
  phone_number: lambda { Faker::PhoneNumber.phone_number },
26
27
  email: lambda { Faker::Internet.email },
27
28
  credit_card_number: lambda { Faker::Business.credit_card_number },
28
- credit_card_type: lambda { Faker::Business.credit_card_type }
29
+ credit_card_type: lambda { Faker::Business.credit_card_type },
30
+ today: lambda { Time.now },
31
+ recent_date: lambda { Time.now - rand(HasMockObjects::SECONDS_IN_YEAR) },
32
+ historical_date: lambda { Time.now - rand(HasMockObjects::SECONDS_IN_YEAR*10) }
29
33
  }
30
34
 
31
35
  def mock_attributes(attributes)
@@ -1,3 +1,3 @@
1
1
  module HasMockObjects
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -3,6 +3,7 @@ class Book < ActiveRecord::Base
3
3
 
4
4
  attr_accessible :title
5
5
 
6
- has_many_mocks :chapters, 5, title: :words, content: :paragraphs
7
- has_one_mock :author, name: :name, email: :email
6
+ has_many_mocks :chapters, 5, title: :words, content: :paragraphs, written: :recent_date
7
+ has_one_mock :author, name: :name, email: :email, born: :historical_date
8
+ has_many_mocks :bibliographies, 4..5, name: :words, content: :paragraph
8
9
  end
@@ -125,3 +125,500 @@ Connecting to database specified by database.yml
125
125
   (0.0ms) rollback transaction
126
126
   (0.0ms) begin transaction
127
127
   (0.0ms) rollback transaction
128
+ Connecting to database specified by database.yml
129
+  (0.5ms) begin transaction
130
+  (0.1ms) rollback transaction
131
+  (0.1ms) begin transaction
132
+  (0.1ms) rollback transaction
133
+  (0.0ms) begin transaction
134
+  (0.1ms) rollback transaction
135
+  (0.0ms) begin transaction
136
+  (0.0ms) rollback transaction
137
+  (0.0ms) begin transaction
138
+  (0.0ms) rollback transaction
139
+ Connecting to database specified by database.yml
140
+  (0.4ms) begin transaction
141
+  (0.1ms) rollback transaction
142
+  (0.0ms) begin transaction
143
+  (0.0ms) rollback transaction
144
+  (0.0ms) begin transaction
145
+  (0.0ms) rollback transaction
146
+  (0.0ms) begin transaction
147
+  (0.1ms) rollback transaction
148
+  (0.0ms) begin transaction
149
+  (0.0ms) rollback transaction
150
+  (0.0ms) begin transaction
151
+  (0.0ms) rollback transaction
152
+ Connecting to database specified by database.yml
153
+  (0.4ms) begin transaction
154
+  (0.1ms) rollback transaction
155
+  (0.0ms) begin transaction
156
+  (0.0ms) rollback transaction
157
+  (0.0ms) begin transaction
158
+  (0.0ms) rollback transaction
159
+  (0.0ms) begin transaction
160
+  (0.1ms) rollback transaction
161
+  (0.0ms) begin transaction
162
+  (0.0ms) rollback transaction
163
+  (0.0ms) begin transaction
164
+  (0.0ms) rollback transaction
165
+ Connecting to database specified by database.yml
166
+  (0.5ms) begin transaction
167
+  (0.1ms) rollback transaction
168
+  (0.0ms) begin transaction
169
+  (0.0ms) rollback transaction
170
+  (0.0ms) begin transaction
171
+  (0.0ms) rollback transaction
172
+  (0.1ms) begin transaction
173
+  (0.1ms) rollback transaction
174
+  (0.0ms) begin transaction
175
+  (0.0ms) rollback transaction
176
+  (0.0ms) begin transaction
177
+  (0.0ms) rollback transaction
178
+ Connecting to database specified by database.yml
179
+  (0.4ms) begin transaction
180
+  (0.1ms) rollback transaction
181
+  (0.0ms) begin transaction
182
+  (0.0ms) rollback transaction
183
+  (0.0ms) begin transaction
184
+  (0.0ms) rollback transaction
185
+  (0.0ms) begin transaction
186
+  (0.1ms) rollback transaction
187
+  (0.0ms) begin transaction
188
+  (0.0ms) rollback transaction
189
+  (0.0ms) begin transaction
190
+  (0.0ms) rollback transaction
191
+ Connecting to database specified by database.yml
192
+  (0.4ms) begin transaction
193
+  (0.1ms) rollback transaction
194
+  (0.1ms) begin transaction
195
+  (0.1ms) rollback transaction
196
+  (0.0ms) begin transaction
197
+  (0.1ms) rollback transaction
198
+  (0.0ms) begin transaction
199
+  (0.1ms) rollback transaction
200
+  (0.0ms) begin transaction
201
+  (0.0ms) rollback transaction
202
+  (0.0ms) begin transaction
203
+  (0.0ms) rollback transaction
204
+ Connecting to database specified by database.yml
205
+  (0.6ms) begin transaction
206
+  (0.1ms) rollback transaction
207
+  (0.0ms) begin transaction
208
+  (0.0ms) rollback transaction
209
+  (0.0ms) begin transaction
210
+  (0.0ms) rollback transaction
211
+  (0.0ms) begin transaction
212
+  (0.1ms) rollback transaction
213
+  (0.0ms) begin transaction
214
+  (0.0ms) rollback transaction
215
+  (0.0ms) begin transaction
216
+  (0.0ms) rollback transaction
217
+ Connecting to database specified by database.yml
218
+  (0.4ms) begin transaction
219
+  (0.1ms) rollback transaction
220
+  (0.0ms) begin transaction
221
+  (0.0ms) rollback transaction
222
+  (0.0ms) begin transaction
223
+  (0.0ms) rollback transaction
224
+  (0.0ms) begin transaction
225
+  (0.1ms) rollback transaction
226
+  (0.0ms) begin transaction
227
+  (0.0ms) rollback transaction
228
+  (0.0ms) begin transaction
229
+  (0.0ms) rollback transaction
230
+ Connecting to database specified by database.yml
231
+  (0.5ms) begin transaction
232
+  (0.1ms) rollback transaction
233
+  (0.0ms) begin transaction
234
+  (0.0ms) rollback transaction
235
+  (0.0ms) begin transaction
236
+  (0.0ms) rollback transaction
237
+  (0.0ms) begin transaction
238
+  (0.1ms) rollback transaction
239
+  (0.0ms) begin transaction
240
+  (0.0ms) rollback transaction
241
+  (0.0ms) begin transaction
242
+  (0.0ms) rollback transaction
243
+ Connecting to database specified by database.yml
244
+  (0.5ms) begin transaction
245
+  (0.1ms) rollback transaction
246
+  (0.0ms) begin transaction
247
+  (0.0ms) rollback transaction
248
+  (0.0ms) begin transaction
249
+  (0.0ms) rollback transaction
250
+  (0.0ms) begin transaction
251
+  (0.1ms) rollback transaction
252
+  (0.0ms) begin transaction
253
+  (0.0ms) rollback transaction
254
+  (0.0ms) begin transaction
255
+  (0.0ms) rollback transaction
256
+ Connecting to database specified by database.yml
257
+  (0.4ms) begin transaction
258
+  (0.1ms) rollback transaction
259
+  (0.0ms) begin transaction
260
+  (0.0ms) rollback transaction
261
+  (0.0ms) begin transaction
262
+  (0.1ms) rollback transaction
263
+  (0.1ms) begin transaction
264
+  (0.1ms) rollback transaction
265
+  (0.0ms) begin transaction
266
+  (0.0ms) rollback transaction
267
+  (0.0ms) begin transaction
268
+  (0.0ms) rollback transaction
269
+ Connecting to database specified by database.yml
270
+  (0.4ms) begin transaction
271
+  (0.1ms) rollback transaction
272
+  (0.0ms) begin transaction
273
+  (0.0ms) rollback transaction
274
+  (0.0ms) begin transaction
275
+  (0.0ms) rollback transaction
276
+  (0.0ms) begin transaction
277
+  (0.1ms) rollback transaction
278
+  (0.0ms) begin transaction
279
+  (0.0ms) rollback transaction
280
+  (0.0ms) begin transaction
281
+  (0.0ms) rollback transaction
282
+ Connecting to database specified by database.yml
283
+  (0.7ms) begin transaction
284
+  (0.1ms) rollback transaction
285
+  (0.0ms) begin transaction
286
+  (0.0ms) rollback transaction
287
+  (0.0ms) begin transaction
288
+  (0.0ms) rollback transaction
289
+  (0.0ms) begin transaction
290
+  (0.1ms) rollback transaction
291
+  (0.0ms) begin transaction
292
+  (0.0ms) rollback transaction
293
+  (0.0ms) begin transaction
294
+  (0.0ms) rollback transaction
295
+ Connecting to database specified by database.yml
296
+  (0.4ms) begin transaction
297
+  (0.1ms) rollback transaction
298
+  (0.0ms) begin transaction
299
+  (0.0ms) rollback transaction
300
+  (0.0ms) begin transaction
301
+  (0.0ms) rollback transaction
302
+  (0.0ms) begin transaction
303
+  (0.0ms) rollback transaction
304
+  (0.0ms) begin transaction
305
+  (0.1ms) rollback transaction
306
+  (0.0ms) begin transaction
307
+  (0.0ms) rollback transaction
308
+  (0.0ms) begin transaction
309
+  (0.0ms) rollback transaction
310
+ Connecting to database specified by database.yml
311
+  (0.4ms) begin transaction
312
+  (0.1ms) rollback transaction
313
+  (0.0ms) begin transaction
314
+  (0.0ms) rollback transaction
315
+  (0.0ms) begin transaction
316
+  (0.0ms) rollback transaction
317
+  (0.0ms) begin transaction
318
+  (0.0ms) rollback transaction
319
+  (0.0ms) begin transaction
320
+  (0.1ms) rollback transaction
321
+  (0.0ms) begin transaction
322
+  (0.0ms) rollback transaction
323
+  (0.0ms) begin transaction
324
+  (0.0ms) rollback transaction
325
+ Connecting to database specified by database.yml
326
+  (0.6ms) begin transaction
327
+  (0.1ms) rollback transaction
328
+  (0.0ms) begin transaction
329
+  (0.0ms) rollback transaction
330
+  (0.0ms) begin transaction
331
+  (0.0ms) rollback transaction
332
+  (0.0ms) begin transaction
333
+  (0.0ms) rollback transaction
334
+  (0.0ms) begin transaction
335
+  (0.1ms) rollback transaction
336
+  (0.0ms) begin transaction
337
+  (0.0ms) rollback transaction
338
+  (0.0ms) begin transaction
339
+  (0.0ms) rollback transaction
340
+ Connecting to database specified by database.yml
341
+  (0.4ms) begin transaction
342
+  (0.1ms) rollback transaction
343
+  (0.0ms) begin transaction
344
+  (0.0ms) rollback transaction
345
+  (0.0ms) begin transaction
346
+  (0.0ms) rollback transaction
347
+  (0.0ms) begin transaction
348
+  (0.0ms) rollback transaction
349
+  (0.0ms) begin transaction
350
+  (0.1ms) rollback transaction
351
+  (0.0ms) begin transaction
352
+  (0.0ms) rollback transaction
353
+  (0.0ms) begin transaction
354
+  (0.0ms) rollback transaction
355
+ Connecting to database specified by database.yml
356
+  (0.5ms) begin transaction
357
+  (0.1ms) rollback transaction
358
+  (0.1ms) begin transaction
359
+  (0.0ms) rollback transaction
360
+  (0.0ms) begin transaction
361
+  (0.1ms) rollback transaction
362
+  (0.1ms) begin transaction
363
+  (0.1ms) rollback transaction
364
+  (0.0ms) begin transaction
365
+  (0.1ms) rollback transaction
366
+  (0.1ms) begin transaction
367
+  (0.0ms) rollback transaction
368
+  (0.0ms) begin transaction
369
+  (0.0ms) rollback transaction
370
+ Connecting to database specified by database.yml
371
+  (0.4ms) begin transaction
372
+  (0.1ms) rollback transaction
373
+  (0.1ms) begin transaction
374
+  (0.0ms) rollback transaction
375
+  (0.0ms) begin transaction
376
+  (0.1ms) rollback transaction
377
+  (0.0ms) begin transaction
378
+  (0.0ms) rollback transaction
379
+  (0.0ms) begin transaction
380
+  (0.1ms) rollback transaction
381
+  (0.0ms) begin transaction
382
+  (0.0ms) rollback transaction
383
+  (0.0ms) begin transaction
384
+  (0.1ms) rollback transaction
385
+ Connecting to database specified by database.yml
386
+  (0.6ms) begin transaction
387
+  (0.1ms) rollback transaction
388
+  (0.0ms) begin transaction
389
+  (0.0ms) rollback transaction
390
+  (0.0ms) begin transaction
391
+  (0.0ms) rollback transaction
392
+  (0.0ms) begin transaction
393
+  (0.0ms) rollback transaction
394
+  (0.0ms) begin transaction
395
+  (0.1ms) rollback transaction
396
+  (0.0ms) begin transaction
397
+  (0.0ms) rollback transaction
398
+  (0.0ms) begin transaction
399
+  (0.0ms) rollback transaction
400
+ Connecting to database specified by database.yml
401
+  (0.5ms) begin transaction
402
+  (0.1ms) rollback transaction
403
+  (0.1ms) begin transaction
404
+  (0.0ms) rollback transaction
405
+  (0.0ms) begin transaction
406
+  (0.0ms) rollback transaction
407
+  (0.0ms) begin transaction
408
+  (0.0ms) rollback transaction
409
+  (0.0ms) begin transaction
410
+  (0.1ms) rollback transaction
411
+  (0.0ms) begin transaction
412
+  (0.0ms) rollback transaction
413
+  (0.0ms) begin transaction
414
+  (0.0ms) rollback transaction
415
+ Connecting to database specified by database.yml
416
+  (0.4ms) begin transaction
417
+  (0.1ms) rollback transaction
418
+  (0.0ms) begin transaction
419
+  (0.0ms) rollback transaction
420
+  (0.0ms) begin transaction
421
+  (0.0ms) rollback transaction
422
+  (0.0ms) begin transaction
423
+  (0.0ms) rollback transaction
424
+  (0.0ms) begin transaction
425
+  (0.1ms) rollback transaction
426
+  (0.0ms) begin transaction
427
+  (0.0ms) rollback transaction
428
+  (0.0ms) begin transaction
429
+  (0.0ms) rollback transaction
430
+ Connecting to database specified by database.yml
431
+  (0.4ms) begin transaction
432
+  (0.1ms) rollback transaction
433
+  (0.0ms) begin transaction
434
+  (0.0ms) rollback transaction
435
+  (0.0ms) begin transaction
436
+  (0.0ms) rollback transaction
437
+  (0.0ms) begin transaction
438
+  (0.0ms) rollback transaction
439
+  (0.0ms) begin transaction
440
+  (0.1ms) rollback transaction
441
+  (0.0ms) begin transaction
442
+  (0.0ms) rollback transaction
443
+  (0.0ms) begin transaction
444
+  (0.0ms) rollback transaction
445
+ Connecting to database specified by database.yml
446
+  (0.4ms) begin transaction
447
+  (0.1ms) rollback transaction
448
+  (0.0ms) begin transaction
449
+  (0.1ms) rollback transaction
450
+  (0.0ms) begin transaction
451
+  (0.1ms) rollback transaction
452
+  (0.0ms) begin transaction
453
+  (0.0ms) rollback transaction
454
+  (0.0ms) begin transaction
455
+  (0.1ms) rollback transaction
456
+  (0.0ms) begin transaction
457
+  (0.0ms) rollback transaction
458
+  (0.0ms) begin transaction
459
+  (0.0ms) rollback transaction
460
+ Connecting to database specified by database.yml
461
+  (0.4ms) begin transaction
462
+  (0.1ms) rollback transaction
463
+  (0.0ms) begin transaction
464
+  (0.0ms) rollback transaction
465
+  (0.0ms) begin transaction
466
+  (0.0ms) rollback transaction
467
+  (0.0ms) begin transaction
468
+  (0.0ms) rollback transaction
469
+  (0.0ms) begin transaction
470
+  (0.1ms) rollback transaction
471
+  (0.0ms) begin transaction
472
+  (0.0ms) rollback transaction
473
+  (0.0ms) begin transaction
474
+  (0.0ms) rollback transaction
475
+ Connecting to database specified by database.yml
476
+  (0.4ms) begin transaction
477
+  (0.1ms) rollback transaction
478
+  (0.0ms) begin transaction
479
+  (0.0ms) rollback transaction
480
+  (0.0ms) begin transaction
481
+  (0.0ms) rollback transaction
482
+  (0.0ms) begin transaction
483
+  (0.0ms) rollback transaction
484
+  (0.0ms) begin transaction
485
+  (0.1ms) rollback transaction
486
+  (0.0ms) begin transaction
487
+  (0.1ms) rollback transaction
488
+  (0.0ms) begin transaction
489
+  (0.0ms) rollback transaction
490
+ Connecting to database specified by database.yml
491
+  (0.4ms) begin transaction
492
+  (0.1ms) rollback transaction
493
+  (0.0ms) begin transaction
494
+  (0.0ms) rollback transaction
495
+  (0.0ms) begin transaction
496
+  (0.0ms) rollback transaction
497
+  (0.0ms) begin transaction
498
+  (0.0ms) rollback transaction
499
+  (0.0ms) begin transaction
500
+  (0.1ms) rollback transaction
501
+  (0.0ms) begin transaction
502
+  (0.0ms) rollback transaction
503
+  (0.0ms) begin transaction
504
+  (0.0ms) rollback transaction
505
+ Connecting to database specified by database.yml
506
+  (0.4ms) begin transaction
507
+  (0.1ms) rollback transaction
508
+  (0.0ms) begin transaction
509
+  (0.0ms) rollback transaction
510
+  (0.0ms) begin transaction
511
+  (0.0ms) rollback transaction
512
+  (0.0ms) begin transaction
513
+  (0.0ms) rollback transaction
514
+  (0.0ms) begin transaction
515
+  (0.1ms) rollback transaction
516
+  (0.0ms) begin transaction
517
+  (0.0ms) rollback transaction
518
+  (0.1ms) begin transaction
519
+  (0.0ms) rollback transaction
520
+ Connecting to database specified by database.yml
521
+  (0.4ms) begin transaction
522
+  (0.1ms) rollback transaction
523
+  (0.0ms) begin transaction
524
+  (0.0ms) rollback transaction
525
+  (0.0ms) begin transaction
526
+  (0.0ms) rollback transaction
527
+  (0.0ms) begin transaction
528
+  (0.0ms) rollback transaction
529
+  (0.0ms) begin transaction
530
+  (0.1ms) rollback transaction
531
+  (0.0ms) begin transaction
532
+  (0.0ms) rollback transaction
533
+  (0.0ms) begin transaction
534
+  (0.0ms) rollback transaction
535
+ Connecting to database specified by database.yml
536
+  (0.4ms) begin transaction
537
+  (0.1ms) rollback transaction
538
+  (0.0ms) begin transaction
539
+  (0.0ms) rollback transaction
540
+  (0.0ms) begin transaction
541
+  (0.0ms) rollback transaction
542
+  (0.0ms) begin transaction
543
+  (0.0ms) rollback transaction
544
+  (0.0ms) begin transaction
545
+  (0.1ms) rollback transaction
546
+  (0.0ms) begin transaction
547
+  (0.0ms) rollback transaction
548
+  (0.0ms) begin transaction
549
+  (0.0ms) rollback transaction
550
+ Connecting to database specified by database.yml
551
+  (0.4ms) begin transaction
552
+  (0.1ms) rollback transaction
553
+  (0.2ms) begin transaction
554
+  (0.1ms) rollback transaction
555
+  (0.0ms) begin transaction
556
+  (0.1ms) rollback transaction
557
+  (0.0ms) begin transaction
558
+  (0.1ms) rollback transaction
559
+  (0.0ms) begin transaction
560
+  (0.1ms) rollback transaction
561
+  (0.1ms) begin transaction
562
+  (0.1ms) rollback transaction
563
+  (0.1ms) begin transaction
564
+  (0.0ms) rollback transaction
565
+ Connecting to database specified by database.yml
566
+  (0.4ms) begin transaction
567
+  (0.1ms) rollback transaction
568
+  (0.0ms) begin transaction
569
+  (0.1ms) rollback transaction
570
+  (0.0ms) begin transaction
571
+  (0.1ms) rollback transaction
572
+  (0.0ms) begin transaction
573
+  (0.1ms) rollback transaction
574
+  (0.0ms) begin transaction
575
+  (0.1ms) rollback transaction
576
+  (0.1ms) begin transaction
577
+  (0.0ms) rollback transaction
578
+  (0.0ms) begin transaction
579
+  (0.0ms) rollback transaction
580
+ Connecting to database specified by database.yml
581
+  (0.4ms) begin transaction
582
+  (0.1ms) rollback transaction
583
+  (0.1ms) begin transaction
584
+  (0.1ms) rollback transaction
585
+  (0.1ms) begin transaction
586
+  (0.1ms) rollback transaction
587
+  (0.0ms) begin transaction
588
+  (0.0ms) rollback transaction
589
+  (0.0ms) begin transaction
590
+  (0.1ms) rollback transaction
591
+  (0.0ms) begin transaction
592
+  (0.0ms) rollback transaction
593
+  (0.0ms) begin transaction
594
+  (0.0ms) rollback transaction
595
+ Connecting to database specified by database.yml
596
+  (0.4ms) begin transaction
597
+  (0.1ms) rollback transaction
598
+  (0.0ms) begin transaction
599
+  (0.0ms) rollback transaction
600
+  (0.0ms) begin transaction
601
+  (0.0ms) rollback transaction
602
+  (0.0ms) begin transaction
603
+  (0.0ms) rollback transaction
604
+  (0.0ms) begin transaction
605
+  (0.1ms) rollback transaction
606
+  (0.0ms) begin transaction
607
+  (0.0ms) rollback transaction
608
+  (0.0ms) begin transaction
609
+  (0.0ms) rollback transaction
610
+ Connecting to database specified by database.yml
611
+  (0.4ms) begin transaction
612
+  (0.1ms) rollback transaction
613
+  (0.0ms) begin transaction
614
+  (0.0ms) rollback transaction
615
+  (0.0ms) begin transaction
616
+  (0.0ms) rollback transaction
617
+  (0.0ms) begin transaction
618
+  (0.0ms) rollback transaction
619
+  (0.0ms) begin transaction
620
+  (0.1ms) rollback transaction
621
+  (0.0ms) begin transaction
622
+  (0.0ms) rollback transaction
623
+  (0.0ms) begin transaction
624
+  (0.0ms) rollback transaction
@@ -10,6 +10,18 @@ class HasMockObjectsTest < ActiveSupport::TestCase
10
10
  assert_equal true, book.chapters.is_a?(Array)
11
11
  end
12
12
 
13
+ def test_a_books_mock_bibliographies_should_return_array_with_at_least_4_objects
14
+ book = Book.new
15
+ assert_equal true, book.bibliographies.is_a?(Array)
16
+ assert_equal true, book.bibliographies.count >= 4
17
+ end
18
+
19
+ def test_a_books_mock_bibliographies_should_return_array_with_at_most_5_objects
20
+ book = Book.new
21
+ assert_equal true, book.bibliographies.is_a?(Array)
22
+ assert_equal true, book.bibliographies.count <= 5
23
+ end
24
+
13
25
  def test_a_books_mock_chapters_should_count_should_vary_between_instances
14
26
  books = []
15
27
  10.times do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_mock_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-27 00:00:00.000000000 Z
12
+ date: 2014-01-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: 3636432246234124599
130
+ hash: -4574805250493907141
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  none: false
133
133
  requirements:
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  segments:
138
138
  - 0
139
- hash: 3636432246234124599
139
+ hash: -4574805250493907141
140
140
  requirements: []
141
141
  rubyforge_project:
142
142
  rubygems_version: 1.8.23