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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c95f073c9242c58f01c2c910edfdb293433d0dcc
4
- data.tar.gz: dcb15ffb7afa3111f3ad051e2eeb8e286257cb82
3
+ metadata.gz: 885e83fb26f1590a5bdd18e24a096fc2a0b3324d
4
+ data.tar.gz: b7e81614cd856a872179f13fb8614f195886fed1
5
5
  SHA512:
6
- metadata.gz: b9733675cd110a3b3eed40c9238b5a3046b558fce5847ece29208c4dd9e0c0eab1dcf5511a85f4f14f87ba0fc81f4b0102430d8f0a351bbc7e0e61fdc984c91d
7
- data.tar.gz: ffbfb005719eeefa4deae460beac821a95e5a840009982b864467498497a2b2b4675a6feb691afea35dcccbfbb42bf22b29272903291fc204710e51daa4a0a2b
6
+ metadata.gz: 48df4d5331c6430bb9a521877feebf823f7b18d43e10d674af90e11072674d72e1f4ec3aea28a1a4efe45fda7042879757fae6fba3cc6ec506f9ce865b86a34b
7
+ data.tar.gz: 479289bf6285e20222bb94b0155c5f13bd0eddc69d21d1d2d8f08b5cd97bc1a8d9fa5cbf5786191c0553f97a69e47533c201c86d82d2e4a40bd582029601ce08
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'dots_formatter'
3
- s.version = '0.0.3'
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"
@@ -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, :fails, :runs, :pendings, :screen_width, :start_time, :example_start, :debug
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(50,"-") + "┐", colour)
62
- output.puts ConsoleCodes.wrap("│ #{summary.example_count} test#{summary.example_count == 1? '' : 's'}".ljust(50) + " |", colour)
63
- output.puts ConsoleCodes.wrap("| #{@fails} failure#{@fails == 1? '' : 's'}".ljust(50) + " |", colour)
64
- output.puts ConsoleCodes.wrap("| Ran in #{Helpers.format_duration summary.duration}".ljust(50) + " |", colour)
65
- output.puts ConsoleCodes.wrap("└" + "-".ljust(50,"-") + "┘", colour)
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
- run = ConsoleCodes.wrap(" Now running: #{example.example.description}"[0..@screen_width - 130], :cyan) unless finish
92
- all = "\r #{dot}#{suc}:#{fls}:#{png} / #{tot}#{dot} #{tim} #{run if @screen_width > 180}".ljust(@screen_width)+"\r"
93
- output.print all
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dots_formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Brennan