rspec-all_records_validator 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +12 -1
- data/lib/rspec/all_records_validator/version.rb +1 -1
- data/lib/rspec/all_records_validator.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3ababcff1dab5b455e5e6aba00a8543a64f6c1ec8bf8473421379f643e27b43
|
4
|
+
data.tar.gz: 0c541b63d4ff5594a80c569ab5e74b2c12c94294e3f03240532c9ac5efea58b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1317679c0a865737fff766a8c52bc36744ed3614a1cec199cf5fc9417cf973dcf86b2c2c1f744509b6118e496b9a438e8dd3bc04a529c64a509e28286fb72cdb
|
7
|
+
data.tar.gz: 85b9e61b9ac6a8e76a4fd4d243fa7a36095ebcf096c8f7ab1fb42db0a86ce5006cb26a63a80d21f11d0982da62706ee264823c127ff055a70636f3e7aa316d79
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RSpec::AllRecordsValidator
|
2
2
|
|
3
|
-
Check all ActiveRecord object validation
|
3
|
+
Check all ActiveRecord object validation after system spec.
|
4
4
|
|
5
5
|
This gem is designed for: [rspec-rails](https://github.com/rspec/rspec-rails)
|
6
6
|
|
@@ -48,6 +48,17 @@ RSpec.configure do |config|
|
|
48
48
|
end
|
49
49
|
```
|
50
50
|
|
51
|
+
#### Avoid validation for model whitch has no `has_many` association
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
RSpec.configure do |config|
|
55
|
+
config.after type: :system do
|
56
|
+
RSpec::AllRecordsValidator.validate!(only_has_many: true)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
|
51
62
|
#### For feature spec
|
52
63
|
|
53
64
|
You can config This setting for feature spec
|
@@ -4,8 +4,8 @@ require_relative "all_records_validator/version"
|
|
4
4
|
|
5
5
|
module RSpec
|
6
6
|
module AllRecordsValidator
|
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? }
|
7
|
+
def self.validate!(ignored_models: [], only_has_many: false)
|
8
|
+
target_classes = ApplicationRecord.subclasses.reject {|klass| klass.abstract_class? || ignored_models.include?(klass) || (only_has_many && klass.reflect_on_all_associations(:has_many).blank?) }
|
9
9
|
|
10
10
|
target_classes.each do |klass|
|
11
11
|
klass.all.each do |obj|
|
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.9
|
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-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
requirements: []
|
99
|
-
rubygems_version: 3.
|
99
|
+
rubygems_version: 3.3.4
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: validate all objects at end of system spec
|