Class: RSpec2

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Includes:
NyanCat::Common
Defined in:
lib/nyan_cat_formatter/rspec2.rb

Constant Summary

Constants included from NyanCat::Common

NyanCat::Common::ERROR, NyanCat::Common::ESC, NyanCat::Common::FAIL, NyanCat::Common::NND, NyanCat::Common::PASS, NyanCat::Common::PASS_ARY, NyanCat::Common::PENDING, NyanCat::Common::VT100_CODES, NyanCat::Common::VT100_CODE_VALUES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from NyanCat::Common

#ascii_cat, #cat_length, #colors, #console_code_for, #current_width, #dump_progress, #eol, #example_width, #failed_or_pending?, #failure_color, #finished?, #format_duration, #highlight, included, #nyan_cat, #nyan_trail, #padding_width, #pending_color, #progress_lines, #rainbowify, #scoreboard, #success_color, #terminal_width, #tick, #wrap

Instance Attribute Details

#example_nameObject (readonly)

Returns the value of attribute example_name.



4
5
6
# File 'lib/nyan_cat_formatter/rspec2.rb', line 4

def example_name
  @example_name
end

Instance Method Details

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



38
39
40
41
42
43
44
45
46
# File 'lib/nyan_cat_formatter/rspec2.rb', line 38

def dump_summary(duration, example_count, failure_count, pending_count)
  dump_profile if profile_examples? && failure_count == 0
  summary = "\nYou've Nyaned for #{format_duration(duration)}\n".split(//).map { |c| rainbowify(c) }
  output.puts summary.join
  output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
  if respond_to?(:dump_commands_to_rerun_failed_examples)
    dump_commands_to_rerun_failed_examples
  end
end

#example_failed(example) ⇒ Object



28
29
30
31
32
# File 'lib/nyan_cat_formatter/rspec2.rb', line 28

def example_failed(example)
  super(example)
  @failure_count +=1
  tick FAIL
end

#example_passed(example) ⇒ Object



17
18
19
20
# File 'lib/nyan_cat_formatter/rspec2.rb', line 17

def example_passed(example)
  super(example)
  tick PASS
end

#example_pending(example) ⇒ Object



22
23
24
25
26
# File 'lib/nyan_cat_formatter/rspec2.rb', line 22

def example_pending(example)
  super(example)
  @pending_count +=1
  tick PENDING
end

#example_started(example) ⇒ Object



12
13
14
15
# File 'lib/nyan_cat_formatter/rspec2.rb', line 12

def example_started(example)
  super(example)
  @example_name = example.full_description
end

#start(example_count) ⇒ Object



6
7
8
9
10
# File 'lib/nyan_cat_formatter/rspec2.rb', line 6

def start(example_count)
  super(example_count)
  @current = @color_index = @passing_count = 0
  @example_results = []
end

#start_dumpObject



34
35
36
# File 'lib/nyan_cat_formatter/rspec2.rb', line 34

def start_dump
  @current = @example_count
end