Class: Dbtap::SetEq
Overview
Tests to see if two sets of results are equal
Sets is a bit of a misnomer in that if a query returns duplicate rows, those rows are NOT deduplicated.
The order in which either query returns the results is ignored when testing for equality.
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
Attributes inherited from Tester
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(actual, expected, name = nil) ⇒ SetEq
constructor
actual- The query being testedexpected- The set of results expected. - #ok? ⇒ Boolean
Methods inherited from Tester
Constructor Details
#initialize(actual, expected, name = nil) ⇒ SetEq
actual - The query being tested expected - The set of results expected. Should be another query. name - (optional) the name of the test
18 19 20 21 22 |
# File 'lib/dbtap/testers/set_eq.rb', line 18 def initialize(actual, expected, name = nil) @name = name @actual = actual @expected = expected end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
13 14 15 |
# File 'lib/dbtap/testers/set_eq.rb', line 13 def actual @actual end |
Instance Method Details
#errors ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dbtap/testers/set_eq.rb', line 28 def errors drop_csv output = [] unless missing.empty? output << "Missing #{missing.count}/#{expected_count} Records:" output << ' ' + missing.first.inspect end unless extras.empty? output << "Extra #{extras.count} over #{expected_count} Records:" output << ' ' + extras.first.inspect end end |
#ok? ⇒ Boolean
24 25 26 |
# File 'lib/dbtap/testers/set_eq.rb', line 24 def ok? missing.empty? && extras.empty? end |