rspec-progress-bar 0.1.0 → 0.1.1
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/.gitignore +1 -0
- data/lib/rspec_progress_bar/formatter.rb +2 -5
- data/lib/rspec_progress_bar/version.rb +1 -1
- data/spec/lib/rspec_progress_bar/formatter_spec.rb +11 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1bf926c21b6ac214c4aab42c218c61f756d9a970abfd11fefd534325e918032
|
4
|
+
data.tar.gz: 198449e5bd7afa7935d55d0b590f9fdeb1b897d0c7b5643973888e95a0fce466
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70c8d5ac52a9f35934f27d93b6046c860556f2da1e6887cf7280b374ac85cfae8a0698b908bde2f0dcf1c769d52c7802a0e43168e625fb372a374ceb3e23342c
|
7
|
+
data.tar.gz: 474c88df469c43163d3023fa70d32349b979cfb6361a26f778f4bc7b25ab7e84bf36e1fb9086ce8cf0133a0e5107419f0d46590d0a88ed485fb8370aa9783632
|
data/.gitignore
CHANGED
@@ -8,17 +8,14 @@ module RspecProgressBar
|
|
8
8
|
|
9
9
|
attr_accessor :progress_bar
|
10
10
|
|
11
|
-
def initialize(output)
|
12
|
-
@output = output
|
13
|
-
end
|
14
|
-
|
15
11
|
def start(notification)
|
16
12
|
@progress_bar = ProgressBar.new(notification.count)
|
17
13
|
end
|
18
14
|
|
19
15
|
def example_started(_notification)
|
20
16
|
progress_bar.count += 1
|
21
|
-
|
17
|
+
output << "#{progress_bar}\r"
|
18
|
+
output.flush
|
22
19
|
end
|
23
20
|
end
|
24
21
|
end
|
@@ -6,6 +6,10 @@ RSpec.describe RspecProgressBar::Formatter do
|
|
6
6
|
let(:io) { double }
|
7
7
|
let(:formatter) { described_class.new(io) }
|
8
8
|
|
9
|
+
it 'inherits from RSpec::Core::Formatters::BaseTextFormatter' do
|
10
|
+
expect(formatter).to be_a(RSpec::Core::Formatters::BaseTextFormatter)
|
11
|
+
end
|
12
|
+
|
9
13
|
describe '#initialize' do
|
10
14
|
it 'assigns @output' do
|
11
15
|
expect(formatter.instance_variable_get(:@output)).to eq(io)
|
@@ -32,6 +36,7 @@ RSpec.describe RspecProgressBar::Formatter do
|
|
32
36
|
before do
|
33
37
|
formatter.start(notification)
|
34
38
|
allow(io).to receive(:<<)
|
39
|
+
allow(io).to receive(:flush)
|
35
40
|
allow(formatter.progress_bar)
|
36
41
|
.to receive(:to_s)
|
37
42
|
.and_return('PROGRESS')
|
@@ -51,5 +56,11 @@ RSpec.describe RspecProgressBar::Formatter do
|
|
51
56
|
.to have_received(:<<)
|
52
57
|
.with("PROGRESS\r")
|
53
58
|
end
|
59
|
+
|
60
|
+
it 'flushes IO to OS' do
|
61
|
+
formatter.example_started(notification)
|
62
|
+
|
63
|
+
expect(io).to have_received(:flush)
|
64
|
+
end
|
54
65
|
end
|
55
66
|
end
|