Sha256: fae73c6dbcd81daced58273fdc671339cbed6d22bd0287a313234f71ba365501
Contents?: true
Size: 573 Bytes
Versions: 3
Compression:
Stored size: 573 Bytes
Contents
require 'date' def coerce_value(value) # what is this, PHP? if value.nil? nil elsif value == 'true' true elsif value == 'false' false elsif value =~ /\d+\.\d+/ value.to_f elsif value =~ /^\d+$/ value.to_i else value end end def compare_values(a, b) if b.nil? or b.empty? a.should be_nil 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 a.should be_close(b, 0.00001) elsif b =~ /^\d+$/ b = b.to_i a.should == b else a.should == b end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sniff-0.1.5 | lib/test_support/cucumber/support/values.rb |
sniff-0.1.4 | lib/test_support/cucumber/support/values.rb |
sniff-0.1.3 | lib/test_support/cucumber/support/values.rb |