Class: RSpec::Specify::Formatter

Inherits:
Core::Formatters::DocumentationFormatter
  • Object
show all
Defined in:
lib/specify/rspec/formatter.rb

Instance Method Summary collapse

Instance Method Details

#example_passed(notification) ⇒ Object



26
27
28
# File 'lib/specify/rspec/formatter.rb', line 26

def example_passed(notification)
  super unless notification.example.[:has_steps]
end

#example_started(notification) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/specify/rspec/formatter.rb', line 14

def example_started(notification)
  return unless notification.example.[:has_steps]

  indentation = current_indentation
  description = notification.example.description

  full_message = "#{indentation}#{description}"
  output.puts(
    ::RSpec::Core::Formatters::ConsoleCodes.wrap(full_message, :default)
  )
end

#example_step_failed(notification) ⇒ Object



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

def example_step_failed(notification)
  indentation = current_indentation
  step_type = notification.type.to_s.capitalize
  step_message = notification.message

  full_message = "#{indentation}  #{step_type} #{step_message} (FAILED)"
  output.puts(
    ::RSpec::Core::Formatters::ConsoleCodes.wrap(full_message, :failure)
  )
end

#example_step_passed(notification) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/specify/rspec/formatter.rb', line 30

def example_step_passed(notification)
  indentation = current_indentation
  step_type = notification.type.to_s.capitalize
  step_message = notification.message

  full_message = "#{indentation}  #{step_type} #{step_message}"
  output.puts(
    ::RSpec::Core::Formatters::ConsoleCodes.wrap(full_message, :success)
  )
end

#example_step_pending(notification) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/specify/rspec/formatter.rb', line 52

def example_step_pending(notification)
  indentation = current_indentation
  step_type = notification.type.to_s.capitalize
  step_message = notification.message

  full_message = "#{indentation}  #{step_type} #{step_message}"

  full_message << if notification.options[:pending] &&
                     notification.options[:pending] != true
                    " (PENDING: #{notification.options[:pending]})"
                  else
                    " (PENDING)"
                  end

  output.puts(
    ::RSpec::Core::Formatters::ConsoleCodes.wrap(full_message, :pending)
  )
end