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.
@@ -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