Class: Belajar::TestExample

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

Constant Summary collapse

PASSED =
'passed'.freeze
FAILED =
'failed'.freeze
EXAMPLE_PASSED_MESSAGE =
'Your code passed this requirement.'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status:, description: nil, message: nil) ⇒ TestExample

Returns a new instance of TestExample.



109
110
111
112
113
# File 'lib/belajar/test_result.rb', line 109

def initialize(status:, description: nil, message: nil)
  @description = description
  @status      = status
  @message     = message || EXAMPLE_PASSED_MESSAGE
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



105
106
107
# File 'lib/belajar/test_result.rb', line 105

def description
  @description
end

#messageObject (readonly)

Returns the value of attribute message.



105
106
107
# File 'lib/belajar/test_result.rb', line 105

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



105
106
107
# File 'lib/belajar/test_result.rb', line 105

def status
  @status
end

Instance Method Details

#passed?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/belajar/test_result.rb', line 115

def passed?
  @status == PASSED
end