anonymous_active_record 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ca6f2f21fd0dcb0c001dec3dc5e95d3964677c7aff7f3541a99b4c606072b59
4
- data.tar.gz: a6fb0dde8a98a253a57b9b4f24776fe935d4ad54ace7d553f6bdab272c207020
3
+ metadata.gz: 3e392bcbdfc2f58c8d401f10447c1266a15c16fffee00244f9c8628e81aea379
4
+ data.tar.gz: 6f9aedbd9499eb8928c010bbdf881218a56a8931beb157104df38517b0bf3c6a
5
5
  SHA512:
6
- metadata.gz: cb02baf587332716753c3fa25a32d79c518ad2f7ed5777b2649b898c5882850f4bff0c3d5a28896927d5f57da0811df5e950b1a05f23407499408a77aefb6d1a
7
- data.tar.gz: 60b28ea2ac93dc90df1e850902de70d7055c333749a3a0f55ece2ef557fbd74466de36febcbc193676de6039f809f7628e66c3daa7ab25177d83191f7e10460b
6
+ metadata.gz: e76fd8bc9db439e5861855f5b027270e889face0f42fc24b4d0fd2f34d442a1b56d68035c310438ff3ffae15cab150d880e17106b5eae28978ef924b5964b6fe
7
+ data.tar.gz: 7f0aaf826a1ddd3d506536f6904ce6f09759a65cfd2b3001e4f69253693dcaeca9bd2a0a730ee845d6208d1c730406da939cef391154cc781e355b33cbeb60b2
data/README.md CHANGED
@@ -49,7 +49,7 @@ Let's say you want to write specs for a module, `HasBalloon`, which provides a m
49
49
  ```ruby
50
50
  module HasBalloon
51
51
  def has_balloon?
52
- name == 'Spot' ? true : false # only Spot has a balloon
52
+ name == 'Spot' # only Spot has a balloon
53
53
  end
54
54
  end
55
55
  ```
@@ -57,61 +57,62 @@ end
57
57
  This won't work [(really!)](https://github.com/rails/rails/issues/8934):
58
58
 
59
59
  ```ruby
60
- let(:ar_with_balloon) do
61
- Class.new(ActiveRecord::Base) do
62
- attr_accessor :name
63
- include HasBalloon
64
- def flowery_name
65
- "#{b_f}#{name}#{b_f}"
66
- end
67
- def b_f
68
- has_balloon? ? '🎈' : '🌸'
69
- end
60
+ let(:ar_with_balloon) do
61
+ Class.new(ActiveRecord::Base) do
62
+ attr_accessor :name
63
+
64
+ include HasBalloon
65
+ def flowery_name
66
+ "#{b_f}#{name}#{b_f}"
67
+ end
68
+ def b_f
69
+ has_balloon? ? '🎈' : '🌸'
70
70
  end
71
71
  end
72
+ end
72
73
  ```
73
74
 
74
75
  So do this instead:
75
76
 
76
77
  ```ruby
77
- let(:ar_with_balloon) do
78
- AnonymousActiveRecord.generate(columns: ['name']) do
79
- include HasBalloon
80
- def flowery_name
81
- "#{b_f}#{name}#{b_f}"
82
- end
83
- def b_f
84
- has_balloon? ? '🎈' : '🌸'
85
- end
78
+ let(:ar_with_balloon) do
79
+ AnonymousActiveRecord.generate(columns: ['name']) do
80
+ include HasBalloon
81
+ def flowery_name
82
+ "#{b_f}#{name}#{b_f}"
83
+ end
84
+ def b_f
85
+ has_balloon? ? '🎈' : '🌸'
86
86
  end
87
87
  end
88
- it 'can test the module' do
89
- expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
90
- expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
91
- end
88
+ end
89
+ it 'can test the module' do
90
+ expect(ar_with_balloon.new(name: 'Spot').flowery_name).to eq('🎈Spot🎈')
91
+ expect(ar_with_balloon.new(name: 'Not Spot').flowery_name).to eq('🌸Not Spot🌸')
92
+ end
92
93
  ```
93
94
 
94
95
  ### Generate Options
95
96
 
96
97
  ```ruby
97
98
  AnonymousActiveRecord.generate(
98
- table_name: 'a_table_name',
99
- # if table_name is not set klass_basename will be used to derive a unique random table_name
100
- # default is a unique random table name
101
- klass_basename: 'anons', # is default
102
- columns: ['name'],
103
- # columns default is [],
104
- # meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
105
- # Optionally provide an array of hashes and thereby designate column type:
106
- # [{name: 'name', type: 'string'}, {name: 'baked_at', type: 'time'}]
107
- timestamps: true, # is default
108
- indexes: [{columns: ['name'], unique: true}],
109
- # indexes default is [],
110
- # meaning class will have no indexes, as the AR defaults
111
- # Optionally provide an array of hashes of index options (similar to those used in Rails migrations):
112
- # [{columns: ['name'], unique: true}, {columns: ['baked_at']}]
113
- connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
114
- ) do
99
+ table_name: 'a_table_name',
100
+ # if table_name is not set klass_basename will be used to derive a unique random table_name
101
+ # default is a unique random table name
102
+ klass_basename: 'anons', # is default
103
+ columns: ['name'],
104
+ # columns default is [],
105
+ # meaning class will have ['id', 'created_at', 'updated_at'], as the AR defaults
106
+ # Optionally provide an array of hashes and thereby designate column type:
107
+ # [{name: 'name', type: 'string'}, {name: 'baked_at', type: 'time'}]
108
+ timestamps: true, # is default
109
+ indexes: [{ columns: ['name'], unique: true }],
110
+ # indexes default is [],
111
+ # meaning class will have no indexes, as the AR defaults
112
+ # Optionally provide an array of hashes of index options (similar to those used in Rails migrations):
113
+ # [{columns: ['name'], unique: true}, {columns: ['baked_at']}]
114
+ connection_params: { adapter: 'sqlite3', encoding: 'utf8', database: ':memory:' } # is default
115
+ ) do
115
116
  # code which becomes part of the class definition
116
117
  end
117
118
  ```
@@ -122,10 +123,10 @@ The block is optional.
122
123
 
123
124
  ```ruby
124
125
  AnonymousActiveRecord.factory(
125
- source_data: [{name: 'Phil'}, {name: 'Vickie'}],
126
+ source_data: [{ name: 'Phil' }, { name: 'Vickie' }]
126
127
  # Array of hashes, where each hash represents a record that will be created
127
128
  # ... The rest of the options are the same as for generate, see above.
128
- ) do
129
+ ) do
129
130
  # same as for generate, see above.
130
131
  end
131
132
  ```
@@ -170,7 +171,7 @@ spec.add_dependency 'anonymous_active_record', '~> 0.0'
170
171
 
171
172
  * Copyright (c) 2018 [Peter H. Boling][peterboling] of [Rails Bling][railsbling]
172
173
 
173
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
174
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
174
175
 
175
176
  [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpboling%2Fanonymous_active_record?ref=badge_large)
176
177
 
@@ -44,7 +44,7 @@ module AnonymousActiveRecord
44
44
  }.freeze
45
45
 
46
46
  # Defines a pseudo anonymous class in a particular namespace of your choosing.
47
- def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: "ActiveRecord::Base", connection_params: DEFAULT_CONNECTION_PARAMS, &block)
47
+ def generate(table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: 'ActiveRecord::Base', connection_params: DEFAULT_CONNECTION_PARAMS, &block)
48
48
  gen = AnonymousActiveRecord::Generator.new(table_name, klass_namespaces, klass_basename, parent_klass)
49
49
  klass = gen.generate(&block)
50
50
  connection_params = YAML.load_file(connection_params) if connection_params.is_a?(String)
@@ -82,21 +82,27 @@ module AnonymousActiveRecord
82
82
  end
83
83
 
84
84
  # Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
85
- def factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: "ActiveRecord::Base", connection_params: DEFAULT_CONNECTION_PARAMS, &block)
86
- factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, parent_klass: parent_klass, connection_params: connection_params, &block)
85
+ def factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: 'ActiveRecord::Base', connection_params: DEFAULT_CONNECTION_PARAMS, &block)
86
+ factory = _factory(
87
+ source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, parent_klass: parent_klass, connection_params: connection_params, &block
88
+ )
87
89
  factory.run
88
90
  end
89
91
 
90
92
  # Initializes instances of a pseudo anonymous class in a particular namespace of your choosing.
91
- def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: "ActiveRecord::Base", connection_params: DEFAULT_CONNECTION_PARAMS, &block)
92
- factory = _factory(source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, parent_klass: parent_klass, connection_params: connection_params, &block)
93
+ def factory!(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: 'ActiveRecord::Base', connection_params: DEFAULT_CONNECTION_PARAMS, &block)
94
+ factory = _factory(
95
+ source_data: source_data, table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, indexes: indexes, timestamps: timestamps, parent_klass: parent_klass, connection_params: connection_params, &block
96
+ )
93
97
  factory.run!
94
98
  end
95
99
 
96
100
  private
97
101
 
98
- def _factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: "ActiveRecord::Base", connection_params: DEFAULT_CONNECTION_PARAMS, &block)
99
- klass = generate(table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, parent_klass: parent_klass, indexes: indexes, connection_params: connection_params, &block)
102
+ def _factory(source_data: [], table_name: nil, klass_namespaces: [], klass_basename: nil, columns: [], indexes: [], timestamps: true, parent_klass: 'ActiveRecord::Base', connection_params: DEFAULT_CONNECTION_PARAMS, &block)
103
+ klass = generate(
104
+ table_name: table_name, klass_namespaces: klass_namespaces, klass_basename: klass_basename, columns: columns, timestamps: timestamps, parent_klass: parent_klass, indexes: indexes, connection_params: connection_params, &block
105
+ )
100
106
  AnonymousActiveRecord::Factory.new(source_data, klass)
101
107
  end
102
108
 
@@ -18,9 +18,10 @@ module AnonymousActiveRecord
18
18
 
19
19
  attr_reader :klass_namespaces, :table_name, :klass_name, :parent_klass
20
20
 
21
- def initialize(table_name, klass_namespaces = [], klass_basename = nil, parent_klass = "ActiveRecord::Base")
21
+ def initialize(table_name, klass_namespaces = [], klass_basename = nil, parent_klass = 'ActiveRecord::Base')
22
22
  @klass_namespaces = Array(klass_namespaces).map(&:to_s).map { |x| x.gsub(/[^a-z0-9]+/i, '_') }
23
- klass_context = [(klass_basename || DEFAULT_NAME).gsub(/[^a-z0-9]+/i, '_').capitalize, SecureRandom.uuid.gsub(/[^a-z0-9]+/i, '_')].join('_')
23
+ klass_context = [(klass_basename || DEFAULT_NAME).gsub(/[^a-z0-9]+/i, '_').capitalize,
24
+ SecureRandom.uuid.gsub(/[^a-z0-9]+/i, '_')].join('_')
24
25
  @table_name = (table_name || klass_context).downcase.to_s
25
26
  # String#capitalize is Ruby >= 2.4, https://stackoverflow.com/a/3725154/213191
26
27
  @klass_name = (klass_namespaces << klass_context).join('::')
@@ -34,7 +35,7 @@ module AnonymousActiveRecord
34
35
  # https://github.com/rails/rails/issues/8934
35
36
  eval "class ::#{klass_name} < #{parent_klass}; end"
36
37
  klass = Kernel.const_get(klass_name, true)
37
- klass.class_eval(&block) if block_given?
38
+ klass.class_eval(&block) if block
38
39
  klass.table_name = table_name
39
40
  klass
40
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AnonymousActiveRecord
4
- VERSION = '1.0.5'
4
+ VERSION = '1.0.6'
5
5
  end
@@ -12,12 +12,14 @@ RSpec.describe AnonymousActiveRecord do
12
12
  it 'does not error' do
13
13
  expect { subject }.not_to raise_error
14
14
  end
15
+
15
16
  context 'instance' do
16
17
  subject { super().new }
17
18
 
18
19
  it 'can be instantiated' do
19
20
  expect(subject).to be_a(ActiveRecord::Base)
20
21
  end
22
+
21
23
  context 'timestamps' do
22
24
  it 'has' do
23
25
  expect(subject.created_at).to be_nil
@@ -35,9 +37,11 @@ RSpec.describe AnonymousActiveRecord do
35
37
  it 'does not error' do
36
38
  expect { subject }.not_to raise_error
37
39
  end
40
+
38
41
  it 'does not have name' do
39
42
  expect(subject).not_to respond_to(:name)
40
43
  end
44
+
41
45
  it 'sets timestamps' do
42
46
  expect(subject.created_at).not_to be_nil
43
47
  expect(subject.updated_at).not_to be_nil
@@ -76,12 +80,14 @@ RSpec.describe AnonymousActiveRecord do
76
80
  it 'does not error' do
77
81
  expect { subject }.not_to raise_error
78
82
  end
83
+
79
84
  context 'instance' do
80
85
  subject { super().new }
81
86
 
82
87
  it 'can be instantiated' do
83
88
  expect(subject).to be_a(ActiveRecord::Base)
84
89
  end
90
+
85
91
  context 'name' do
86
92
  it 'has' do
87
93
  expect(subject.name).to be_nil
@@ -106,9 +112,11 @@ RSpec.describe AnonymousActiveRecord do
106
112
  it 'does not error' do
107
113
  expect { subject }.not_to raise_error
108
114
  end
115
+
109
116
  it 'sets name' do
110
117
  expect(subject.name).to eq('Bobo')
111
118
  end
119
+
112
120
  it 'sets timestamps' do
113
121
  expect(subject.created_at).not_to be_nil
114
122
  expect(subject.updated_at).not_to be_nil
@@ -147,12 +155,14 @@ RSpec.describe AnonymousActiveRecord do
147
155
  it 'does not error' do
148
156
  expect { subject }.not_to raise_error
149
157
  end
158
+
150
159
  context 'instance' do
151
160
  subject { super().new }
152
161
 
153
162
  it 'can be instantiated' do
154
163
  expect(subject).to be_a(ActiveRecord::Base)
155
164
  end
165
+
156
166
  context 'name' do
157
167
  it 'has' do
158
168
  expect(subject.name).to be_nil
@@ -184,12 +194,15 @@ RSpec.describe AnonymousActiveRecord do
184
194
  it 'does not error' do
185
195
  expect { subject }.not_to raise_error
186
196
  end
197
+
187
198
  it 'sets name' do
188
199
  expect(subject.name).to eq('Bobo')
189
200
  end
201
+
190
202
  it 'sets baked_at' do
191
203
  expect([ActiveRecord::Type::Time::Value, Time]).to include(subject.baked_at.class)
192
204
  end
205
+
193
206
  it 'sets timestamps' do
194
207
  expect(subject.created_at).not_to be_nil
195
208
  expect(subject.updated_at).not_to be_nil
@@ -220,7 +233,9 @@ RSpec.describe AnonymousActiveRecord do
220
233
  let(:table_name) { 'dogs' }
221
234
  let(:klass_namespaces) { %w[Farm Animal] }
222
235
  let(:klass_basename) { 'my' }
223
- let(:columns) { [{ name: 'name', type: 'string', default: 'Bird Man' }, { name: 'number', type: 'integer', default: 0 }] }
236
+ let(:columns) do
237
+ [{ name: 'name', type: 'string', default: 'Bird Man' }, { name: 'number', type: 'integer', default: 0 }]
238
+ end
224
239
  let(:indexes) { [] }
225
240
  let(:timestamps) { true }
226
241
  let(:connection_params) { AnonymousActiveRecord::DEFAULT_CONNECTION_PARAMS }
@@ -228,12 +243,14 @@ RSpec.describe AnonymousActiveRecord do
228
243
  it 'does not error' do
229
244
  expect { subject }.not_to raise_error
230
245
  end
246
+
231
247
  context 'instance' do
232
248
  subject { super().new }
233
249
 
234
250
  it 'can be instantiated' do
235
251
  expect(subject).to be_a(ActiveRecord::Base)
236
252
  end
253
+
237
254
  context 'name' do
238
255
  it 'has' do
239
256
  expect(subject.name).to eq('Bird Man')
@@ -265,12 +282,15 @@ RSpec.describe AnonymousActiveRecord do
265
282
  it 'does not error' do
266
283
  expect { subject }.not_to raise_error
267
284
  end
285
+
268
286
  it 'sets name' do
269
287
  expect(subject.name).to eq('Bobo')
270
288
  end
289
+
271
290
  it 'sets number' do
272
291
  expect(subject.number).to eq(111)
273
292
  end
293
+
274
294
  it 'sets timestamps' do
275
295
  expect(subject.created_at).not_to be_nil
276
296
  expect(subject.updated_at).not_to be_nil
@@ -309,12 +329,14 @@ RSpec.describe AnonymousActiveRecord do
309
329
  it 'does not error' do
310
330
  expect { subject }.not_to raise_error
311
331
  end
332
+
312
333
  context 'instance' do
313
334
  subject { super().new }
314
335
 
315
336
  it 'can be instantiated' do
316
337
  expect(subject).to be_a(ActiveRecord::Base)
317
338
  end
339
+
318
340
  context 'name' do
319
341
  it 'has' do
320
342
  expect(subject.name).to be_nil
@@ -346,12 +368,15 @@ RSpec.describe AnonymousActiveRecord do
346
368
  it 'does not error' do
347
369
  expect { subject }.not_to raise_error
348
370
  end
371
+
349
372
  it 'sets name' do
350
373
  expect(subject.name).to eq('Bobo')
351
374
  end
375
+
352
376
  it 'sets baked_at' do
353
377
  expect([ActiveRecord::Type::Time::Value, Time]).to include(subject.baked_at.class)
354
378
  end
379
+
355
380
  it 'sets timestamps' do
356
381
  expect(subject.created_at).not_to be_nil
357
382
  expect(subject.updated_at).not_to be_nil
@@ -415,19 +440,21 @@ RSpec.describe AnonymousActiveRecord do
415
440
  let(:klass_namespaces) { %w[Farm Animal] }
416
441
  let(:klass_basename) { 'my' }
417
442
  let(:columns) { [{ name: 'name', type: 'string' }, { name: 'baked_at', type: 'time' }] }
418
- let(:indexes) { [[['name'], unique: true], 'baked_at'] }
443
+ let(:indexes) { [[['name'], { unique: true }], 'baked_at'] }
419
444
  let(:timestamps) { true }
420
445
  let(:connection_params) { AnonymousActiveRecord::DEFAULT_CONNECTION_PARAMS }
421
446
 
422
447
  it 'does not error' do
423
448
  expect { subject }.not_to raise_error
424
449
  end
450
+
425
451
  context 'instance' do
426
452
  subject { super().new }
427
453
 
428
454
  it 'can be instantiated' do
429
455
  expect(subject).to be_a(ActiveRecord::Base)
430
456
  end
457
+
431
458
  context 'name' do
432
459
  it 'has' do
433
460
  expect(subject.name).to be_nil
@@ -459,12 +486,15 @@ RSpec.describe AnonymousActiveRecord do
459
486
  it 'does not error' do
460
487
  expect { subject }.not_to raise_error
461
488
  end
489
+
462
490
  it 'sets name' do
463
491
  expect(subject.name).to eq('Bobo')
464
492
  end
493
+
465
494
  it 'sets baked_at' do
466
495
  expect([ActiveRecord::Type::Time::Value, Time]).to include(subject.baked_at.class)
467
496
  end
497
+
468
498
  it 'sets timestamps' do
469
499
  expect(subject.created_at).not_to be_nil
470
500
  expect(subject.updated_at).not_to be_nil
@@ -525,12 +555,14 @@ RSpec.describe AnonymousActiveRecord do
525
555
  it 'does not error' do
526
556
  expect { subject }.not_to raise_error
527
557
  end
558
+
528
559
  context 'instance' do
529
560
  subject { super().new }
530
561
 
531
562
  it 'can be instantiated' do
532
563
  expect(subject).to be_a(ActiveRecord::Base)
533
564
  end
565
+
534
566
  context 'timestamps' do
535
567
  it 'has not' do
536
568
  expect(subject).not_to respond_to(:created_at)
@@ -549,9 +581,11 @@ RSpec.describe AnonymousActiveRecord do
549
581
  it 'does not error' do
550
582
  expect { subject }.not_to raise_error
551
583
  end
584
+
552
585
  it 'sets name' do
553
586
  expect(subject.name).to eq('Bobo')
554
587
  end
588
+
555
589
  it 'has no timestamps' do
556
590
  expect(subject).not_to respond_to(:created_at)
557
591
  expect(subject).not_to respond_to(:updated_at)
@@ -588,16 +622,19 @@ RSpec.describe AnonymousActiveRecord do
588
622
  it 'does not error' do
589
623
  expect { subject }.not_to raise_error
590
624
  end
625
+
591
626
  context 'instance' do
592
627
  subject { super().new(name: 'Marty McFly') }
593
628
 
594
629
  it 'can be instantiated' do
595
630
  expect(subject).to be_a(ActiveRecord::Base)
596
631
  end
632
+
597
633
  context 'block' do
598
634
  it 'defines method' do
599
635
  expect(subject.eat_pie).to eq('eating')
600
636
  end
637
+
601
638
  it 'has access to class context' do
602
639
  expect(subject.flowery_name).to eq('🌸Marty McFly🌸')
603
640
  end
@@ -621,12 +658,15 @@ RSpec.describe AnonymousActiveRecord do
621
658
  it 'does not error' do
622
659
  expect { subject }.not_to raise_error
623
660
  end
661
+
624
662
  it 'sets name' do
625
663
  expect(subject.name).to eq('Bobo')
626
664
  end
665
+
627
666
  it 'has access to class context' do
628
667
  expect(subject.flowery_name).to eq('🌸Bobo🌸')
629
668
  end
669
+
630
670
  it 'has no timestamps' do
631
671
  expect(subject).not_to respond_to(:created_at)
632
672
  expect(subject).not_to respond_to(:updated_at)
@@ -671,6 +711,7 @@ RSpec.describe AnonymousActiveRecord do
671
711
  it 'be an array' do
672
712
  expect(subject).to be_a(Array)
673
713
  end
714
+
674
715
  it 'has length 0' do
675
716
  expect(subject.length).to eq(0)
676
717
  end
@@ -710,6 +751,7 @@ RSpec.describe AnonymousActiveRecord do
710
751
  it 'be an array' do
711
752
  expect(subject).to be_a(Array)
712
753
  end
754
+
713
755
  it 'has length 2' do
714
756
  expect(subject.length).to eq(2)
715
757
  end
@@ -749,6 +791,7 @@ RSpec.describe AnonymousActiveRecord do
749
791
  it 'be an array' do
750
792
  expect(subject).to be_a(Array)
751
793
  end
794
+
752
795
  it 'has length 2' do
753
796
  expect(subject.length).to eq(2)
754
797
  end
@@ -796,6 +839,7 @@ RSpec.describe AnonymousActiveRecord do
796
839
  it 'be an array' do
797
840
  expect(subject).to be_a(Array)
798
841
  end
842
+
799
843
  it 'has length 2' do
800
844
  expect(subject.length).to eq(2)
801
845
  end
@@ -827,6 +871,7 @@ RSpec.describe AnonymousActiveRecord do
827
871
  it 'be an array' do
828
872
  expect(subject).to be_a(Array)
829
873
  end
874
+
830
875
  it 'has length 0' do
831
876
  expect(subject.length).to eq(0)
832
877
  end
@@ -866,6 +911,7 @@ RSpec.describe AnonymousActiveRecord do
866
911
  it 'be an array' do
867
912
  expect(subject).to be_a(Array)
868
913
  end
914
+
869
915
  it 'has length 2' do
870
916
  expect(subject.length).to eq(2)
871
917
  end
@@ -905,6 +951,7 @@ RSpec.describe AnonymousActiveRecord do
905
951
  it 'be an array' do
906
952
  expect(subject).to be_a(Array)
907
953
  end
954
+
908
955
  it 'has length 2' do
909
956
  expect(subject.length).to eq(2)
910
957
  end
@@ -952,6 +999,7 @@ RSpec.describe AnonymousActiveRecord do
952
999
  it 'be an array' do
953
1000
  expect(subject).to be_a(Array)
954
1001
  end
1002
+
955
1003
  it 'has length 2' do
956
1004
  expect(subject.length).to eq(2)
957
1005
  end
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bundler/setup'
4
-
5
3
  require 'byebug' if RUBY_ENGINE == 'ruby'
6
4
 
7
5
  require 'rspec/block_is_expected'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anonymous_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.9'
83
83
  - !ruby/object:Gem::Dependency
84
- name: rubocop-performance
84
+ name: rubocop-md
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rubocop-packaging
98
+ name: rubocop-minitest
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: rubocop-md
112
+ name: rubocop-packaging
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: rubocop-minitest
126
+ name: rubocop-performance
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: simplecov
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: sqlite3
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
243
  - !ruby/object:Gem::Version
230
244
  version: '0'
231
245
  requirements: []
232
- rubygems_version: 3.2.3
246
+ rubygems_version: 3.2.9
233
247
  signing_key:
234
248
  specification_version: 4
235
249
  summary: Almost Anonymous ActiveRecord classes