Class: Nc

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/nc.rb

Direct Known Subclasses

NcFail, NcFirstFail

Defined Under Namespace

Classes: SizeResponder

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.rspec_3?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/nc.rb', line 5

def self.rspec_3?
  RSpec::Core::Version::STRING.split('.').first == "3"
end

Instance Method Details

#dump_failures(*args) ⇒ Object



40
# File 'lib/nc.rb', line 40

def dump_failures(*args); end

#dump_pending(*args) ⇒ Object



39
# File 'lib/nc.rb', line 39

def dump_pending(*args); end

#dump_summary(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nc.rb', line 13

def dump_summary(*args)
  if self.class.rspec_3?
    notification = args[0]
    duration = notification.duration
    example_count = notification.example_count
    failure_count = notification.failure_count
    pending_count = notification.pending_count
  else
    duration, example_count, failure_count, pending_count = args
  end

  body = []
  body << "Finished in #{_format_duration duration}"
  body << _summary_line(example_count, failure_count, pending_count)

  name = File.basename(File.expand_path '.')

  title = if failure_count > 0
    "\u26D4 #{name}: #{failure_count} failed example#{failure_count == 1 ? nil : 's'}"
  else
    "\u2705 #{name}: Success"
  end

  say title, body.join("\n")
end

#message(message) ⇒ Object



41
# File 'lib/nc.rb', line 41

def message(message); end