Class: SelfTestingFramework::TestResult

Inherits:
Object
  • Object
show all
Defined in:
lib/self_testing_framework/test_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTestResult

Returns a new instance of TestResult.



6
7
8
9
10
11
12
# File 'lib/self_testing_framework/test_result.rb', line 6

def initialize
  @errors_count = 0
  @passed_count = 0
  @errors = []
  @tests = []
  @total_count = 0
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/self_testing_framework/test_result.rb', line 4

def errors
  @errors
end

#errors_countObject (readonly)

Returns the value of attribute errors_count.



4
5
6
# File 'lib/self_testing_framework/test_result.rb', line 4

def errors_count
  @errors_count
end

#passed_countObject (readonly)

Returns the value of attribute passed_count.



4
5
6
# File 'lib/self_testing_framework/test_result.rb', line 4

def passed_count
  @passed_count
end

#testsObject (readonly)

Returns the value of attribute tests.



4
5
6
# File 'lib/self_testing_framework/test_result.rb', line 4

def tests
  @tests
end

#total_countObject (readonly)

Returns the value of attribute total_count.



4
5
6
# File 'lib/self_testing_framework/test_result.rb', line 4

def total_count
  @total_count
end

Instance Method Details

#errored(klass_name, test_name, error) ⇒ Object



20
21
22
23
24
25
# File 'lib/self_testing_framework/test_result.rb', line 20

def errored(klass_name, test_name, error)
  @errors_count += 1
  @tests << {:class_name => klass_name, :test_name => test_name, :error => error}
  @errors << {:class_name => klass_name, :test_name => test_name, :error => error}
  @total_count += 1
end

#last_testObject



27
28
29
# File 'lib/self_testing_framework/test_result.rb', line 27

def last_test
  @tests.last
end

#passed(klass_name, test_name) ⇒ Object



14
15
16
17
18
# File 'lib/self_testing_framework/test_result.rb', line 14

def passed(klass_name, test_name)
  @passed_count += 1
  @tests << {:class_name => klass_name, :test_name => test_name}
  @total_count += 1
end