fuubar 2.0.0.beta1 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1 -1
  3. data/lib/fuubar.rb +9 -5
  4. data/spec/fuubar_spec.rb +42 -18
  5. metadata +16 -23
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4f44685ac1981f569de28308e206e23686a6b3b9
4
+ data.tar.gz: def73165132a4b1f3076f90d2e4a194b0f850900
5
+ SHA512:
6
+ metadata.gz: 7f46d0747f7335758bec1ff6ff60c755e29b3d9ad18c05d6a068e098dae0ce8415e942f1dc53fa8fe298b6f278132f146e3fd6b8b84b157f98d65b482b14ebc4
7
+ data.tar.gz: 44c714040f143bb1659581440e6d17b21782c08d023d12f6b429191e6312058b75401e9184683e347718b4511aba572ff19b6bbdc9ba01b5800f72b790a15238
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  #Fuubar
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/fuubar.png)](https://badge.fury.io/rb/fuubar) [![Travis CI Status](https://travis-ci.org/jeffkreeftmeijer/fuubar.png)](https://travis-ci.org/jeffkreeftmeijer/fuubar) [![CodeClimate Badge](https://codeclimate.com/github/jeffkreeftmeijer/fuubar.png)](https://codeclimate.com/github/jeffkreeftmeijer/fuubar)
3
+ [![Gem Version](https://badge.fury.io/rb/fuubar.png)](https://badge.fury.io/rb/fuubar) [![Build Status](https://secure.travis-ci.org/thekompanee/fuubar.png?branch=master)](http://travis-ci.org/thekompanee/fuubar) [![Code Climate](https://codeclimate.com/github/thekompanee/fuubar.png)](https://codeclimate.com/github/thekompanee/fuubar) [![Code Climate](https://codeclimate.com/github/thekompanee/fuubar/coverage.png)](https://codeclimate.com/github/thekompanee/fuubar)
4
4
 
5
5
  Fuubar is an instafailing [RSpec](http://github.com/rspec) formatter that uses a progress bar instead of a string of letters and dots as feedback. Here's [a video of Fuubar in action](http://vimeo.com/16845253).
6
6
 
data/lib/fuubar.rb CHANGED
@@ -19,21 +19,25 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
19
19
  def initialize(*args)
20
20
  super
21
21
 
22
+ self.progress = ProgressBar.create(DEFAULT_PROGRESS_BAR_OPTIONS.
23
+ merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
24
+ merge(:total => 0,
25
+ :output => output,
26
+ :autostart => false))
27
+ end
28
+
29
+ def start(notification)
22
30
  progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS.
23
31
  merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
24
32
  merge(configuration.fuubar_progress_bar_options).
25
- merge(:total => 0,
33
+ merge(:total => notification.count,
26
34
  :output => output,
27
35
  :autostart => false)
28
36
 
29
37
  self.progress = ProgressBar.create(progress_bar_options)
30
- end
31
38
 
32
- def start(notification)
33
39
  super
34
40
 
35
- progress.total = notification.count
36
-
37
41
  with_current_color { progress.start }
38
42
  end
39
43
 
data/spec/fuubar_spec.rb CHANGED
@@ -13,7 +13,6 @@ describe Fuubar do
13
13
  end
14
14
 
15
15
  let(:formatter) { Fuubar.new(output) }
16
- let(:progress) { formatter.instance_variable_get(:@progress) }
17
16
  let(:example) { RSpec::Core::ExampleGroup.describe.example }
18
17
  let(:notification) { OpenStruct.new(count: 2,
19
18
  example: example,
@@ -55,28 +54,28 @@ describe Fuubar do
55
54
 
56
55
  context 'when it is created' do
57
56
  it 'does not start the bar until the formatter is started' do
58
- expect(progress).not_to be_started
57
+ expect(formatter.progress).not_to be_started
59
58
 
60
59
  formatter.start(notification)
61
60
 
62
- expect(progress).to be_started
61
+ expect(formatter.progress).to be_started
63
62
  end
64
63
 
65
64
  it 'creates a new ProgressBar' do
66
- expect(progress).to be_instance_of ProgressBar::Base
65
+ expect(formatter.progress).to be_instance_of ProgressBar::Base
67
66
  end
68
67
 
69
- it 'sets the format of the bar' do
70
- expect(progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
68
+ it 'sets the format of the bar to the default' do
69
+ expect(formatter.progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
71
70
  end
72
71
 
73
72
  it 'sets the total to the number of examples' do
74
- expect(progress.total).to be_zero
73
+ expect(formatter.progress.total).to be_zero
75
74
  end
76
75
 
77
76
  it 'sets the bar\'s output' do
78
- expect(progress.send(:output)).to eql formatter.output
79
- expect(progress.send(:output)).to eql output
77
+ expect(formatter.progress.send(:output)).to eql formatter.output
78
+ expect(formatter.progress.send(:output)).to eql output
80
79
  end
81
80
 
82
81
  context 'and continuous integration is enabled' do
@@ -86,7 +85,7 @@ describe Fuubar do
86
85
  end
87
86
 
88
87
  it 'throttles the progress bar at one second' do
89
- throttle = progress.instance_variable_get(:@throttle)
88
+ throttle = formatter.progress.instance_variable_get(:@throttle)
90
89
  throttle_rate = throttle.instance_variable_get(:@period)
91
90
 
92
91
  expect(throttle_rate).to eql 1.0
@@ -94,11 +93,11 @@ describe Fuubar do
94
93
 
95
94
  context 'when processing an example' do
96
95
  before do
97
- throttle = progress.instance_variable_get(:@throttle)
98
- throttle_rate = throttle.instance_variable_set(:@period, 0.0)
99
-
100
96
  formatter.start(notification)
101
97
 
98
+ throttle = formatter.progress.instance_variable_get(:@throttle)
99
+ throttle_rate = throttle.instance_variable_set(:@period, 0.0)
100
+
102
101
  output.rewind
103
102
 
104
103
  formatter.example_passed(example)
@@ -117,7 +116,7 @@ describe Fuubar do
117
116
  end
118
117
 
119
118
  it 'throttles the progress bar at the default rate' do
120
- throttle = progress.instance_variable_get(:@throttle)
119
+ throttle = formatter.progress.instance_variable_get(:@throttle)
121
120
  throttle_rate = throttle.instance_variable_get(:@period)
122
121
 
123
122
  expect(throttle_rate).to eql 0.01
@@ -125,11 +124,11 @@ describe Fuubar do
125
124
 
126
125
  context 'when processing an example' do
127
126
  before do
128
- throttle = progress.instance_variable_get(:@throttle)
129
- throttle_rate = throttle.instance_variable_set(:@period, 0.0)
130
-
131
127
  formatter.start(notification)
132
128
 
129
+ throttle = formatter.progress.instance_variable_get(:@throttle)
130
+ throttle_rate = throttle.instance_variable_set(:@period, 0.0)
131
+
133
132
  output.rewind
134
133
 
135
134
  formatter.example_passed(example)
@@ -142,11 +141,36 @@ describe Fuubar do
142
141
  end
143
142
  end
144
143
 
144
+ context 'when custom options are set after the formatter is created' do
145
+ before(:each) do
146
+ formatter
147
+ RSpec.configuration.fuubar_progress_bar_options = {
148
+ :length => 40,
149
+ :throttle_rate => 0.0,
150
+ :format => '%c',
151
+ }
152
+ end
153
+
154
+ context 'when the bar is started' do
155
+ before(:each) { formatter.start(notification) }
156
+
157
+ it 'properly creates the bar' do
158
+ expect(formatter.progress.instance_variable_get(:@format_string)).to eql '%c'
159
+ end
160
+ end
161
+ end
162
+
145
163
  context 'when it is started' do
146
164
  before { formatter.start(notification) }
147
165
 
148
166
  it 'sets the total to the number of examples' do
149
- expect(progress.total).to eql 2
167
+ expect(formatter.progress.total).to eql 2
168
+ end
169
+
170
+ context 'and no custom options are passed in' do
171
+ it 'sets the format of the bar to the default' do
172
+ expect(formatter.progress.instance_variable_get(:@format_string)).to eql ' %c/%C |%w>%i| %e '
173
+ end
150
174
  end
151
175
 
152
176
  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: 2.0.0.beta1
5
- prerelease: 6
4
+ version: 2.0.0.beta2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nicholas Evans
@@ -11,40 +10,36 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2014-03-01 00:00:00.000000000 Z
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: 3.0.beta
24
22
  type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
- - - ~>
26
+ - - "~>"
30
27
  - !ruby/object:Gem::Version
31
28
  version: 3.0.beta
32
29
  - !ruby/object:Gem::Dependency
33
30
  name: ruby-progressbar
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
- - - ~>
33
+ - - "~>"
38
34
  - !ruby/object:Gem::Version
39
- version: '1.3'
35
+ version: '1.4'
40
36
  type: :runtime
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
- - - ~>
40
+ - - "~>"
46
41
  - !ruby/object:Gem::Version
47
- version: '1.3'
42
+ version: '1.4'
48
43
  description: the instafailing RSpec progress bar formatter
49
44
  email:
50
45
  - jeff@kreeftmeijer.nl
@@ -54,36 +49,34 @@ extra_rdoc_files:
54
49
  - README.md
55
50
  - LICENSE
56
51
  files:
57
- - lib/fuubar.rb
58
- - README.md
59
52
  - LICENSE
53
+ - README.md
54
+ - lib/fuubar.rb
60
55
  - spec/fuubar_spec.rb
61
56
  homepage: https://github.com/jeffkreeftmeijer/fuubar
62
57
  licenses: []
58
+ metadata: {}
63
59
  post_install_message:
64
60
  rdoc_options:
65
- - --charset
61
+ - "--charset"
66
62
  - UTF-8
67
63
  require_paths:
68
64
  - lib
69
65
  required_ruby_version: !ruby/object:Gem::Requirement
70
- none: false
71
66
  requirements:
72
- - - ! '>='
67
+ - - ">="
73
68
  - !ruby/object:Gem::Version
74
69
  version: '0'
75
70
  required_rubygems_version: !ruby/object:Gem::Requirement
76
- none: false
77
71
  requirements:
78
- - - ! '>'
72
+ - - ">"
79
73
  - !ruby/object:Gem::Version
80
74
  version: 1.3.1
81
75
  requirements: []
82
76
  rubyforge_project: fuubar
83
- rubygems_version: 1.8.23
77
+ rubygems_version: 2.2.2
84
78
  signing_key:
85
- specification_version: 3
79
+ specification_version: 4
86
80
  summary: the instafailing RSpec progress bar formatter
87
81
  test_files:
88
82
  - spec/fuubar_spec.rb
89
- has_rdoc: