Module: Watir::Assertions
Overview
Verification methods used by Watir::TestCase
Instance Method Summary collapse
-
#verify(boolean, message = 'verify failed.') ⇒ Object
Log a failure if the boolean is true.
- #verify_equal(expected, actual, message = nil) ⇒ Object
- #verify_match(pattern, string, message = nil) ⇒ Object
Instance Method Details
#verify(boolean, message = 'verify failed.') ⇒ Object
Log a failure if the boolean is true. The message is the failure message logged. Whether true or false, the assertion count is incremented.
11 12 13 14 |
# File 'lib/watir/assertions.rb', line 11 def verify boolean, = 'verify failed.' add_assertion add_failure .to_s, caller unless boolean end |
#verify_equal(expected, actual, message = nil) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/watir/assertions.rb', line 16 def verify_equal expected, actual, =nil = (, <<EOT, expected, actual) <?> expected but was <?>. EOT verify(expected == actual, ) end |
#verify_match(pattern, string, message = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/watir/assertions.rb', line 23 def verify_match pattern, string, =nil pattern = case(pattern) when String Regexp.new(Regexp.escape(pattern)) else pattern end = (, "<?> expected to be =~\n<?>.", string, pattern) verify(string =~ pattern, ) end |