rspec-all_records_validator 0.0.5 → 0.0.8
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 +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -1
- data/README.md +16 -4
- data/Rakefile +5 -0
- data/lib/rspec/all_records_validator/version.rb +1 -1
- data/lib/rspec/all_records_validator.rb +3 -3
- data/rspec-all_records_validator.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0da551a4d19bd91c56db0df055e0ccce29a7469720af06915275d7f93cdf072c
|
4
|
+
data.tar.gz: 471cb24243e463610d6187ba4063b4a75b823a916a2bf132f78191b4912cf2cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c632ec00543ce159224cad00385185188557b228a1fa061ecd8dccbbac6ab4d28dbf23a85b894a4bc51be4cc0c80ea1998e2de0bae25f1b2d70b413c2bd18f6
|
7
|
+
data.tar.gz: 455bfe9df39819ad1f03083b76e4333d7ea012001750579adedf79828fc6c26607cbb2f3c1db0903bb49023b58a546979b481a5042d290a9a1a88a8b6cc9764c
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rspec-all_records_validator (0.0.
|
4
|
+
rspec-all_records_validator (0.0.8)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -171,6 +171,7 @@ PLATFORMS
|
|
171
171
|
x86_64-linux
|
172
172
|
|
173
173
|
DEPENDENCIES
|
174
|
+
activerecord
|
174
175
|
rails
|
175
176
|
rake
|
176
177
|
rspec
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RSpec::AllRecordsValidator
|
2
2
|
|
3
|
-
Check all ActiveRecord object validation after system spec.
|
3
|
+
Check all ActiveRecord object validation which has `has_many` association after system spec.
|
4
4
|
|
5
5
|
This gem is designed for: [rspec-rails](https://github.com/rspec/rspec-rails)
|
6
6
|
|
@@ -31,7 +31,7 @@ require 'rspec/all_records_validator'
|
|
31
31
|
|
32
32
|
RSpec.configure do |config|
|
33
33
|
config.after type: :system do
|
34
|
-
RSpec::AllRecordsValidator.
|
34
|
+
RSpec::AllRecordsValidator.validate!
|
35
35
|
end
|
36
36
|
end
|
37
37
|
```
|
@@ -43,7 +43,7 @@ You can avoid validation for specific models:
|
|
43
43
|
```ruby
|
44
44
|
RSpec.configure do |config|
|
45
45
|
config.after type: :system do
|
46
|
-
RSpec::AllRecordsValidator.
|
46
|
+
RSpec::AllRecordsValidator.validate!(ignored_models: [DoNotValidateThisModel])
|
47
47
|
end
|
48
48
|
end
|
49
49
|
```
|
@@ -55,7 +55,19 @@ You can config This setting for feature spec
|
|
55
55
|
```ruby
|
56
56
|
RSpec.configure do |config|
|
57
57
|
config.after type: :feature do
|
58
|
-
RSpec::AllRecordsValidator.
|
58
|
+
RSpec::AllRecordsValidator.validate!
|
59
59
|
end
|
60
60
|
end
|
61
61
|
```
|
62
|
+
|
63
|
+
### Pro Tip
|
64
|
+
|
65
|
+
If you use fixture or master data, ignore them is good for speed.
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
RSpec::AllRecordsValidator.validate!(ignored_models: [MasterDataModel])
|
69
|
+
```
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Send me your pull requests.
|
data/Rakefile
CHANGED
@@ -4,12 +4,12 @@ require_relative "all_records_validator/version"
|
|
4
4
|
|
5
5
|
module RSpec
|
6
6
|
module AllRecordsValidator
|
7
|
-
def self.
|
8
|
-
target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? ||
|
7
|
+
def self.validate!(ignored_models: [])
|
8
|
+
target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? || ignored_models.include?(klass) || klass.reflect_on_all_associations(:has_many).blank? }
|
9
9
|
|
10
10
|
target_classes.each do |klass|
|
11
11
|
klass.all.each do |obj|
|
12
|
-
|
12
|
+
obj.validate!
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.summary = "validate all objects at end of system spec"
|
12
12
|
spec.homepage = "https://github.com/colorbox/rspec-all_records_validator"
|
13
13
|
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-all_records_validator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- colorbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -89,14 +89,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: 2.
|
92
|
+
version: 2.7.0
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.2.33
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: validate all objects at end of system spec
|