Class: Expectation
- Inherits:
-
Object
show all
- Defined in:
- lib/dbexpect/expectations/expectation.rb
Overview
Copyright 2012 C3 Business Solutions
This file is part of dbexpect.
dbexpect is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
dbexpect is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with dbexpect. If not, see <http://www.gnu.org/licenses/>.
Instance Method Summary
collapse
Constructor Details
#initialize(db_name, schema, table) ⇒ Expectation
Returns a new instance of Expectation.
18
19
20
21
22
|
# File 'lib/dbexpect/expectations/expectation.rb', line 18
def initialize(db_name,schema,table)
@schema = schema
@table = table
@db_name = db_name
end
|
Instance Method Details
#failed_validation? ⇒ Boolean
38
39
40
|
# File 'lib/dbexpect/expectations/expectation.rb', line 38
def failed_validation?
@failure
end
|
#failure_message ⇒ Object
42
43
44
|
# File 'lib/dbexpect/expectations/expectation.rb', line 42
def failure_message
@failure
end
|
#validate_expectation(databases) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/dbexpect/expectations/expectation.rb', line 24
def validate_expectation(databases)
database = databases[@db_name]
begin
num = database.num_rows_match(@schema,@table,where_clause)
rescue OdbcConnection::DatabaseException => e
@failure = expect_msg + "instead database raised error: #{e.message}"
return
end
if num != @count
@failure = expect_msg + "got #{num}"
end
end
|