ae_easy-qa 0.0.30 → 0.0.31
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/ae_easy/qa/helpers.rb +20 -5
- data/lib/ae_easy/qa/validate_value.rb +2 -2
- data/lib/ae_easy/qa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 416c61a1278ed49302c21159cafdc417a98076530cd9645676d251f863f9e20d
|
4
|
+
data.tar.gz: f2c31c16cb3acbdbaf213c7b8b0990016b2a094b66284191ba6e205d9dc7d591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7cce174631df9b2f1b652b62512d18bf9de2b16cf2c2dfaced10f25f1743578b47cc5c48b2335274cff19e03d88b264444f1bff8b2acee13c8c258ed8bfac89
|
7
|
+
data.tar.gz: f36b9f6dad009c01f20d6865c380b4b01e790d0c7e2fdd946fcb2f9fc8b6e04be084b74c502007a9dcbd021636aac03088af239d49fcc41b807728acf819829e
|
data/lib/ae_easy/qa/helpers.rb
CHANGED
@@ -8,19 +8,34 @@ module AeEasy
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def pass_if?(if_params, data_hash)
|
11
|
-
|
12
|
-
|
11
|
+
case if_params.keys.first
|
12
|
+
when 'and', 'or'
|
13
|
+
operator = if_params.keys.first
|
14
|
+
evaluations = if_params[operator].collect{|child_if_params|
|
15
|
+
field_name = child_if_params.keys.first
|
16
|
+
condition_hash = child_if_params[field_name]
|
17
|
+
evaluate_condition(field_name, condition_hash, data_hash)
|
18
|
+
}
|
19
|
+
operator == 'and' ? evaluations.all? : evaluations.any?
|
20
|
+
else
|
21
|
+
field_name = if_params.keys.first
|
22
|
+
condition_hash = if_params[field_name]
|
23
|
+
evaluate_condition(field_name, condition_hash, data_hash)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def evaluate_condition(field_name, condition_hash, data_hash)
|
13
28
|
case condition_hash.keys.first
|
14
29
|
when 'value'
|
15
30
|
value_hash = condition_hash['value'] #Ex: {"equal"=>"A"}
|
16
31
|
if value_hash['equal']
|
17
32
|
data_hash[field_name] == value_hash['equal']
|
18
33
|
elsif value_hash['regex']
|
19
|
-
data_hash[field_name].to_s =~ Regexp.new(value_hash['regex'], true)
|
34
|
+
!(data_hash[field_name].to_s =~ Regexp.new(value_hash['regex'], true)).nil?
|
20
35
|
elsif value_hash['less_than']
|
21
|
-
data_hash[field_name] < value_hash['less_than']
|
36
|
+
data_hash[field_name].to_i < value_hash['less_than'].to_i
|
22
37
|
elsif value_hash['greater_than']
|
23
|
-
data_hash[field_name] > value_hash['greater_than']
|
38
|
+
data_hash[field_name].to_i > value_hash['greater_than'].to_i
|
24
39
|
else
|
25
40
|
raise StandardError.new("The if condition '#{value_hash}' is unknown.")
|
26
41
|
end
|
@@ -36,9 +36,9 @@ module AeEasy
|
|
36
36
|
elsif params['regex']
|
37
37
|
add_errored_item(data_hash, field_to_validate, 'value') if (data_hash[field_to_validate].to_s !~ Regexp.new(params['regex'], true))
|
38
38
|
elsif params['less_than']
|
39
|
-
add_errored_item(data_hash, field_to_validate, 'value') if !(data_hash[field_to_validate] < params['less_than'])
|
39
|
+
add_errored_item(data_hash, field_to_validate, 'value') if !(data_hash[field_to_validate].to_i < params['less_than'].to_i)
|
40
40
|
elsif params['greater_than']
|
41
|
-
add_errored_item(data_hash, field_to_validate, 'value') if !(data_hash[field_to_validate] > params['greater_than'])
|
41
|
+
add_errored_item(data_hash, field_to_validate, 'value') if !(data_hash[field_to_validate].to_i > params['greater_than'].to_i)
|
42
42
|
else
|
43
43
|
unknown_value_error
|
44
44
|
end
|
data/lib/ae_easy/qa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_easy-qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Lynam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: answersengine
|