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, NyanCat::Common::VT100_CODES, NyanCat::Common::VT100_CODE_VALUES
Instance Attribute Summary collapse
Instance Method Summary
collapse
#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
Constructor Details
#initialize(output) ⇒ RSpec3
Returns a new instance of RSpec3.
12
13
14
15
16
|
# 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
59
60
61
62
63
64
65
66
67
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 59
def dump_summary(notification)
duration = notification.duration
summary = "\nYou've Nyaned for #{format_duration(duration)}\n".split(//).map { |c| rainbowify(c) }
output.puts summary.join
output.puts notification.fully_formatted
if respond_to?(:dump_commands_to_rerun_failed_examples)
dump_commands_to_rerun_failed_examples
end
end
|
#example_failed(notification) ⇒ Object
49
50
51
52
53
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 49
def example_failed(notification)
@failed_examples << notification
@failure_count += 1
tick FAIL
end
|
#example_passed(notification) ⇒ Object
39
40
41
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 39
def example_passed(notification)
tick PASS
end
|
#example_pending(notification) ⇒ Object
43
44
45
46
47
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 43
def example_pending(notification)
@pending_examples << notification
@pending_count += 1
tick PENDING
end
|
#example_started(notification) ⇒ Object
32
33
34
35
36
37
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 32
def example_started(notification)
if notification.respond_to?(:example)
notification = notification.example
end
@example_name = notification.full_description
end
|
#start(notification) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 18
def start(notification)
if notification.kind_of?(Integer)
super(OpenStruct.new(:count => notification))
else
super(notification)
end
@current = @color_index = @passing_count = @failure_count = @pending_count = 0
@example_results = []
@failed_examples = []
@pending_examples = []
end
|
#start_dump(notification) ⇒ Object
55
56
57
|
# File 'lib/nyan_cat_formatter/rspec3.rb', line 55
def start_dump(notification)
@current = @example_count
end
|