Class: Rproof::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/rproof/test.rb

Direct Known Subclasses

TestSuite

Instance Method Summary collapse

Constructor Details

#initialize(reporter, name, description = nil) ⇒ Test

Returns a new instance of Test.



10
11
12
13
14
15
16
# File 'lib/rproof/test.rb', line 10

def initialize(reporter, name, description = nil)
  @id = object_id
  @reporter = reporter
  @name = name
  @description = description
  @censor = Censor.new reporter, name, description
end

Instance Method Details

#clean_upObject



25
26
# File 'lib/rproof/test.rb', line 25

def clean_up
end

#executeObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rproof/test.rb', line 28

def execute
  @reporter.report_test_begin(@id, @name, @description)
  begin
    setup
    run
    clean_up
  rescue Exception => e
    @censor.log_exception e
  end
  @reporter.report_test_end(@id, @censor.test_result)
  @censor.test_result
end

#runObject



21
22
23
# File 'lib/rproof/test.rb', line 21

def run
  raise "This method has to be overriden. Please redefine 'run' method with your test code."
end

#setupObject



18
19
# File 'lib/rproof/test.rb', line 18

def setup
end