Class: Smartest::TestResult

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test_case:, status:, error:, duration:, cleanup_errors:) ⇒ TestResult

Returns a new instance of TestResult.



27
28
29
30
31
32
33
# File 'lib/smartest/test_result.rb', line 27

def initialize(test_case:, status:, error:, duration:, cleanup_errors:)
  @test_case = test_case
  @status = status
  @error = error
  @duration = duration
  @cleanup_errors = cleanup_errors
end

Instance Attribute Details

#cleanup_errorsObject (readonly)

Returns the value of attribute cleanup_errors.



5
6
7
# File 'lib/smartest/test_result.rb', line 5

def cleanup_errors
  @cleanup_errors
end

#durationObject (readonly)

Returns the value of attribute duration.



5
6
7
# File 'lib/smartest/test_result.rb', line 5

def duration
  @duration
end

#errorObject (readonly)

Returns the value of attribute error.



5
6
7
# File 'lib/smartest/test_result.rb', line 5

def error
  @error
end

#statusObject (readonly)

Returns the value of attribute status.



5
6
7
# File 'lib/smartest/test_result.rb', line 5

def status
  @status
end

#test_caseObject (readonly)

Returns the value of attribute test_case.



5
6
7
# File 'lib/smartest/test_result.rb', line 5

def test_case
  @test_case
end

Class Method Details

.failed(test_case:, error:, duration:, cleanup_errors: []) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/smartest/test_result.rb', line 17

def self.failed(test_case:, error:, duration:, cleanup_errors: [])
  new(
    test_case: test_case,
    status: :failed,
    error: error,
    duration: duration,
    cleanup_errors: cleanup_errors
  )
end

.passed(test_case:, duration:, cleanup_errors: []) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/smartest/test_result.rb', line 7

def self.passed(test_case:, duration:, cleanup_errors: [])
  new(
    test_case: test_case,
    status: :passed,
    error: nil,
    duration: duration,
    cleanup_errors: cleanup_errors
  )
end

Instance Method Details

#failed?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/smartest/test_result.rb', line 39

def failed?
  status == :failed
end

#passed?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/smartest/test_result.rb', line 35

def passed?
  status == :passed
end