rspec_pacman_formatter 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rspec_pacman_formatter/pacman.rb +22 -24
- data/lib/rspec_pacman_formatter/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2582e4de37da5bd450f9a7fed3c47b54fc83a1452c6263cf71b91257c77db21
|
4
|
+
data.tar.gz: 9f2900b545cdcd3a055c51a8f93bdd9b1077e3ccf4a41cc3062c697cc0d2dab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18a38e2999b64e1ae5d98bf498e537d50b7671e46772daafda3c5b1aeeee25c2cbf7705a460c7cd839b002b8f7e751e70660fa36f5424bf7420bb8684d158ff3
|
7
|
+
data.tar.gz: d6eadf45a64122cb4209777466ce6ca6ad241a54095a2fb1625d27c8dba6b0dad88303659865cee2e057c047f339de8632d4c6641286b29f3a3eefb66ab809ee
|
@@ -3,35 +3,34 @@ require 'rspec/core/formatters/base_text_formatter'
|
|
3
3
|
|
4
4
|
module RspecPacmanFormatter
|
5
5
|
class Pacman < RSpec::Core::Formatters::BaseTextFormatter
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
CI_TERMINAL_WIDTH = 80
|
7
|
+
RSpec::Core::Formatters.register(self, :start, :close, :example_started,
|
8
|
+
:example_passed, :example_failed,
|
9
|
+
:example_pending)
|
10
10
|
|
11
11
|
attr_accessor :progress_line, :failed
|
12
12
|
|
13
13
|
def initialize(*args)
|
14
14
|
super
|
15
15
|
@progress_line = ''
|
16
|
-
@failed
|
17
|
-
@
|
18
|
-
@
|
19
|
-
|
16
|
+
@failed = 0
|
17
|
+
@notification = 0
|
18
|
+
@repetitions = 0
|
19
|
+
end
|
20
|
+
|
21
|
+
def cols
|
22
|
+
@cols ||= begin
|
23
|
+
width = `tput cols`.chomp.to_i
|
24
|
+
width.nil? || width.zero? ? CI_TERMINAL_WIDTH : width
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def start(notification)
|
23
29
|
puts 'GAME STARTED'
|
24
|
-
@cols = terminal_width
|
25
30
|
@notification = notification.count
|
26
31
|
update_progress_line
|
27
32
|
end
|
28
33
|
|
29
|
-
def terminal_width
|
30
|
-
`tput cols`.chomp.to_i
|
31
|
-
rescue StandardError
|
32
|
-
CI_TERMINAL_WIDTH
|
33
|
-
end
|
34
|
-
|
35
34
|
def example_started(_)
|
36
35
|
step(Characters::PACMAN)
|
37
36
|
end
|
@@ -54,12 +53,12 @@ module RspecPacmanFormatter
|
|
54
53
|
end
|
55
54
|
|
56
55
|
def update_progress_line
|
57
|
-
if @notification >
|
58
|
-
if (@notification /
|
59
|
-
@progress_line = Characters::PACDOT * (@notification - (
|
56
|
+
if @notification > cols
|
57
|
+
if (@notification / cols).eql?(@repetitions)
|
58
|
+
@progress_line = Characters::PACDOT * (@notification - (cols * @repetitions))
|
60
59
|
return
|
61
60
|
end
|
62
|
-
@progress_line = Characters::PACDOT *
|
61
|
+
@progress_line = Characters::PACDOT * cols
|
63
62
|
return
|
64
63
|
end
|
65
64
|
@progress_line = Characters::PACDOT * @notification
|
@@ -70,11 +69,10 @@ module RspecPacmanFormatter
|
|
70
69
|
def step(character)
|
71
70
|
@progress_line = @progress_line.sub(/#{Regexp.quote(Characters::PACMAN)}|#{Regexp.quote(Characters::PACDOT)}/, character)
|
72
71
|
print format("%s\r", @progress_line)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
end
|
72
|
+
return unless @progress_line[-1] =~ /ᗣ|\./
|
73
|
+
@repetitions += 1
|
74
|
+
puts
|
75
|
+
update_progress_line
|
78
76
|
end
|
79
77
|
end
|
80
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec_pacman_formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Luis Rojas Aragonés
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|