fuubar 1.3.2 → 1.3.3
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 +7 -0
- data/lib/fuubar.rb +8 -2
- data/spec/fuubar_spec.rb +42 -18
- metadata +18 -25
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0abed866500f12dc809a3058b70b72d0acabbf4f
|
4
|
+
data.tar.gz: ef1c62fed7ecb780e495751517159409d80ca9e3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cc7b582ed5a19df4448293638305019cd660a9f9371686486adcb94a11dfc01da63876aa553b1b43151bd8bde0db07a87a917189b0b64b327b2807cf91ea136
|
7
|
+
data.tar.gz: 5ac7935063d2a7a8434eb5c34a6141773d160e2f5cb5322123265764eb238863eaaa75fe47bbccd5147ed4623667fb04394ae89dffa31850455717870a4381cc
|
data/lib/fuubar.rb
CHANGED
@@ -12,6 +12,14 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
12
12
|
def initialize(*args)
|
13
13
|
super
|
14
14
|
|
15
|
+
self.progress = ProgressBar.create(DEFAULT_PROGRESS_BAR_OPTIONS.
|
16
|
+
merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
|
17
|
+
merge(:total => example_count,
|
18
|
+
:output => output,
|
19
|
+
:autostart => false))
|
20
|
+
end
|
21
|
+
|
22
|
+
def start(example_count)
|
15
23
|
progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS.
|
16
24
|
merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
|
17
25
|
merge(configuration.fuubar_progress_bar_options).
|
@@ -20,9 +28,7 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
20
28
|
:autostart => false)
|
21
29
|
|
22
30
|
self.progress = ProgressBar.create(progress_bar_options)
|
23
|
-
end
|
24
31
|
|
25
|
-
def start(example_count)
|
26
32
|
super
|
27
33
|
|
28
34
|
progress.total = example_count
|
data/spec/fuubar_spec.rb
CHANGED
@@ -12,7 +12,6 @@ describe Fuubar do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
let(:formatter) { Fuubar.new(output) }
|
15
|
-
let(:progress) { formatter.instance_variable_get(:@progress) }
|
16
15
|
let(:example) { RSpec::Core::ExampleGroup.describe.example }
|
17
16
|
|
18
17
|
let(:failed_example) do
|
@@ -48,28 +47,28 @@ describe Fuubar do
|
|
48
47
|
|
49
48
|
context 'when it is created' do
|
50
49
|
it 'does not start the bar until the formatter is started' do
|
51
|
-
expect(progress).
|
50
|
+
expect(formatter.progress).not_to be_started
|
52
51
|
|
53
52
|
formatter.start(2)
|
54
53
|
|
55
|
-
expect(progress).
|
54
|
+
expect(formatter.progress).to be_started
|
56
55
|
end
|
57
56
|
|
58
57
|
it 'creates a new ProgressBar' do
|
59
|
-
expect(progress).to be_instance_of ProgressBar::Base
|
58
|
+
expect(formatter.progress).to be_instance_of ProgressBar::Base
|
60
59
|
end
|
61
60
|
|
62
|
-
it 'sets the format of the bar' do
|
63
|
-
expect(progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
|
61
|
+
it 'sets the format of the bar to the default' do
|
62
|
+
expect(formatter.progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
|
64
63
|
end
|
65
64
|
|
66
65
|
it 'sets the total to the number of examples' do
|
67
|
-
expect(progress.total).to be_zero
|
66
|
+
expect(formatter.progress.total).to be_zero
|
68
67
|
end
|
69
68
|
|
70
69
|
it 'sets the bar\'s output' do
|
71
|
-
expect(progress.send(:output)).to eql formatter.output
|
72
|
-
expect(progress.send(:output)).to eql output
|
70
|
+
expect(formatter.progress.send(:output)).to eql formatter.output
|
71
|
+
expect(formatter.progress.send(:output)).to eql output
|
73
72
|
end
|
74
73
|
|
75
74
|
context 'and continuous integration is enabled' do
|
@@ -79,7 +78,7 @@ describe Fuubar do
|
|
79
78
|
end
|
80
79
|
|
81
80
|
it 'throttles the progress bar at one second' do
|
82
|
-
throttle = progress.instance_variable_get(:@throttle)
|
81
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
83
82
|
throttle_rate = throttle.instance_variable_get(:@period)
|
84
83
|
|
85
84
|
expect(throttle_rate).to eql 1.0
|
@@ -87,11 +86,11 @@ describe Fuubar do
|
|
87
86
|
|
88
87
|
context 'when processing an example' do
|
89
88
|
before do
|
90
|
-
throttle = progress.instance_variable_get(:@throttle)
|
91
|
-
throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
92
|
-
|
93
89
|
formatter.start(2)
|
94
90
|
|
91
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
92
|
+
throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
93
|
+
|
95
94
|
output.rewind
|
96
95
|
|
97
96
|
formatter.example_passed(example)
|
@@ -110,7 +109,7 @@ describe Fuubar do
|
|
110
109
|
end
|
111
110
|
|
112
111
|
it 'throttles the progress bar at the default rate' do
|
113
|
-
throttle = progress.instance_variable_get(:@throttle)
|
112
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
114
113
|
throttle_rate = throttle.instance_variable_get(:@period)
|
115
114
|
|
116
115
|
expect(throttle_rate).to eql 0.01
|
@@ -118,11 +117,11 @@ describe Fuubar do
|
|
118
117
|
|
119
118
|
context 'when processing an example' do
|
120
119
|
before do
|
121
|
-
throttle = progress.instance_variable_get(:@throttle)
|
122
|
-
throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
123
|
-
|
124
120
|
formatter.start(2)
|
125
121
|
|
122
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
123
|
+
throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
124
|
+
|
126
125
|
output.rewind
|
127
126
|
|
128
127
|
formatter.example_passed(example)
|
@@ -135,11 +134,36 @@ describe Fuubar do
|
|
135
134
|
end
|
136
135
|
end
|
137
136
|
|
137
|
+
context 'when custom options are set after the formatter is created' do
|
138
|
+
before(:each) do
|
139
|
+
formatter
|
140
|
+
RSpec.configuration.fuubar_progress_bar_options = {
|
141
|
+
:length => 40,
|
142
|
+
:throttle_rate => 0.0,
|
143
|
+
:format => '%c',
|
144
|
+
}
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when the bar is started' do
|
148
|
+
before(:each) { formatter.start(2) }
|
149
|
+
|
150
|
+
it 'properly creates the bar' do
|
151
|
+
expect(formatter.progress.instance_variable_get(:@format_string)).to eql '%c'
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
138
156
|
context 'when it is started' do
|
139
157
|
before { formatter.start(2) }
|
140
158
|
|
141
159
|
it 'sets the total to the number of examples' do
|
142
|
-
expect(progress.total).to eql 2
|
160
|
+
expect(formatter.progress.total).to eql 2
|
161
|
+
end
|
162
|
+
|
163
|
+
context 'and no custom options are passed in' do
|
164
|
+
it 'sets the format of the bar to the default' do
|
165
|
+
expect(formatter.progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
|
166
|
+
end
|
143
167
|
end
|
144
168
|
|
145
169
|
context 'and an example passes' do
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuubar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
5
|
-
prerelease:
|
4
|
+
version: 1.3.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nicholas Evans
|
@@ -11,46 +10,42 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date:
|
13
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rspec
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
|
-
- -
|
19
|
+
- - ">="
|
22
20
|
- !ruby/object:Gem::Version
|
23
21
|
version: 2.14.0
|
24
|
-
- - <
|
22
|
+
- - "<"
|
25
23
|
- !ruby/object:Gem::Version
|
26
24
|
version: 3.1.0
|
27
25
|
type: :runtime
|
28
26
|
prerelease: false
|
29
27
|
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
none: false
|
31
28
|
requirements:
|
32
|
-
- -
|
29
|
+
- - ">="
|
33
30
|
- !ruby/object:Gem::Version
|
34
31
|
version: 2.14.0
|
35
|
-
- - <
|
32
|
+
- - "<"
|
36
33
|
- !ruby/object:Gem::Version
|
37
34
|
version: 3.1.0
|
38
35
|
- !ruby/object:Gem::Dependency
|
39
36
|
name: ruby-progressbar
|
40
37
|
requirement: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
38
|
requirements:
|
43
|
-
- - ~>
|
39
|
+
- - "~>"
|
44
40
|
- !ruby/object:Gem::Version
|
45
|
-
version: '1.
|
41
|
+
version: '1.4'
|
46
42
|
type: :runtime
|
47
43
|
prerelease: false
|
48
44
|
version_requirements: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
45
|
requirements:
|
51
|
-
- - ~>
|
46
|
+
- - "~>"
|
52
47
|
- !ruby/object:Gem::Version
|
53
|
-
version: '1.
|
48
|
+
version: '1.4'
|
54
49
|
description: the instafailing RSpec progress bar formatter
|
55
50
|
email:
|
56
51
|
- jeff@kreeftmeijer.nl
|
@@ -60,36 +55,34 @@ extra_rdoc_files:
|
|
60
55
|
- README.md
|
61
56
|
- LICENSE
|
62
57
|
files:
|
63
|
-
- lib/fuubar.rb
|
64
|
-
- README.md
|
65
58
|
- LICENSE
|
59
|
+
- README.md
|
60
|
+
- lib/fuubar.rb
|
66
61
|
- spec/fuubar_spec.rb
|
67
62
|
homepage: https://github.com/jeffkreeftmeijer/fuubar
|
68
63
|
licenses: []
|
64
|
+
metadata: {}
|
69
65
|
post_install_message:
|
70
66
|
rdoc_options:
|
71
|
-
- --charset
|
67
|
+
- "--charset"
|
72
68
|
- UTF-8
|
73
69
|
require_paths:
|
74
70
|
- lib
|
75
71
|
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
72
|
requirements:
|
78
|
-
- -
|
73
|
+
- - ">="
|
79
74
|
- !ruby/object:Gem::Version
|
80
75
|
version: '0'
|
81
76
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
77
|
requirements:
|
84
|
-
- -
|
78
|
+
- - ">="
|
85
79
|
- !ruby/object:Gem::Version
|
86
80
|
version: '0'
|
87
81
|
requirements: []
|
88
82
|
rubyforge_project: fuubar
|
89
|
-
rubygems_version:
|
83
|
+
rubygems_version: 2.2.2
|
90
84
|
signing_key:
|
91
|
-
specification_version:
|
85
|
+
specification_version: 4
|
92
86
|
summary: the instafailing RSpec progress bar formatter
|
93
87
|
test_files:
|
94
88
|
- spec/fuubar_spec.rb
|
95
|
-
has_rdoc:
|