slacker 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'csv'
|
2
2
|
|
3
3
|
module Slacker
|
4
|
+
DATE_FORMAT = "%m/%d/%Y"
|
5
|
+
|
4
6
|
class QueryResultMatcher
|
5
7
|
def initialize(golden_master)
|
6
8
|
@golden_master = golden_master
|
@@ -94,8 +96,15 @@ module Slacker
|
|
94
96
|
def match_values?(master_val, subject_val)
|
95
97
|
if master_val.nil?
|
96
98
|
master_val == subject_val
|
97
|
-
elsif
|
98
|
-
|
99
|
+
elsif master_val.kind_of?(String)
|
100
|
+
case subject_val
|
101
|
+
when ODBC::TimeStamp
|
102
|
+
(!!Time.strptime(master_val, DATE_FORMAT) rescue false) && Time.strptime(master_val, DATE_FORMAT) == ODBC::to_time(subject_val)
|
103
|
+
when Float
|
104
|
+
(!!Float(master_val) rescue false) && Float(master_val) == subject_val
|
105
|
+
else
|
106
|
+
subject_val.to_s == master_val.to_s
|
107
|
+
end
|
99
108
|
else
|
100
109
|
subject_val.to_s == master_val.to_s
|
101
110
|
end
|
data/lib/slacker/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'slacker'
|
2
2
|
require 'spec_helper'
|
3
3
|
require 'time'
|
4
|
+
require 'odbc'
|
4
5
|
|
5
6
|
describe Slacker::QueryResultMatcher do
|
6
7
|
def deep_copy(obj)
|
@@ -9,7 +10,7 @@ describe Slacker::QueryResultMatcher do
|
|
9
10
|
|
10
11
|
before(:each) do
|
11
12
|
@subject = [{'Field 1' => 12, 'Field_2' => nil, 'b' => ''},
|
12
|
-
{'Field 1' => 'test string', 'Field_2' =>
|
13
|
+
{'Field 1' => 'test string', 'Field_2' => ODBC::TimeStamp.new('2011-01-30'), 'b' => 8.9}]
|
13
14
|
end
|
14
15
|
|
15
16
|
shared_examples_for 'table-based matcher' do
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: slacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Vassil Kovatchev
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-29 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|