Skip to content

Commit f1c1a0b

Browse files
authored
Merge pull request #16 from moertel/fuzzy-match-today
Fuzzy match today and yesterday
2 parents 6e6bdee + 3d88391 commit f1c1a0b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/squcumber-postgres/support/matchers.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ def values_match(actual, expected)
66
actual.match(/#{Regexp.quote((Date.today - 1).to_s)}/)
77
elsif expected.eql?('any_date')
88
actual.match(/^\d{4}\-\d{2}\-\d{2} \d{2}:\d{2}:\d{2}$/)
9+
elsif expected.eql?('sometime today')
10+
actual.match(/^#{Regexp.quote(Date.today.to_s)} \d{2}:\d{2}:\d{2}$/)
11+
elsif expected.eql?('sometime yesterday')
12+
actual.match(/^#{Regexp.quote((Date.today - 1).to_s)} \d{2}:\d{2}:\d{2}$/)
913
elsif expected.eql?('any_string')
1014
true if actual.is_a?(String) or actual.nil?
1115
elsif expected.eql?('false') or expected.eql?('true')

0 commit comments

Comments
 (0)