lib/test_support/cucumber/support/values.rb in sniff-0.1.12 vs lib/test_support/cucumber/support/values.rb in sniff-0.1.13
- old
+ new
@@ -1,6 +1,7 @@
require 'date'
+require 'active_support'
def coerce_value(value)
# what is this, PHP?
if value.nil?
nil
@@ -16,12 +17,12 @@
value
end
end
def compare_values(a, b)
- if b.nil? or b.empty?
- a.should be_empty
+ if b.blank?
+ a.should be_blank
elsif a.is_a? Date or a.is_a? Time
b = Date.parse b
a.should == b
elsif b =~ /\d+\.\d+/
b = b.to_f
@@ -33,11 +34,11 @@
a.should == b
end
end
def equality?(a, b)
- if b.nil? or b.empty?
- a.nil?
+ if b.blank?
+ a.blank?
elsif a.is_a? Date or a.is_a? Time
b = Date.parse b
a == b
elsif b =~ /\d+\.\d+/
(a.to_f - b.to_f).abs <= 0.00001