rulezilla 0.1.5 → 0.4.0.pre.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 +5 -5
- data/.github/workflows/ci.yaml +36 -0
- data/.github/workflows/codeql-analysis.yaml +70 -0
- data/.github/workflows/dobby-actions.yml +29 -0
- data/.github/workflows/gem-publish.yaml +46 -0
- data/.github/workflows/version-forget-me-not.yaml +19 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +61 -0
- data/.ruby-version +1 -0
- data/CODEOWNERS +3 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +9 -0
- data/README.md +1 -19
- data/catalog-info.yaml +8 -0
- data/lib/rulezilla/basic_support.rb +3 -3
- data/lib/rulezilla/dsl.rb +27 -14
- data/lib/rulezilla/node.rb +3 -0
- data/lib/rulezilla/tree.rb +20 -13
- data/lib/rulezilla/version.rb +3 -1
- data/lib/rulezilla.rb +2 -31
- data/rulezilla.gemspec +12 -9
- data/spec/features/step_definitions/rulezilla_dsl_framework_steps.rb +36 -54
- data/spec/spec_helper.rb +33 -13
- metadata +29 -27
- data/lib/rulezilla/rule_builder/gherkin_to_condition_rule.rb +0 -63
- data/lib/rulezilla/rule_builder/gherkin_to_result_rule.rb +0 -49
- data/lib/rulezilla/rule_builder.rb +0 -101
- data/spec/features/gherkin_dsl_framework.feature +0 -90
- data/spec/features/gherkin_rules/animal_rule.feature +0 -16
- data/spec/features/gherkin_rules/duration_rule.feature +0 -14
- data/spec/features/step_definitions/rule_steps.rb +0 -64
@@ -1,64 +0,0 @@
|
|
1
|
-
steps_for :rule_steps do
|
2
|
-
|
3
|
-
step 'this is a "cat"' do
|
4
|
-
@records = [{cat?: true}]
|
5
|
-
end
|
6
|
-
|
7
|
-
step 'the :field is :value' do |field, value|
|
8
|
-
record ||= {}
|
9
|
-
field = field.gsub(/\s/,'_').downcase
|
10
|
-
|
11
|
-
value = case value
|
12
|
-
when 'blank'
|
13
|
-
""
|
14
|
-
when /^less than \d+ digits$/i
|
15
|
-
value.scan(/^less than \d+ digits$/i).flatten.first.to_i.times.map{Random.rand(10)}.join
|
16
|
-
else
|
17
|
-
value
|
18
|
-
end
|
19
|
-
|
20
|
-
record[field] = value
|
21
|
-
@records = [record]
|
22
|
-
end
|
23
|
-
|
24
|
-
step 'the :field is in:' do |field, values|
|
25
|
-
@records = []
|
26
|
-
field = field.gsub(/\s/,'_').downcase
|
27
|
-
values.raw.flatten.each do |telephone_number|
|
28
|
-
@records << { field => telephone_number }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
step 'this is an animal' do
|
33
|
-
@records.each do |record|
|
34
|
-
expect(Rulezilla::AnimalRule.apply(record)).to eq true
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
step 'this is not an animal' do
|
39
|
-
@records.each do |record|
|
40
|
-
expect(Rulezilla::AnimalRule.apply(record)).to eq false
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
step 'none of the above' do
|
45
|
-
@records = [{telephone_number: '09827364755'}]
|
46
|
-
end
|
47
|
-
|
48
|
-
step 'the duration is :day days' do |day|
|
49
|
-
send 'the duration is :second seconds', day.to_i * 86400
|
50
|
-
end
|
51
|
-
|
52
|
-
step 'the duration is :hour hours' do |hour|
|
53
|
-
send 'the duration is :second seconds', hour.to_i * 3600
|
54
|
-
end
|
55
|
-
|
56
|
-
step 'the duration is :minute minute' do |minute|
|
57
|
-
send 'the duration is :second seconds', minute.to_i * 60
|
58
|
-
end
|
59
|
-
|
60
|
-
step 'the duration is :second seconds' do |second|
|
61
|
-
expect(Rulezilla::DurationRule.apply(@records.first)).to eq second.to_i
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|