Class: TurnipFormatter::Resource::Step::Hook

Inherits:
Object
  • Object
show all
Includes:
FailureResult, PendingResult
Defined in:
lib/turnip_formatter/resource/step/hook.rb

Direct Known Subclasses

AfterHook, BeforeHook

Instance Attribute Summary collapse

Attributes included from PendingResult

#pending_location, #pending_message

Instance Method Summary collapse

Methods included from PendingResult

#pending?, #set_pending

Methods included from FailureResult

#exceptions, #failed?, #set_exceptions

Constructor Details

#initialize(example) ⇒ Hook

Returns a new instance of Hook.

Parameters:

  • example (RSpec::Core::Example)


16
17
18
19
# File 'lib/turnip_formatter/resource/step/hook.rb', line 16

def initialize(example)
  @example = example
  @exceptions = []
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



11
12
13
# File 'lib/turnip_formatter/resource/step/hook.rb', line 11

def example
  @example
end

Instance Method Details

#argumentObject



40
41
42
# File 'lib/turnip_formatter/resource/step/hook.rb', line 40

def argument
  nil
end

#lineObject



36
37
38
# File 'lib/turnip_formatter/resource/step/hook.rb', line 36

def line
  -1
end

#statusObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/turnip_formatter/resource/step/hook.rb', line 21

def status
  case
  when failed?
    :failed
  when pending?
    :pending
  else
    :passed
  end
end

#textObject



32
33
34
# File 'lib/turnip_formatter/resource/step/hook.rb', line 32

def text
  ''
end