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 +14 -8
- data/lib/has_mock_objects.rb +5 -1
- data/lib/has_mock_objects/version.rb +1 -1
- data/test/dummy/app/models/book.rb +3 -2
- data/test/dummy/log/test.log +497 -0
- data/test/has_mock_objects_test.rb +12 -0
- metadata +4 -4
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
|
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
|
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
|
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
|
-
|
68
|
-
|
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
|
|
data/lib/has_mock_objects.rb
CHANGED
@@ -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)
|
@@ -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
|
data/test/dummy/log/test.log
CHANGED
@@ -125,3 +125,500 @@ Connecting to database specified by database.yml
|
|
125
125
|
[1m[35m (0.0ms)[0m rollback transaction
|
126
126
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
127
127
|
[1m[35m (0.0ms)[0m rollback transaction
|
128
|
+
Connecting to database specified by database.yml
|
129
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
130
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
131
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
132
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
133
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
134
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
135
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
136
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
137
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
138
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
139
|
+
Connecting to database specified by database.yml
|
140
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
141
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
142
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
143
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
144
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
145
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
146
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
147
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
148
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
149
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
150
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
151
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
152
|
+
Connecting to database specified by database.yml
|
153
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
154
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
155
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
156
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
157
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
158
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
159
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
160
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
161
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
162
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
163
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
164
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
165
|
+
Connecting to database specified by database.yml
|
166
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
167
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
168
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
169
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
170
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
171
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
172
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
173
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
174
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
175
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
176
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
177
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
178
|
+
Connecting to database specified by database.yml
|
179
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
180
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
181
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
182
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
183
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
184
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
185
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
186
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
187
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
188
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
189
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
190
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
191
|
+
Connecting to database specified by database.yml
|
192
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
193
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
194
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
195
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
196
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
197
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
198
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
199
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
200
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
201
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
202
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
203
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
204
|
+
Connecting to database specified by database.yml
|
205
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
206
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
207
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
208
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
209
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
210
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
211
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
212
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
213
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
214
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
215
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
216
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
217
|
+
Connecting to database specified by database.yml
|
218
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
219
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
220
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
221
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
222
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
223
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
224
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
225
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
226
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
227
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
228
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
229
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
230
|
+
Connecting to database specified by database.yml
|
231
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
232
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
233
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
234
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
235
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
236
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
237
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
238
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
239
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
240
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
241
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
242
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
243
|
+
Connecting to database specified by database.yml
|
244
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
245
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
246
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
247
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
248
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
249
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
250
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
251
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
252
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
253
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
254
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
255
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
256
|
+
Connecting to database specified by database.yml
|
257
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
258
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
259
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
260
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
261
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
262
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
263
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
264
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
265
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
266
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
267
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
268
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
269
|
+
Connecting to database specified by database.yml
|
270
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
271
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
272
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
273
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
274
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
275
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
276
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
277
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
278
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
279
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
280
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
281
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
282
|
+
Connecting to database specified by database.yml
|
283
|
+
[1m[36m (0.7ms)[0m [1mbegin transaction[0m
|
284
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
285
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
286
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
287
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
288
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
289
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
290
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
291
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
292
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
293
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
294
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
295
|
+
Connecting to database specified by database.yml
|
296
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
297
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
298
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
299
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
300
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
301
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
302
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
303
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
304
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
305
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
306
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
307
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
308
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
309
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
310
|
+
Connecting to database specified by database.yml
|
311
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
312
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
313
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
314
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
315
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
316
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
317
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
318
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
319
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
320
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
321
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
322
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
323
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
324
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
325
|
+
Connecting to database specified by database.yml
|
326
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
327
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
328
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
329
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
330
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
331
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
332
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
333
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
334
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
335
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
336
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
337
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
338
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
339
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
340
|
+
Connecting to database specified by database.yml
|
341
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
342
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
343
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
344
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
345
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
346
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
347
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
348
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
349
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
350
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
351
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
352
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
353
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
354
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
355
|
+
Connecting to database specified by database.yml
|
356
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
357
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
358
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
359
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
360
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
361
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
362
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
363
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
364
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
365
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
366
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
367
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
368
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
369
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
370
|
+
Connecting to database specified by database.yml
|
371
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
372
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
373
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
374
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
375
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
376
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
377
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
378
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
379
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
380
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
381
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
382
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
383
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
384
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
385
|
+
Connecting to database specified by database.yml
|
386
|
+
[1m[36m (0.6ms)[0m [1mbegin transaction[0m
|
387
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
388
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
389
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
390
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
391
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
392
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
393
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
394
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
395
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
396
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
397
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
398
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
399
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
400
|
+
Connecting to database specified by database.yml
|
401
|
+
[1m[36m (0.5ms)[0m [1mbegin transaction[0m
|
402
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
403
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
404
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
405
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
406
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
407
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
408
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
409
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
410
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
411
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
412
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
413
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
414
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
415
|
+
Connecting to database specified by database.yml
|
416
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
417
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
418
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
419
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
420
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
421
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
422
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
423
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
424
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
425
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
426
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
427
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
428
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
429
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
430
|
+
Connecting to database specified by database.yml
|
431
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
432
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
433
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
434
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
435
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
436
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
437
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
438
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
439
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
440
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
441
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
442
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
443
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
444
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
445
|
+
Connecting to database specified by database.yml
|
446
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
447
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
448
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
449
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
450
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
451
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
452
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
453
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
454
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
455
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
456
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
457
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
458
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
459
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
460
|
+
Connecting to database specified by database.yml
|
461
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
462
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
463
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
464
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
465
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
466
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
467
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
468
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
469
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
470
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
471
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
472
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
473
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
474
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
475
|
+
Connecting to database specified by database.yml
|
476
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
477
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
478
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
479
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
480
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
481
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
482
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
483
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
484
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
485
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
486
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
487
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
488
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
489
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
490
|
+
Connecting to database specified by database.yml
|
491
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
492
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
493
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
494
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
495
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
496
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
497
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
498
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
499
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
500
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
501
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
502
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
503
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
504
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
505
|
+
Connecting to database specified by database.yml
|
506
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
507
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
508
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
509
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
510
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
511
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
512
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
513
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
514
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
515
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
516
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
517
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
518
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
519
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
520
|
+
Connecting to database specified by database.yml
|
521
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
522
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
523
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
524
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
525
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
526
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
527
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
528
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
529
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
530
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
531
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
532
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
533
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
534
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
535
|
+
Connecting to database specified by database.yml
|
536
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
537
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
538
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
539
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
540
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
541
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
542
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
543
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
544
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
545
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
546
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
547
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
548
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
549
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
550
|
+
Connecting to database specified by database.yml
|
551
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
552
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
553
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
554
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
555
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
556
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
557
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
558
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
559
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
560
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
561
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
562
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
563
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
564
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
565
|
+
Connecting to database specified by database.yml
|
566
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
567
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
568
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
569
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
570
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
571
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
572
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
573
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
574
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
575
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
576
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
577
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
578
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
579
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
580
|
+
Connecting to database specified by database.yml
|
581
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
582
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
583
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
584
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
585
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
586
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
587
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
588
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
589
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
590
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
591
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
592
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
593
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
594
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
595
|
+
Connecting to database specified by database.yml
|
596
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
597
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
598
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
599
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
600
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
601
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
602
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
603
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
604
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
605
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
606
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
607
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
608
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
609
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
610
|
+
Connecting to database specified by database.yml
|
611
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
612
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
613
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
614
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
615
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
616
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
617
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
618
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
619
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
620
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
621
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
622
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
623
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
624
|
+
[1m[35m (0.0ms)[0m 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
|
+
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:
|
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:
|
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:
|
139
|
+
hash: -4574805250493907141
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project:
|
142
142
|
rubygems_version: 1.8.23
|