acts_as_paranoid 0.6.3 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,15 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
2
4
 
3
5
  class MultipleDefaultScopesTest < ParanoidBaseTest
4
6
  def setup
5
7
  setup_db
6
8
 
7
- ParanoidPolygon.create! :sides => 3
8
- ParanoidPolygon.create! :sides => 3
9
- ParanoidPolygon.create! :sides => 3
10
- ParanoidPolygon.create! :sides => 8
9
+ ParanoidPolygon.create! sides: 3
10
+ ParanoidPolygon.create! sides: 3
11
+ ParanoidPolygon.create! sides: 3
12
+ ParanoidPolygon.create! sides: 8
11
13
 
12
14
  assert_equal 3, ParanoidPolygon.count
13
15
  assert_equal 4, ParanoidPolygon.unscoped.count
data/test/test_helper.rb CHANGED
@@ -1,23 +1,41 @@
1
- require 'bundler'
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler"
2
4
  begin
3
- Bundler.require(:default, :development)
5
+ Bundler.load
4
6
  rescue Bundler::BundlerError => e
5
- $stderr.puts e.message
6
- $stderr.puts "Run `bundle install` to install missing gems"
7
+ warn e.message
8
+ warn "Run `bundle install` to install missing gems"
7
9
  exit e.status_code
8
10
  end
9
11
 
10
- require 'acts_as_paranoid'
11
- require 'minitest/autorun'
12
+ if RUBY_ENGINE == "jruby"
13
+ # Workaround for issue in I18n/JRuby combo.
14
+ # See https://github.com/jruby/jruby/issues/6547 and
15
+ # https://github.com/ruby-i18n/i18n/issues/555
16
+ require "i18n/backend"
17
+ require "i18n/backend/simple"
18
+ end
19
+
20
+ require "simplecov"
21
+ SimpleCov.start do
22
+ enable_coverage :branch
23
+ end
24
+
25
+ require "acts_as_paranoid"
26
+ require "minitest/autorun"
27
+ require "minitest/focus"
12
28
 
13
29
  # Silence deprecation halfway through the test
14
30
  I18n.enforce_available_locales = true
15
31
 
16
- ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
32
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
17
33
  ActiveRecord::Schema.verbose = false
18
34
 
35
+ # rubocop:disable Metrics/AbcSize
36
+ # rubocop:disable Metrics/MethodLength
19
37
  def setup_db
20
- ActiveRecord::Schema.define(:version => 1) do
38
+ ActiveRecord::Schema.define(version: 1) do # rubocop:disable Metrics/BlockLength
21
39
  create_table :paranoid_times do |t|
22
40
  t.string :name
23
41
  t.datetime :deleted_at
@@ -32,6 +50,7 @@ def setup_db
32
50
  t.boolean :is_deleted
33
51
  t.integer :paranoid_time_id
34
52
  t.integer :paranoid_with_counter_caches_count
53
+ t.integer :paranoid_with_touch_and_counter_caches_count
35
54
  t.integer :custom_counter_cache
36
55
  timestamps t
37
56
  end
@@ -112,14 +131,15 @@ def setup_db
112
131
 
113
132
  create_table :super_paranoids do |t|
114
133
  t.string :type
115
- t.references :has_many_inherited_super_paranoidz, index: { name: 'index__sp_id_on_has_many_isp' }
134
+ t.references :has_many_inherited_super_paranoidz,
135
+ index: { name: "index__sp_id_on_has_many_isp" }
116
136
  t.datetime :deleted_at
117
137
 
118
138
  timestamps t
119
139
  end
120
140
 
121
141
  create_table :has_many_inherited_super_paranoidzs do |t|
122
- t.references :super_paranoidz, index: { name: 'index_has_many_isp_on_sp_id' }
142
+ t.references :super_paranoidz, index: { name: "index_has_many_isp_on_sp_id" }
123
143
  t.datetime :deleted_at
124
144
 
125
145
  timestamps t
@@ -166,7 +186,7 @@ def setup_db
166
186
  end
167
187
 
168
188
  create_table :paranoid_polygons do |t|
169
- t.integer :sides
189
+ t.integer :sides
170
190
  t.datetime :deleted_at
171
191
 
172
192
  timestamps t
@@ -185,7 +205,7 @@ def setup_db
185
205
 
186
206
  create_table :paranoid_boolean_not_nullables do |t|
187
207
  t.string :name
188
- t.boolean :deleted, :boolean, :null => false, :default => false
208
+ t.boolean :deleted, :boolean, null: false, default: false
189
209
  end
190
210
 
191
211
  create_table :paranoid_belongs_to_polymorphics do |t|
@@ -223,19 +243,18 @@ def setup_db
223
243
  end
224
244
  end
225
245
  end
246
+ # rubocop:enable Metrics/AbcSize
247
+ # rubocop:enable Metrics/MethodLength
226
248
 
227
249
  def timestamps(table)
228
- table.column :created_at , :timestamp, :null => false
229
- table.column :updated_at , :timestamp, :null => false
250
+ table.column :created_at, :timestamp, null: false
251
+ table.column :updated_at, :timestamp, null: false
230
252
  end
231
253
 
232
254
  def teardown_db
233
- tables = if ActiveRecord::VERSION::MAJOR < 5
234
- ActiveRecord::Base.connection.tables
235
- else
236
- ActiveRecord::Base.connection.data_sources
255
+ ActiveRecord::Base.connection.data_sources.each do |table|
256
+ ActiveRecord::Base.connection.drop_table(table)
237
257
  end
238
- tables.each { |table| ActiveRecord::Base.connection.drop_table(table) }
239
258
  end
240
259
 
241
260
  class ParanoidTime < ActiveRecord::Base
@@ -243,50 +262,58 @@ class ParanoidTime < ActiveRecord::Base
243
262
 
244
263
  validates_uniqueness_of :name
245
264
 
246
- has_many :paranoid_has_many_dependants, :dependent => :destroy
247
- has_many :paranoid_booleans, :dependent => :destroy
248
- has_many :not_paranoids, :dependent => :delete_all
249
- has_many :paranoid_sections, :dependent => :destroy
265
+ has_many :paranoid_has_many_dependants, dependent: :destroy
266
+ has_many :paranoid_booleans, dependent: :destroy
267
+ has_many :not_paranoids, dependent: :delete_all
268
+ has_many :paranoid_sections, dependent: :destroy
250
269
 
251
- has_one :has_one_not_paranoid, :dependent => :destroy
270
+ has_one :has_one_not_paranoid, dependent: :destroy
252
271
 
253
- belongs_to :not_paranoid, :dependent => :destroy
272
+ belongs_to :not_paranoid, dependent: :destroy
254
273
  end
255
274
 
256
275
  class ParanoidBoolean < ActiveRecord::Base
257
- acts_as_paranoid :column_type => "boolean", :column => "is_deleted"
276
+ acts_as_paranoid column_type: "boolean", column: "is_deleted"
258
277
  validates_as_paranoid
259
278
  validates_uniqueness_of_without_deleted :name
260
279
 
261
280
  belongs_to :paranoid_time
262
- has_one :paranoid_has_one_dependant, :dependent => :destroy
263
- has_many :paranoid_with_counter_cache, :dependent => :destroy
264
- has_many :paranoid_with_custom_counter_cache, :dependent => :destroy
281
+ has_one :paranoid_has_one_dependant, dependent: :destroy
282
+ has_many :paranoid_with_counter_cache, dependent: :destroy
283
+ has_many :paranoid_with_custom_counter_cache, dependent: :destroy
284
+ has_many :paranoid_with_touch_and_counter_cache, dependent: :destroy
285
+ has_many :paranoid_with_touch, dependent: :destroy
265
286
  end
266
287
 
267
288
  class ParanoidString < ActiveRecord::Base
268
- acts_as_paranoid :column_type => "string", :column => "deleted", :deleted_value => "dead"
289
+ acts_as_paranoid column_type: "string", column: "deleted", deleted_value: "dead"
269
290
  end
270
291
 
271
292
  class NotParanoid < ActiveRecord::Base
272
293
  end
273
294
 
274
295
  class ParanoidNoDoubleTapDestroysFully < ActiveRecord::Base
275
- acts_as_paranoid :double_tap_destroys_fully => false
296
+ acts_as_paranoid double_tap_destroys_fully: false
276
297
  end
277
298
 
278
299
  class HasOneNotParanoid < ActiveRecord::Base
279
- belongs_to :paranoid_time, :with_deleted => true
300
+ belongs_to :paranoid_time, with_deleted: true
280
301
  end
281
302
 
282
303
  class DoubleHasOneNotParanoid < HasOneNotParanoid
283
- belongs_to :paranoid_time, :with_deleted => true
284
- belongs_to :paranoid_time, :with_deleted => true
304
+ belongs_to :paranoid_time, with_deleted: true
305
+ begin
306
+ verbose = $VERBOSE
307
+ $VERBOSE = false
308
+ belongs_to :paranoid_time, with_deleted: true
309
+ ensure
310
+ $VERBOSE = verbose
311
+ end
285
312
  end
286
313
 
287
314
  class ParanoidWithCounterCache < ActiveRecord::Base
288
315
  acts_as_paranoid
289
- belongs_to :paranoid_boolean, :counter_cache => true
316
+ belongs_to :paranoid_boolean, counter_cache: true
290
317
  end
291
318
 
292
319
  class ParanoidWithCustomCounterCache < ActiveRecord::Base
@@ -307,15 +334,34 @@ class ParanoidWithCounterCacheOnOptionalBelognsTo < ActiveRecord::Base
307
334
  end
308
335
  end
309
336
 
337
+ class ParanoidWithTouch < ActiveRecord::Base
338
+ self.table_name = "paranoid_with_counter_caches"
339
+ acts_as_paranoid
340
+ belongs_to :paranoid_boolean, touch: true
341
+ end
342
+
343
+ class ParanoidWithTouchAndCounterCache < ActiveRecord::Base
344
+ self.table_name = "paranoid_with_counter_caches"
345
+ acts_as_paranoid
346
+ belongs_to :paranoid_boolean, touch: true, counter_cache: true
347
+ end
348
+
310
349
  class ParanoidHasManyDependant < ActiveRecord::Base
311
350
  acts_as_paranoid
312
351
  belongs_to :paranoid_time
313
- belongs_to :paranoid_time_with_scope, -> { where(name: 'hello').includes(:not_paranoid) }, :class_name => 'ParanoidTime', :foreign_key => :paranoid_time_id
314
- belongs_to :paranoid_time_with_deleted, :class_name => 'ParanoidTime', :foreign_key => :paranoid_time_id, :with_deleted => true
315
- belongs_to :paranoid_time_with_scope_with_deleted, -> { where(name: 'hello').includes(:not_paranoid) }, :class_name => 'ParanoidTime', :foreign_key => :paranoid_time_id, :with_deleted => true
316
- belongs_to :paranoid_time_polymorphic_with_deleted, :class_name => 'ParanoidTime', :foreign_key => :paranoid_time_id, :polymorphic => true, :with_deleted => true
352
+ belongs_to :paranoid_time_with_scope,
353
+ -> { where(name: "hello").includes(:not_paranoid) },
354
+ class_name: "ParanoidTime", foreign_key: :paranoid_time_id
355
+ belongs_to :paranoid_time_with_deleted, class_name: "ParanoidTime",
356
+ foreign_key: :paranoid_time_id, with_deleted: true
357
+ belongs_to :paranoid_time_with_scope_with_deleted,
358
+ -> { where(name: "hello").includes(:not_paranoid) },
359
+ class_name: "ParanoidTime", foreign_key: :paranoid_time_id, with_deleted: true
360
+ belongs_to :paranoid_time_polymorphic_with_deleted, class_name: "ParanoidTime",
361
+ foreign_key: :paranoid_time_id,
362
+ polymorphic: true, with_deleted: true
317
363
 
318
- belongs_to :paranoid_belongs_dependant, :dependent => :destroy
364
+ belongs_to :paranoid_belongs_dependant, dependent: :destroy
319
365
  end
320
366
 
321
367
  class ParanoidBelongsDependant < ActiveRecord::Base
@@ -333,13 +379,14 @@ end
333
379
  class ParanoidWithCallback < ActiveRecord::Base
334
380
  acts_as_paranoid
335
381
 
336
- attr_accessor :called_before_destroy, :called_after_destroy, :called_after_commit_on_destroy
337
- attr_accessor :called_before_recover, :called_after_recover
382
+ attr_accessor :called_before_destroy, :called_after_destroy,
383
+ :called_after_commit_on_destroy, :called_before_recover,
384
+ :called_after_recover
338
385
 
339
386
  before_destroy :call_me_before_destroy
340
387
  after_destroy :call_me_after_destroy
341
388
 
342
- after_commit :call_me_after_commit_on_destroy, :on => :destroy
389
+ after_commit :call_me_after_commit_on_destroy, on: :destroy
343
390
 
344
391
  before_recover :call_me_before_recover
345
392
  after_recover :call_me_after_recover
@@ -372,14 +419,14 @@ end
372
419
 
373
420
  class ParanoidDestroyCompany < ActiveRecord::Base
374
421
  acts_as_paranoid
375
- validates :name, :presence => true
376
- has_many :paranoid_products, :dependent => :destroy
422
+ validates :name, presence: true
423
+ has_many :paranoid_products, dependent: :destroy
377
424
  end
378
425
 
379
426
  class ParanoidDeleteCompany < ActiveRecord::Base
380
427
  acts_as_paranoid
381
- validates :name, :presence => true
382
- has_many :paranoid_products, :dependent => :delete_all
428
+ validates :name, presence: true
429
+ has_many :paranoid_products, dependent: :delete_all
383
430
  end
384
431
 
385
432
  class ParanoidProduct < ActiveRecord::Base
@@ -395,22 +442,21 @@ class SuperParanoid < ActiveRecord::Base
395
442
  end
396
443
 
397
444
  class HasManyInheritedSuperParanoidz < ActiveRecord::Base
398
- has_many :super_paranoidz, :class_name => "InheritedParanoid", :dependent => :destroy
445
+ has_many :super_paranoidz, class_name: "InheritedParanoid", dependent: :destroy
399
446
  end
400
447
 
401
448
  class InheritedParanoid < SuperParanoid
402
449
  acts_as_paranoid
403
450
  end
404
451
 
405
-
406
452
  class ParanoidManyManyParentLeft < ActiveRecord::Base
407
453
  has_many :paranoid_many_many_children
408
- has_many :paranoid_many_many_parent_rights, :through => :paranoid_many_many_children
454
+ has_many :paranoid_many_many_parent_rights, through: :paranoid_many_many_children
409
455
  end
410
456
 
411
457
  class ParanoidManyManyParentRight < ActiveRecord::Base
412
458
  has_many :paranoid_many_many_children
413
- has_many :paranoid_many_many_parent_lefts, :through => :paranoid_many_many_children
459
+ has_many :paranoid_many_many_parent_lefts, through: :paranoid_many_many_children
414
460
  end
415
461
 
416
462
  class ParanoidManyManyChild < ActiveRecord::Base
@@ -421,21 +467,21 @@ end
421
467
 
422
468
  class ParanoidWithScopedValidation < ActiveRecord::Base
423
469
  acts_as_paranoid
424
- validates_uniqueness_of :name, :scope => :category
470
+ validates_uniqueness_of :name, scope: :category
425
471
  end
426
472
 
427
473
  class ParanoidBelongsToPolymorphic < ActiveRecord::Base
428
474
  acts_as_paranoid
429
- belongs_to :parent, :polymorphic => true, :with_deleted => true
475
+ belongs_to :parent, polymorphic: true, with_deleted: true
430
476
  end
431
477
 
432
478
  class NotParanoidHasManyAsParent < ActiveRecord::Base
433
- has_many :paranoid_belongs_to_polymorphics, :as => :parent, :dependent => :destroy
479
+ has_many :paranoid_belongs_to_polymorphics, as: :parent, dependent: :destroy
434
480
  end
435
481
 
436
482
  class ParanoidHasManyAsParent < ActiveRecord::Base
437
483
  acts_as_paranoid
438
- has_many :paranoid_belongs_to_polymorphics, :as => :parent, :dependent => :destroy
484
+ has_many :paranoid_belongs_to_polymorphics, as: :parent, dependent: :destroy
439
485
  end
440
486
 
441
487
  class ParanoidBaseTest < ActiveSupport::TestCase
@@ -443,13 +489,13 @@ class ParanoidBaseTest < ActiveSupport::TestCase
443
489
  setup_db
444
490
 
445
491
  ["paranoid", "really paranoid", "extremely paranoid"].each do |name|
446
- ParanoidTime.create! :name => name
447
- ParanoidBoolean.create! :name => name
492
+ ParanoidTime.create! name: name
493
+ ParanoidBoolean.create! name: name
448
494
  end
449
495
 
450
- ParanoidString.create! :name => "strings can be paranoid"
451
- NotParanoid.create! :name => "no paranoid goals"
452
- ParanoidWithCallback.create! :name => "paranoid with callbacks"
496
+ ParanoidString.create! name: "strings can be paranoid"
497
+ NotParanoid.create! name: "no paranoid goals"
498
+ ParanoidWithCallback.create! name: "paranoid with callbacks"
453
499
  end
454
500
 
455
501
  def teardown
@@ -483,9 +529,9 @@ class ParanoidForest < ActiveRecord::Base
483
529
 
484
530
  ActiveRecord::Base.logger = Logger.new(StringIO.new)
485
531
 
486
- scope :rainforest, lambda{ where(:rainforest => true) }
532
+ scope :rainforest, -> { where(rainforest: true) }
487
533
 
488
- has_many :paranoid_trees, :dependent => :destroy
534
+ has_many :paranoid_trees, dependent: :destroy
489
535
  end
490
536
 
491
537
  class ParanoidTree < ActiveRecord::Base
@@ -496,7 +542,7 @@ end
496
542
 
497
543
  class ParanoidPolygon < ActiveRecord::Base
498
544
  acts_as_paranoid
499
- default_scope { where('sides = ?', 3) }
545
+ default_scope { where("sides = ?", 3) }
500
546
  end
501
547
 
502
548
  class ParanoidAndroid < ActiveRecord::Base
@@ -506,11 +552,11 @@ end
506
552
  class ParanoidSection < ActiveRecord::Base
507
553
  acts_as_paranoid
508
554
  belongs_to :paranoid_time
509
- belongs_to :paranoid_thing, :polymorphic => true, :dependent => :destroy
555
+ belongs_to :paranoid_thing, polymorphic: true, dependent: :destroy
510
556
  end
511
557
 
512
558
  class ParanoidBooleanNotNullable < ActiveRecord::Base
513
- acts_as_paranoid column: 'deleted', column_type: 'boolean', allow_nulls: false
559
+ acts_as_paranoid column: "deleted", column_type: "boolean", allow_nulls: false
514
560
  end
515
561
 
516
562
  class ParanoidWithExplicitTableNameAfterMacro < ActiveRecord::Base
@@ -1,4 +1,6 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
2
4
 
3
5
  class InheritanceTest < ParanoidBaseTest
4
6
  def test_destroy_dependents_with_inheritance
@@ -1,20 +1,22 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
2
4
 
3
5
  class RelationsTest < ParanoidBaseTest
4
6
  def setup
5
7
  setup_db
6
8
 
7
- @paranoid_forest_1 = ParanoidForest.create! :name => "ParanoidForest #1"
8
- @paranoid_forest_2 = ParanoidForest.create! :name => "ParanoidForest #2", :rainforest => true
9
- @paranoid_forest_3 = ParanoidForest.create! :name => "ParanoidForest #3", :rainforest => true
9
+ @paranoid_forest_1 = ParanoidForest.create! name: "ParanoidForest #1"
10
+ @paranoid_forest_2 = ParanoidForest.create! name: "ParanoidForest #2", rainforest: true
11
+ @paranoid_forest_3 = ParanoidForest.create! name: "ParanoidForest #3", rainforest: true
10
12
 
11
13
  assert_equal 3, ParanoidForest.count
12
14
  assert_equal 2, ParanoidForest.rainforest.count
13
15
 
14
- @paranoid_forest_1.paranoid_trees.create! :name => 'ParanoidTree #1'
15
- @paranoid_forest_1.paranoid_trees.create! :name => 'ParanoidTree #2'
16
- @paranoid_forest_2.paranoid_trees.create! :name => 'ParanoidTree #3'
17
- @paranoid_forest_2.paranoid_trees.create! :name => 'ParanoidTree #4'
16
+ @paranoid_forest_1.paranoid_trees.create! name: "ParanoidTree #1"
17
+ @paranoid_forest_1.paranoid_trees.create! name: "ParanoidTree #2"
18
+ @paranoid_forest_2.paranoid_trees.create! name: "ParanoidTree #3"
19
+ @paranoid_forest_2.paranoid_trees.create! name: "ParanoidTree #4"
18
20
 
19
21
  assert_equal 4, ParanoidTree.count
20
22
  end
@@ -86,13 +88,15 @@ class RelationsTest < ParanoidBaseTest
86
88
  assert_equal 2, @paranoid_forest_2.paranoid_trees.with_deleted.count
87
89
  end
88
90
 
89
- def test_real_removal_through_relation
90
- # destroy!: aliased to delete
91
+ def test_real_removal_through_relation_with_destroy_bang
92
+ # Relation.destroy!: aliased to delete
91
93
  ParanoidForest.rainforest.destroy!(@paranoid_forest_3)
92
94
  assert_equal 1, ParanoidForest.rainforest.count
93
95
  assert_equal 1, ParanoidForest.rainforest.with_deleted.count
94
96
  assert_equal 0, ParanoidForest.rainforest.only_deleted.count
97
+ end
95
98
 
99
+ def test_two_step_real_removal_through_relation_with_destroy
96
100
  # destroy: two-step through a relation
97
101
  paranoid_tree = @paranoid_forest_1.paranoid_trees.first
98
102
  @paranoid_forest_1.paranoid_trees.order(:id).destroy(paranoid_tree.id)
@@ -100,14 +104,18 @@ class RelationsTest < ParanoidBaseTest
100
104
  assert_equal 1, @paranoid_forest_1.paranoid_trees.count
101
105
  assert_equal 1, @paranoid_forest_1.paranoid_trees.with_deleted.count
102
106
  assert_equal 0, @paranoid_forest_1.paranoid_trees.only_deleted.count
107
+ end
103
108
 
109
+ def test_two_step_real_removal_through_relation_with_destroy_all
104
110
  # destroy_all: two-step through a relation
105
111
  @paranoid_forest_1.paranoid_trees.order(:id).destroy_all
106
112
  @paranoid_forest_1.paranoid_trees.only_deleted.destroy_all
107
113
  assert_equal 0, @paranoid_forest_1.paranoid_trees.count
108
114
  assert_equal 0, @paranoid_forest_1.paranoid_trees.with_deleted.count
109
115
  assert_equal 0, @paranoid_forest_1.paranoid_trees.only_deleted.count
116
+ end
110
117
 
118
+ def test_real_removal_through_relation_with_delete_all_bang
111
119
  # delete_all!: through a relation
112
120
  @paranoid_forest_2.paranoid_trees.order(:id).delete_all!
113
121
  assert_equal 0, @paranoid_forest_2.paranoid_trees.count
@@ -1,8 +1,10 @@
1
- require 'test_helper'
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
2
4
 
3
5
  class ValidatesUniquenessTest < ParanoidBaseTest
4
6
  def test_should_include_deleted_by_default
5
- ParanoidTime.new(:name => 'paranoid').tap do |record|
7
+ ParanoidTime.new(name: "paranoid").tap do |record|
6
8
  assert !record.valid?
7
9
  ParanoidTime.first.destroy
8
10
  assert !record.valid?
@@ -12,7 +14,7 @@ class ValidatesUniquenessTest < ParanoidBaseTest
12
14
  end
13
15
 
14
16
  def test_should_validate_without_deleted
15
- ParanoidBoolean.new(:name => 'paranoid').tap do |record|
17
+ ParanoidBoolean.new(name: "paranoid").tap do |record|
16
18
  refute record.valid?
17
19
  ParanoidBoolean.first.destroy
18
20
  assert record.valid?
@@ -22,8 +24,8 @@ class ValidatesUniquenessTest < ParanoidBaseTest
22
24
  end
23
25
 
24
26
  def test_models_with_scoped_validations_can_be_multiply_deleted
25
- model_a = ParanoidWithScopedValidation.create(:name => "Model A", :category => "Category A")
26
- model_b = ParanoidWithScopedValidation.create(:name => "Model B", :category => "Category B")
27
+ model_a = ParanoidWithScopedValidation.create(name: "Model A", category: "Category A")
28
+ model_b = ParanoidWithScopedValidation.create(name: "Model B", category: "Category B")
27
29
 
28
30
  ParanoidWithScopedValidation.delete([model_a.id, model_b.id])
29
31
 
@@ -32,8 +34,8 @@ class ValidatesUniquenessTest < ParanoidBaseTest
32
34
  end
33
35
 
34
36
  def test_models_with_scoped_validations_can_be_multiply_destroyed
35
- model_a = ParanoidWithScopedValidation.create(:name => "Model A", :category => "Category A")
36
- model_b = ParanoidWithScopedValidation.create(:name => "Model B", :category => "Category B")
37
+ model_a = ParanoidWithScopedValidation.create(name: "Model A", category: "Category A")
38
+ model_b = ParanoidWithScopedValidation.create(name: "Model B", category: "Category B")
37
39
 
38
40
  ParanoidWithScopedValidation.destroy([model_a.id, model_b.id])
39
41