dots_formatter 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/dots_formatter.gemspec +1 -1
- data/lib/dots_formatter/dots.rb +27 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 885e83fb26f1590a5bdd18e24a096fc2a0b3324d
|
4
|
+
data.tar.gz: b7e81614cd856a872179f13fb8614f195886fed1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48df4d5331c6430bb9a521877feebf823f7b18d43e10d674af90e11072674d72e1f4ec3aea28a1a4efe45fda7042879757fae6fba3cc6ec506f9ce865b86a34b
|
7
|
+
data.tar.gz: 479289bf6285e20222bb94b0155c5f13bd0eddc69d21d1d2d8f08b5cd97bc1a8d9fa5cbf5786191c0553f97a69e47533c201c86d82d2e4a40bd582029601ce08
|
data/dots_formatter.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'dots_formatter'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.4'
|
4
4
|
s.date = '2015-09-09'
|
5
5
|
s.summary = "A simple, informative RSpec formatter"
|
6
6
|
s.description = "Get instance feedback on number of passed:failed:pending / total with quick failure status"
|
data/lib/dots_formatter/dots.rb
CHANGED
@@ -8,7 +8,17 @@ module RSpec
|
|
8
8
|
|
9
9
|
Formatters.register self, :example_passed, :example_pending, :example_started,
|
10
10
|
:example_failed, :start, :dump_failures
|
11
|
-
attr_accessor :passes,
|
11
|
+
attr_accessor :passes,
|
12
|
+
:fails,
|
13
|
+
:runs,
|
14
|
+
:pendings,
|
15
|
+
:screen_width,
|
16
|
+
:start_time,
|
17
|
+
:example_start,
|
18
|
+
:debug,
|
19
|
+
:show_time,
|
20
|
+
:show_description
|
21
|
+
|
12
22
|
|
13
23
|
def initialize(output)
|
14
24
|
@passes = 0
|
@@ -17,6 +27,8 @@ module RSpec
|
|
17
27
|
@pendings = 0
|
18
28
|
@screen_width = `tput cols`.to_i - 1
|
19
29
|
@debug = false
|
30
|
+
@show_time = @screen_width > 50
|
31
|
+
@show_description = @screen_width > 80
|
20
32
|
super(output)
|
21
33
|
end
|
22
34
|
|
@@ -57,12 +69,13 @@ module RSpec
|
|
57
69
|
output.puts
|
58
70
|
output.puts
|
59
71
|
colour = (@fails == 0)? :success : :failure
|
72
|
+
max = [50, @screen_width - 1].min
|
60
73
|
|
61
|
-
output.puts ConsoleCodes.wrap("┌" + "-".ljust(
|
62
|
-
output.puts ConsoleCodes.wrap("│ #{summary.example_count} test#{summary.example_count == 1? '' : 's'}".ljust(
|
63
|
-
output.puts ConsoleCodes.wrap("| #{@fails} failure#{@fails == 1? '' : 's'}".ljust(
|
64
|
-
output.puts ConsoleCodes.wrap("| Ran in #{Helpers.format_duration summary.duration}".ljust(
|
65
|
-
output.puts ConsoleCodes.wrap("└" + "-".ljust(
|
74
|
+
output.puts ConsoleCodes.wrap("┌" + "-".ljust(max,"-") + "┐", colour)
|
75
|
+
output.puts ConsoleCodes.wrap("│ #{summary.example_count} test#{summary.example_count == 1? '' : 's'}".ljust(max) + " |", colour)
|
76
|
+
output.puts ConsoleCodes.wrap("| #{@fails} failure#{@fails == 1? '' : 's'}".ljust(max) + " |", colour)
|
77
|
+
output.puts ConsoleCodes.wrap("| Ran in #{Helpers.format_duration summary.duration}".ljust(max) + " |", colour)
|
78
|
+
output.puts ConsoleCodes.wrap("└" + "-".ljust(max,"-") + "┘", colour)
|
66
79
|
output.puts
|
67
80
|
output.puts summary.colorized_rerun_commands if @fails > 0
|
68
81
|
end
|
@@ -88,9 +101,14 @@ module RSpec
|
|
88
101
|
tim2 = ConsoleCodes.wrap(Helpers.format_duration(prev_dur), :red)
|
89
102
|
output.puts " #{dot}#{suc}:#{fls}:#{png}/#{tot}#{dot} #{run}#{tim2}" if finish
|
90
103
|
else
|
91
|
-
|
92
|
-
all
|
93
|
-
|
104
|
+
all = "\r #{dot}#{suc}:#{fls}:#{png}"
|
105
|
+
all << " / #{tot}#{dot}"
|
106
|
+
all << " #{tim}" if @show_time
|
107
|
+
extra_pixels = @screen_width - 65
|
108
|
+
run = ConsoleCodes.wrap(" Now running: #{example.example.description[0..extra_pixels]}", :cyan) unless finish
|
109
|
+
all << " #{run}" if @show_description
|
110
|
+
|
111
|
+
output.print all.ljust(@screen_width + (@show_time? 65 : 25))+"\r"
|
94
112
|
end
|
95
113
|
end
|
96
114
|
|