Class: RSpec3
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- RSpec3
show all
- Includes:
- NyanCat::Common
- Defined in:
- lib/nyan_cat_formatter/rspec3.rb
Constant Summary
NyanCat::Common::ERROR, NyanCat::Common::ESC, NyanCat::Common::FAIL, NyanCat::Common::NND, NyanCat::Common::PASS, NyanCat::Common::PASS_ARY, NyanCat::Common::PENDING
Instance Attribute Summary collapse
Instance Method Summary
collapse
#ascii_cat, #cat_length, #colors, #current_width, #dump_progress, #eol, #example_width, #failed_or_pending?, #finished?, #format_duration, #highlight, included, #nyan_cat, #nyan_trail, #padding_width, #progress_lines, #rainbowify, #scoreboard, #terminal_width, #tick
Constructor Details
#initialize(output) ⇒ RSpec3
Returns a new instance of RSpec3.
12
13
14
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 12
def initialize(output)
super(output)
end
|
Instance Attribute Details
#example_name ⇒ Object
Returns the value of attribute example_name.
7
8
9
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 7
def example_name
@example_name
end
|
Instance Method Details
#dump_summary(notification) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 67
def dump_summary(notification)
duration = notification.duration
failure_count = notification.failure_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(notification)
if respond_to?(:dump_commands_to_rerun_failed_examples)
dump_commands_to_rerun_failed_examples
end
end
|
#example_failed(notification) ⇒ Object
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 51
def example_failed(notification)
if notification.respond_to?(:example)
super(notification)
else
super(OpenStruct.new(:example => notification))
end
@failure_count += 1
tick FAIL
end
|
#example_passed(notification) ⇒ Object
35
36
37
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 35
def example_passed(notification)
tick PASS
end
|
#example_pending(notification) ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 39
def example_pending(notification)
if notification.respond_to?(:example)
super(notification)
else
super(OpenStruct.new(:example => notification))
end
@pending_count += 1
tick PENDING
end
|
#example_started(notification) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 28
def example_started(notification)
if notification.respond_to?(:example)
notification = notification.example
end
@example_name = notification.full_description
end
|
#start(notification) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 16
def start(notification)
if notification.kind_of?(Fixnum)
super(OpenStruct.new(:count => notification))
else
super(notification)
end
@current = @color_index = @passing_count = 0
@example_results = []
end
|
#start_dump(notification) ⇒ Object
63
64
65
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 63
def start_dump(notification)
@current = @example_count
end
|