database_consistency 0.2.0 → 0.2.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.
- checksums.yaml +4 -4
- data/lib/database_consistency/column_verifiers/presence_missing_verifier.rb +1 -1
- data/lib/database_consistency/comparators/base_comparator.rb +5 -4
- data/lib/database_consistency/comparators/presence_comparator.rb +1 -1
- data/lib/database_consistency/helper.rb +2 -2
- data/lib/database_consistency/validators_processor.rb +1 -1
- data/lib/database_consistency/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86853e78b9e1bb68f9e34dbea3b23de33890760a3598b954cd8e89f3ddf88193
|
4
|
+
data.tar.gz: '082c7135a3057bbe59b78d463b62fd522cfcfc3bd0c8b452bb591375d72d962d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a82a054afba3dac8b0c75bbfaeab357f4c9f9c20d50f854cf0ae30442dbcae1dd18d4223c6e5d31545aa8927c0cd16c243bdc45aeca25102e2a74bee5da097b7
|
7
|
+
data.tar.gz: e0a898d8f10bbf2c47ec4fd397f1b2f01f4696f0ee23bcce47c6ee0d2efa4a2aa0d5caefc219f621fa14701d86fb3aecad3ff414190efbf4542360c5a7f2085c
|
@@ -5,7 +5,7 @@ module DatabaseConsistency
|
|
5
5
|
VALIDATOR_MISSING = 'is required but do not have presence validator'.freeze
|
6
6
|
|
7
7
|
def verify
|
8
|
-
result(:fail, Helper.message(column, VALIDATOR_MISSING)) unless skip? || validator?
|
8
|
+
result(:fail, Helper.message(model, column, VALIDATOR_MISSING)) unless skip? || validator?
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
@@ -2,12 +2,13 @@ module DatabaseConsistency
|
|
2
2
|
module Comparators
|
3
3
|
# The base class for comparators
|
4
4
|
class BaseComparator
|
5
|
-
attr_reader :validator, :column
|
5
|
+
attr_reader :validator, :model, :column
|
6
6
|
|
7
7
|
delegate :result, to: :report
|
8
8
|
|
9
|
-
def initialize(validator, column)
|
9
|
+
def initialize(validator, model, column)
|
10
10
|
@validator = validator
|
11
|
+
@model = model
|
11
12
|
@column = column
|
12
13
|
end
|
13
14
|
|
@@ -15,8 +16,8 @@ module DatabaseConsistency
|
|
15
16
|
Report.new(validator: validator, column: column)
|
16
17
|
end
|
17
18
|
|
18
|
-
def self.compare(validator, column)
|
19
|
-
new(validator, column).compare
|
19
|
+
def self.compare(validator, model, column)
|
20
|
+
new(validator, model, column).compare
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -19,8 +19,8 @@ module DatabaseConsistency
|
|
19
19
|
end
|
20
20
|
|
21
21
|
# @return [String]
|
22
|
-
def message(column, template = nil)
|
23
|
-
str = "column #{column.name} of table #{
|
22
|
+
def message(model, column, template = nil)
|
23
|
+
str = "column #{column.name} of table #{model.table_name}"
|
24
24
|
str += " #{template}" if template
|
25
25
|
str
|
26
26
|
end
|