Module: Turnip::DocumentationFormatter

Included in:
RSpec::Core::Formatters::DocumentationFormatter
Defined in:
lib/turnip_documentation_formatter.rb,
lib/turnip_documentation_formatter/version.rb

Overview

Extensions for the RSpec documentation formatter

Constant Summary collapse

VERSION =
"0.1"

Instance Method Summary collapse

Instance Method Details

#example_failed(failure) ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/turnip_documentation_formatter.rb', line 52

def example_failed(failure)
  return super unless turnip_example?(failure)

  failure.example.[:failed_step] = @current_step
  output.puts step_failed_output(@current_step)
  output.puts remaining_step_names

  flush_messages if respond_to? :flush_messages
  @example_running = false
end

#example_passed(passed) ⇒ Object



34
35
36
37
38
39
# File 'lib/turnip_documentation_formatter.rb', line 34

def example_passed(passed)
  return super unless turnip_example?(passed)

  flush_messages if respond_to? :flush_messages
  @example_running = false
end

#example_pending(pending) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/turnip_documentation_formatter.rb', line 41

def example_pending(pending)
  return super unless turnip_example?(pending)

  output.puts step_pending_output(@current_step,
                                  pending.example.execution_result.pending_message)
  output.puts remaining_step_names

  flush_messages if respond_to? :flush_messages
  @example_running = false
end

#example_started(notification) ⇒ Object



19
20
21
22
23
# File 'lib/turnip_documentation_formatter.rb', line 19

def example_started(notification)
  super if defined?(super)

  @remaining_scenario_steps = notification.example.[:turnip_steps].dup
end

#initialize(output) ⇒ Object



12
13
14
15
16
17
# File 'lib/turnip_documentation_formatter.rb', line 12

def initialize(output)
  super

  @current_step = nil
  @remaining_scenario_steps = []
end

#step_passed(notification) ⇒ Object



30
31
32
# File 'lib/turnip_documentation_formatter.rb', line 30

def step_passed(notification)
  output.puts step_passed_output(notification.step)
end

#step_started(notification) ⇒ Object



25
26
27
28
# File 'lib/turnip_documentation_formatter.rb', line 25

def step_started(notification)
  @current_step = notification.step
  @remaining_scenario_steps.shift
end