Sha256: 1c638fcd5e4ec4189ca0b3b150776de6e15c5a67483f232546d14f0034d787a4

Contents?: true

Size: 1.31 KB

Versions: 36

Compression:

Stored size: 1.31 KB

Contents

require 'test/unit/assertions'

module Watir
  # Verification methods used by Watir::TestCase
  module Assertions
  include Test::Unit::Assertions
    
    # Log a failure if the boolean is true. The message is the failure
    # message logged.
    # Whether true or false, the assertion count is incremented.
    def verify boolean, message = 'verify failed.'
      add_assertion
      add_failure message.to_s, caller unless boolean
    end
    
    def verify_equal expected, actual, message=nil
      full_message = build_message(message, <<EOT, expected, actual)
<?> expected but was
<?>.
EOT
      verify(expected == actual, full_message)
    end
    def verify_match pattern, string, message=nil
      pattern = case(pattern)
      when String
        Regexp.new(Regexp.escape(pattern))
      else
        pattern
      end
      full_message = build_message(message, "<?> expected to be =~\n<?>.", string, pattern)
      verify(string =~ pattern, full_message)
    end
    
  end

end
module Test::Unit::Assertions
    def assert_false(boolean, message=nil)
        _wrap_assertion do
            assert_block("assert should not be called with a block.") { !block_given? }
            assert_block(build_message(message, "<?> is not false.", boolean)) { !boolean }
        end
    end
end 

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
watir-classic-3.0.0 lib/watir-classic/assertions.rb
commonwatir-3.0.0.rc3 lib/watir/assertions.rb
commonwatir-3.0.0.rc2 lib/watir/assertions.rb
commonwatir-3.0.0.rc1 lib/watir/assertions.rb
commonwatir-2.0.4 lib/watir/assertions.rb
commonwatir-2.0.3 lib/watir/assertions.rb
commonwatir-2.0.2 lib/watir/assertions.rb
commonwatir-2.0.2.rc1 lib/watir/assertions.rb
commonwatir-2.0.1 lib/watir/assertions.rb
commonwatir-2.0.0 lib/watir/assertions.rb
commonwatir-2.0.0.rc3 lib/watir/assertions.rb
commonwatir-2.0.0.rc2 lib/watir/assertions.rb
commonwatir-1.9.2 lib/watir/assertions.rb
commonwatir-1.9.2.rc1 lib/watir/assertions.rb
commonwatir-1.9.1 lib/watir/assertions.rb
commonwatir-1.9.1.rc1 lib/watir/assertions.rb
commonwatir-1.9.0 lib/watir/assertions.rb
commonwatir-1.9.0.rc7 lib/watir/assertions.rb
commonwatir-1.9.0.rc6 lib/watir/assertions.rb
commonwatir-1.9.0.rc5 lib/watir/assertions.rb