Class: ExpectationChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/dbexpect/expectation_checker.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 Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(databases) ⇒ ExpectationChecker

Returns a new instance of ExpectationChecker.



19
20
21
# File 'lib/dbexpect/expectation_checker.rb', line 19

def initialize(databases)
  @databases = databases
end

Instance Attribute Details

#failed_expectationsObject

Returns the value of attribute failed_expectations.



18
19
20
# File 'lib/dbexpect/expectation_checker.rb', line 18

def failed_expectations
  @failed_expectations
end

Instance Method Details

#check_expectations(expectations) ⇒ Object



23
24
25
26
27
# File 'lib/dbexpect/expectation_checker.rb', line 23

def check_expectations(expectations)
  expectations.map {|e| e.validate_expectation(@databases) }

  @failed_expectations = expectations.select {|e| e.failed_validation? }
end

#validates_expectations?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/dbexpect/expectation_checker.rb', line 29

def validates_expectations?
  @failed_expectations.empty?
end