Class: RSpec::Core::Formatters::OrgFormatter

Inherits:
BaseTextFormatter
  • Object
show all
Defined in:
lib/rspec/core/formatters/org_formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ OrgFormatter

Returns a new instance of OrgFormatter.



15
16
17
# File 'lib/rspec/core/formatters/org_formatter.rb', line 15

def initialize(output)
  super(output)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object (private)



20
21
22
# File 'lib/rspec/core/formatters/org_formatter.rb', line 20

def method_missing(m, *a, &b)
  # no-op
end

Instance Method Details

#dump_failuresObject



161
162
# File 'lib/rspec/core/formatters/org_formatter.rb', line 161

def dump_failures
end

#dump_pendingObject



164
165
# File 'lib/rspec/core/formatters/org_formatter.rb', line 164

def dump_pending
end

#dump_summary(duration, example_count, failure_count, pending_count) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/rspec/core/formatters/org_formatter.rb', line 167

def dump_summary(duration, example_count, failure_count, pending_count)
  # TODO - kill dry_run?
  @output.puts "* Summary"
  if dry_run?
    totals = "This was a dry-run"
  else
    totals =  "#{example_count} example#{'s' unless example_count == 1}, "
    totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
    totals << ", #{pending_count} pending" if pending_count > 0
  end
  @output.puts "Finished in *#{duration} seconds*"
  @output.puts totals
  @output.puts "  :PROPERTIES:"
  @output.puts "    :VISIBILITY: children"
  @output.puts "  :END:"
  @output.puts "#+DRAWERS: DETAILS PROPERTIES"
  @output.puts "#+TODO: FAILED PENDING_FIXED PENDING | SUCCESS"
  @output.flush
end

#example_failed(example) ⇒ Object



139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/rspec/core/formatters/org_formatter.rb', line 139

def example_failed(example)
  super(example)
  exception = example.[:execution_result][:exception]
  failure_style =  exception_pending_fixed?(exception) ? 'pending_fixed' : 'failed'
  # @header_red = true
  # @example_group_red = true
  @output.puts "#{section_markup example} #{failure_style.upcase} #{example.description}"
  output_exception(exception, example)
  output_backtrace(exception, example)
  output_failure_properties example
  @output.flush
end

#example_group_started(example_group) ⇒ Object

returns the org section level for an example or an example_group



122
123
124
125
126
# File 'lib/rspec/core/formatters/org_formatter.rb', line 122

def example_group_started(example_group)
  super(example_group)
  @output.puts "#{section_markup example_group} #{example_group.description}"
  @output.flush
end

#example_passed(example) ⇒ Object



131
132
133
134
# File 'lib/rspec/core/formatters/org_formatter.rb', line 131

def example_passed(example)
  @output.puts "#{section_markup example} SUCCESS #{example.description}"
  @output.flush
end

#example_pending(example) ⇒ Object



152
153
154
155
156
157
# File 'lib/rspec/core/formatters/org_formatter.rb', line 152

def example_pending(example)
  message = example.[:execution_result][:pending_message]
  @output.puts "#{section_markup example} PENDING #{example.description}"
  @output.puts "#{section_indent example} #{message}"
  @output.flush
end

#message(message) ⇒ Object



111
112
# File 'lib/rspec/core/formatters/org_formatter.rb', line 111

def message(message)
end

#start(example_count) ⇒ Object

The number of the currently running example (a global counter)



116
117
118
# File 'lib/rspec/core/formatters/org_formatter.rb', line 116

def start(example_count)
  super(example_count)
end

#start_dumpObject



128
129
# File 'lib/rspec/core/formatters/org_formatter.rb', line 128

def start_dump
end