sniff 0.1.5 → 0.1.6
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.
@@ -75,14 +75,22 @@ end
|
|
75
75
|
|
76
76
|
Then /^the conclusion of the committee should have "(.*)" of "(.*)"$/ do |attribute, value|
|
77
77
|
report_value = coerce_value @report.conclusion.send(attribute)
|
78
|
-
report_value
|
78
|
+
compare_values report_value, value
|
79
|
+
end
|
80
|
+
|
81
|
+
Then /^the conclusion of the committee should include "(.*)"$/ do |value|
|
82
|
+
result = @report.conclusion.find do |item|
|
83
|
+
equality? item, value
|
84
|
+
end
|
85
|
+
result.should_not be_nil
|
79
86
|
end
|
80
87
|
|
81
88
|
Then /^the conclusion of the committee should have a record identified with "(.*)" of "(.*)" and having "(.*)" of "(.*)"$/ do |id_field, id, field, value|
|
82
89
|
id_field = id_field.to_sym
|
83
90
|
records = @report.conclusion
|
84
|
-
record = records.to_a.find { |r| r.send(id_field)
|
85
|
-
|
91
|
+
record = records.to_a.find { |r| equality? r.send(id_field), id }
|
92
|
+
record.should_not be_nil
|
93
|
+
compare_values record.send(field), value
|
86
94
|
end
|
87
95
|
|
88
96
|
Then /^the conclusion of the committee should have a record identified with "(.*)" of "(.*)" and having "(.*)" including "(.*)"$/ do |id_field, id, field, values|
|
@@ -33,3 +33,18 @@ def compare_values(a, b)
|
|
33
33
|
a.should == b
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
def equality?(a, b)
|
38
|
+
if b.nil? or b.empty?
|
39
|
+
a.nil?
|
40
|
+
elsif a.is_a? Date or a.is_a? Time
|
41
|
+
b = Date.parse b
|
42
|
+
a == b
|
43
|
+
elsif b =~ /\d+\.\d+/
|
44
|
+
(a.to_f - b.to_f).abs <= 0.00001
|
45
|
+
elsif b =~ /^\d+$/
|
46
|
+
a.to_i == b.to_i
|
47
|
+
else
|
48
|
+
a == b
|
49
|
+
end
|
50
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sniff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Derek Kastner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-11 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|