ar_left_over_guardian 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9a2568d707a54c60cb4e0de80274111fdc1475f
4
- data.tar.gz: 062cb2df042522fcb8e93b06ccf3b0e23934b1ea
3
+ metadata.gz: 3d751711240250e9e26a880c0df29a57011ee837
4
+ data.tar.gz: 909e6714aab80a46565b4d840f49371956f489b4
5
5
  SHA512:
6
- metadata.gz: 0a8ffc8912d84cc23759a0eccbbcddefa8a6419350e4c49746589ba494b2cb5ce2dcd454ef8341b70f6a5bccb7bf824b42ca6fe140531e5a26e5872548873334
7
- data.tar.gz: 70a1d6334cc89f34ae169360348acca8bf6905c597c627c5b99909348f4ab8376962931cfa895ef5ecdf6f011ef5f450b4e9e9442c04d021c47c273e1a68d04d
6
+ metadata.gz: 17490e66bf5ac59a56eee3c3cbcfc34d055f815b352dda9e930d5372dd8b685db72253063d67a51afe7d189db139a177c5832c543715c5f79a3173d4dfd30202
7
+ data.tar.gz: 39948e4e1ba8daf578baac0dbedb3d1c76b4a81e0128db79793a80654aad8b3052897f8539665f09518b721bccfe0b46a33d3d447e70d34dce37e2e99c08f3e8
data/README.md CHANGED
@@ -28,7 +28,7 @@ Just make sure that it is run in the end of each of your tests.
28
28
  require 'ar_left_over_guardian'
29
29
 
30
30
  RSpec.configure do |config|
31
- left_over_guardian = ARLeftOverGuardian.init(ActiveRecord.descendants)
31
+ left_over_guardian = ARLeftOverGuardian.init(ActiveRecord::Base.descendants)
32
32
 
33
33
  # ...
34
34
 
@@ -1,3 +1,3 @@
1
1
  module ARLeftOverGuardian
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -10,7 +10,7 @@ module ARLeftOverGuardian
10
10
  class Instance
11
11
  def initialize(models)
12
12
  @models = models.reject(&method(:abstract?))
13
- @counts = current_counts
13
+ @counts = current_counts(false)
14
14
  end
15
15
 
16
16
  def verify
@@ -33,9 +33,9 @@ module ARLeftOverGuardian
33
33
  end
34
34
  end
35
35
 
36
- def current_counts
36
+ def current_counts(reset = true)
37
37
  models.map { |model|
38
- reset_model(model).count
38
+ reset_model(model, reset).count
39
39
  }
40
40
  end
41
41
 
@@ -43,7 +43,8 @@ module ARLeftOverGuardian
43
43
  model.respond_to?(:abstract_class?) && model.abstract_class?
44
44
  end
45
45
 
46
- def reset_model(model)
46
+ def reset_model(model, reset)
47
+ return model unless reset
47
48
  RSpec::Mocks.space.proxy_for(model).reset if defined?(RSpec::Mocks)
48
49
  model
49
50
  end
@@ -31,6 +31,11 @@ module CountFaker
31
31
  end
32
32
  end
33
33
 
34
+ def it_should_be_possible_to_init_it_out_of_example
35
+ ARLeftOverGuardian.init([NonARModel])
36
+ end
37
+ it_should_be_possible_to_init_it_out_of_example
38
+
34
39
  RSpec.describe ARLeftOverGuardian do
35
40
  include CountFaker
36
41
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_left_over_guardian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Fedorov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-23 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler