Module Test::Unit::Assertions
In: lib/test/rails/test_case.rb
lib/test/zentest_assertions.rb

Extra assertions for Test::Unit

Methods

External Aliases

assert_includes -> assert_include
refute -> deny
refute_empty -> deny_empty
refute_equal -> deny_equal
refute_includes -> deny_include
refute_includes -> deny_includes
refute_nil -> deny_nil
capture_io -> util_capture
assert_not_nil -> refute_nil
assert_not_equal -> deny_equal
  Alias for assert_not_equal
assert_not_nil -> deny_nil
  Asserts that obj is not nil.

Public Instance methods

TODO: should this go in this file? Asserts that model indeed has a given callback

assert_callback(Model, :before_save, :something)

Asserts that obj responds to empty? and empty? returns true.

Like assert_in_delta but better dealing with errors proportional to the sizes of a and b.

Asserts that collection includes obj.

assert_includes(collection, obj, msg = nil)

Alias for assert_include

Asserts that boolean is not false or nil.

Asserts that obj responds to empty? and empty? returns false.

Asserts that obj responds to include? and that obj does not include item.

deny_includes(collection, obj, message = nil)

Alias for deny_include

Captures $stdout and $stderr to StringIO objects and returns them. Restores $stdout and $stderr when done.

Usage:

  def test_puts
    out, err = capture do
      puts 'hi'
      STDERR.puts 'bye!'
    end
    assert_equal "hi\n", out.string
    assert_equal "bye!\n", err.string
  end

[Validate]