class Rproof::Censor

Attributes

test_result[R]

Public Class Methods

new(reporter, name, description) click to toggle source
# File lib/rproof/censor.rb, line 12
def initialize(reporter, name, description)
  @reporter = reporter
  @test_result = TestResult.new name, description
end

Public Instance Methods

assert(statement, comment) click to toggle source
# File lib/rproof/censor.rb, line 38
def assert(statement, comment)
  assert_equal true, statement, comment
end
assert_different(expected, obtained, comment) click to toggle source
# File lib/rproof/censor.rb, line 18
def assert_different(expected, obtained, comment)
  @test_result.add_assertion Assertion.new(expected, obtained, (obtained != expected), comment)
  @reporter.report_assertion @test_result.assertions.last
end
assert_equal(expected, obtained, comment) click to toggle source
# File lib/rproof/censor.rb, line 23
def assert_equal(expected, obtained, comment)
  @test_result.add_assertion Assertion.new(expected, obtained, (obtained == expected), comment)
  @reporter.report_assertion @test_result.assertions.last
end
assert_exception(expected, comment, &block) click to toggle source
# File lib/rproof/censor.rb, line 28
def assert_exception(expected, comment, &block)
  error = nil
  begin
    block.call
  rescue Exception => error
  ensure
    assert_equal(expected, error.class, comment)
  end
end
log_exception(error) click to toggle source
# File lib/rproof/censor.rb, line 47
def log_exception(error)
  @test_result.add_exception error
  @reporter.report_exception @test_result.exceptions.last
end
warning(message) click to toggle source
# File lib/rproof/censor.rb, line 42
def warning(message)
  @test_result.add_warning Warning.new(message)
  @reporter.report_warning @test_result.warnings.last
end