Class: Luna::Formatters::Documentation

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Includes:
Profiling
Defined in:
lib/luna/rspec/formatters/documentation.rb

Constant Summary

Constants included from Profiling

Profiling::EXP, Profiling::EXP_HEADER, Profiling::GROUPS, Profiling::GROUPS_HEADER

Instance Method Summary collapse

Methods included from Profiling

#dump_profile, #helpers

Instance Method Details

#example_failed(struct) ⇒ Object



38
39
40
41
42
43
# File 'lib/luna/rspec/formatters/documentation.rb', line 38

def example_failed(struct)
  output.print "\s"
  print_description(
    get_example(struct), :failure
  )
end

#example_passed(struct) ⇒ Object



31
32
33
34
35
36
# File 'lib/luna/rspec/formatters/documentation.rb', line 31

def example_passed(struct)
  output.print "\s"
  print_description(
    get_example(struct), :success
  )
end

#example_pending(struct) ⇒ Object



45
46
47
48
49
50
# File 'lib/luna/rspec/formatters/documentation.rb', line 45

def example_pending(struct)
  output.print "\s"
  print_description(
    get_example(struct), :pending
  )
end

#get_example(struct) ⇒ Object



52
53
54
55
# File 'lib/luna/rspec/formatters/documentation.rb', line 52

def get_example(struct)
  return struct unless struct.respond_to?(:example)
  struct.example
end


57
58
59
60
61
62
# File 'lib/luna/rspec/formatters/documentation.rb', line 57

def print_description(example, type)
  desc = example.full_description
  output.print send(
    :"#{type}_color", '  ' + desc + "\n"
  )
end

#start(_) ⇒ Object



23
24
25
# File 'lib/luna/rspec/formatters/documentation.rb', line 23

def start(_)
  output.puts
end

#start_dump(_) ⇒ Object



27
28
29
# File 'lib/luna/rspec/formatters/documentation.rb', line 27

def start_dump(_)
  output.puts
end