fuubar 2.0.0 → 2.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +20 -0
- data/README.md +8 -4
- data/Rakefile +2 -0
- data/lib/fuubar.rb +31 -21
- data/lib/fuubar/output.rb +17 -0
- data/spec/fuubar/output_spec.rb +35 -0
- data/spec/fuubar_spec.rb +10 -9
- metadata +20 -14
- data/LICENSE +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 708b886bc4ae937727cdb525165d4b9de5fea9b3
|
4
|
+
data.tar.gz: 9e73d903a3fd2386b14d7ec037ef6e486d915577
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 273b6fee00548ee13cf1735d3a1458d21852207a2550033109e991b632bd3c43d002504474655f658bbb1f129646a70421118f5c820c81428f618863e051b367
|
7
|
+
data.tar.gz: 521da1a5c29bf1ca17e5c480b539008f37828d6922473116cf5f64efbca191c7d4fb131eb49d7f3ae8daf6f05a06652e586aec639a10fb99cb4d2e64384f2a2c
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Jeff Kreeftmeijer.
|
2
|
+
Copyright (c) 2010-2016 The Kompanee, Ltd
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
6
|
+
in the Software without restriction, including without limitation the rights
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
9
|
+
furnished to do so, subject to the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be included in
|
12
|
+
all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
#Fuubar
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/fuubar.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/fuubar.svg)](https://badge.fury.io/rb/fuubar) [![Build Status](https://secure.travis-ci.org/thekompanee/fuubar.svg?branch=master)](http://travis-ci.org/thekompanee/fuubar) [![Code Climate](https://codeclimate.com/github/thekompanee/fuubar.svg)](https://codeclimate.com/github/thekompanee/fuubar) [![Code Climate](https://codeclimate.com/github/thekompanee/fuubar/coverage.svg)](https://codeclimate.com/github/thekompanee/fuubar)
|
4
4
|
|
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.
|
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.
|
6
|
+
|
7
|
+
[![gif](http://i.imgur.com/GIiA53s.gif)](http://vimeo.com/16845253).
|
6
8
|
|
7
9
|
Supported Rubies
|
8
10
|
--------------------------------
|
9
11
|
* MRI Ruby 1.8.7
|
10
12
|
* MRI Ruby 1.9.2
|
11
13
|
* MRI Ruby 1.9.3
|
12
|
-
* MRI Ruby 2.0.
|
13
|
-
* MRI Ruby 2.1.
|
14
|
+
* MRI Ruby 2.0.x
|
15
|
+
* MRI Ruby 2.1.x
|
16
|
+
* MRI Ruby 2.2.x
|
17
|
+
* MRI Ruby 2.3.x
|
14
18
|
* JRuby (in 1.8 compat mode)
|
15
19
|
* JRuby (in 1.9 compat mode)
|
16
20
|
|
data/Rakefile
ADDED
data/lib/fuubar.rb
CHANGED
@@ -1,18 +1,19 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
3
3
|
require 'ruby-progressbar'
|
4
|
+
require 'fuubar/output'
|
4
5
|
|
5
6
|
RSpec.configuration.add_setting :fuubar_progress_bar_options, :default => {}
|
6
7
|
|
7
8
|
class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
8
|
-
DEFAULT_PROGRESS_BAR_OPTIONS = { :format => ' %c/%C |%w>%i| %e ' }
|
9
|
+
DEFAULT_PROGRESS_BAR_OPTIONS = { :format => ' %c/%C |%w>%i| %e ' }.freeze
|
9
10
|
|
10
11
|
RSpec::Core::Formatters.register self, :start,
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
:message,
|
13
|
+
:example_passed,
|
14
|
+
:example_pending,
|
15
|
+
:example_failed,
|
16
|
+
:dump_failures
|
16
17
|
|
17
18
|
attr_accessor :progress,
|
18
19
|
:passed_count,
|
@@ -22,20 +23,22 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
22
23
|
def initialize(*args)
|
23
24
|
super
|
24
25
|
|
25
|
-
self.progress = ProgressBar.create(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
26
|
+
self.progress = ProgressBar.create(
|
27
|
+
DEFAULT_PROGRESS_BAR_OPTIONS.
|
28
|
+
merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
|
29
|
+
merge(:total => 0,
|
30
|
+
:output => output,
|
31
|
+
:autostart => false)
|
32
|
+
)
|
30
33
|
end
|
31
34
|
|
32
35
|
def start(notification)
|
33
|
-
progress_bar_options =
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS.
|
37
|
+
merge(:throttle_rate => continuous_integration? ? 1.0 : nil).
|
38
|
+
merge(configuration.fuubar_progress_bar_options).
|
39
|
+
merge(:total => notification.count,
|
40
|
+
:output => output,
|
41
|
+
:autostart => false)
|
39
42
|
|
40
43
|
self.progress = ProgressBar.create(progress_bar_options)
|
41
44
|
self.passed_count = 0
|
@@ -47,13 +50,13 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
47
50
|
with_current_color { progress.start }
|
48
51
|
end
|
49
52
|
|
50
|
-
def example_passed(
|
53
|
+
def example_passed(_notification)
|
51
54
|
self.passed_count += 1
|
52
55
|
|
53
56
|
increment
|
54
57
|
end
|
55
58
|
|
56
|
-
def example_pending(
|
59
|
+
def example_pending(_notification)
|
57
60
|
self.pending_count += 1
|
58
61
|
|
59
62
|
increment
|
@@ -78,13 +81,17 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
78
81
|
end
|
79
82
|
end
|
80
83
|
|
81
|
-
def dump_failures(
|
84
|
+
def dump_failures(_notification)
|
82
85
|
#
|
83
86
|
# We output each failure as it happens so we don't need to output them en
|
84
87
|
# masse at the end of the run.
|
85
88
|
#
|
86
89
|
end
|
87
90
|
|
91
|
+
def output
|
92
|
+
@fuubar_output ||= Fuubar::Output.new(super, configuration.tty?)
|
93
|
+
end
|
94
|
+
|
88
95
|
private
|
89
96
|
|
90
97
|
def increment
|
@@ -111,15 +118,18 @@ class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
|
111
118
|
end
|
112
119
|
end
|
113
120
|
|
121
|
+
# :reek:UtilityFunction disable
|
114
122
|
def color_code_for(*args)
|
115
123
|
RSpec::Core::Formatters::ConsoleCodes.console_code_for(*args)
|
116
124
|
end
|
117
125
|
|
126
|
+
# :reek:UtilityFunction disable
|
118
127
|
def configuration
|
119
128
|
RSpec.configuration
|
120
129
|
end
|
121
130
|
|
122
131
|
def continuous_integration?
|
123
|
-
@continuous_integration ||=
|
132
|
+
@continuous_integration ||= \
|
133
|
+
![nil, '', 'false'].include?(ENV['CONTINUOUS_INTEGRATION'])
|
124
134
|
end
|
125
135
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
2
|
+
class Output < Delegator
|
3
|
+
# :reek:BooleanParameter disable
|
4
|
+
def initialize(output, force_tty = false)
|
5
|
+
@raw_output = output
|
6
|
+
@force_tty = force_tty
|
7
|
+
end
|
8
|
+
|
9
|
+
def __getobj__
|
10
|
+
@raw_output
|
11
|
+
end
|
12
|
+
|
13
|
+
def tty?
|
14
|
+
@force_tty || @raw_output.tty?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'fuubar'
|
2
|
+
|
3
|
+
class TestNonTtyOutputClass
|
4
|
+
def tty?
|
5
|
+
false
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class TestTtyOutputClass
|
10
|
+
def hello
|
11
|
+
'hello'
|
12
|
+
end
|
13
|
+
|
14
|
+
def tty?
|
15
|
+
true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Fuubar < RSpec::Core::Formatters::BaseTextFormatter
|
20
|
+
describe Output do
|
21
|
+
it 'delegates anything to the passed in object' do
|
22
|
+
output = Output.new(TestTtyOutputClass.new)
|
23
|
+
|
24
|
+
expect(output.hello).to eql 'hello'
|
25
|
+
expect(output).to be_tty
|
26
|
+
expect(output.to_s).to match 'TestTtyOutputClass'
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can override the TTY of the passed in class' do
|
30
|
+
output = Output.new(TestNonTtyOutputClass.new, true)
|
31
|
+
|
32
|
+
expect(output).to be_tty
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/spec/fuubar_spec.rb
CHANGED
@@ -2,6 +2,7 @@ require 'fuubar'
|
|
2
2
|
require 'stringio'
|
3
3
|
require 'ostruct'
|
4
4
|
|
5
|
+
# rubocop:disable Metrics/LineLength
|
5
6
|
describe Fuubar do
|
6
7
|
let(:output) do
|
7
8
|
io = StringIO.new
|
@@ -24,8 +25,8 @@ describe Fuubar do
|
|
24
25
|
let(:failed_example) do
|
25
26
|
exception = RuntimeError.new('Test Fuubar Error')
|
26
27
|
exception.set_backtrace [
|
27
|
-
|
28
|
-
|
28
|
+
"/my/filename.rb:4:in `some_method'",
|
29
|
+
]
|
29
30
|
|
30
31
|
example = RSpec::Core::ExampleGroup.describe.example
|
31
32
|
|
@@ -78,13 +79,13 @@ describe Fuubar do
|
|
78
79
|
end
|
79
80
|
|
80
81
|
it 'sets the bar\'s output' do
|
81
|
-
expect(formatter.progress.send(:output)).to
|
82
|
+
expect(formatter.progress.send(:output)).to be_a Fuubar::Output
|
82
83
|
expect(formatter.progress.send(:output)).to eql output
|
83
84
|
end
|
84
85
|
|
85
86
|
context 'and continuous integration is enabled' do
|
86
87
|
before do
|
87
|
-
RSpec.configuration.fuubar_progress_bar_options = {:length => 40}
|
88
|
+
RSpec.configuration.fuubar_progress_bar_options = { :length => 40 }
|
88
89
|
ENV['CONTINUOUS_INTEGRATION'] = 'true'
|
89
90
|
end
|
90
91
|
|
@@ -99,8 +100,8 @@ describe Fuubar do
|
|
99
100
|
before do
|
100
101
|
formatter.start(start_notification)
|
101
102
|
|
102
|
-
throttle
|
103
|
-
|
103
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
104
|
+
_throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
104
105
|
|
105
106
|
output.rewind
|
106
107
|
|
@@ -115,7 +116,7 @@ describe Fuubar do
|
|
115
116
|
|
116
117
|
context 'and continuous integration is not enabled' do
|
117
118
|
before do
|
118
|
-
RSpec.configuration.fuubar_progress_bar_options = {:length => 40}
|
119
|
+
RSpec.configuration.fuubar_progress_bar_options = { :length => 40 }
|
119
120
|
ENV['CONTINUOUS_INTEGRATION'] = 'false'
|
120
121
|
end
|
121
122
|
|
@@ -130,8 +131,8 @@ describe Fuubar do
|
|
130
131
|
before do
|
131
132
|
formatter.start(start_notification)
|
132
133
|
|
133
|
-
throttle
|
134
|
-
|
134
|
+
throttle = formatter.progress.instance_variable_get(:@throttle)
|
135
|
+
_throttle_rate = throttle.instance_variable_set(:@period, 0.0)
|
135
136
|
|
136
137
|
output.rewind
|
137
138
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuubar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.1.0.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Evans
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -19,6 +19,9 @@ dependencies:
|
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: '3.0'
|
22
|
+
- - "<="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 3.5.0.beta9
|
22
25
|
type: :runtime
|
23
26
|
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,6 +29,9 @@ dependencies:
|
|
26
29
|
- - "~>"
|
27
30
|
- !ruby/object:Gem::Version
|
28
31
|
version: '3.0'
|
32
|
+
- - "<="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 3.5.0.beta9
|
29
35
|
- !ruby/object:Gem::Dependency
|
30
36
|
name: ruby-progressbar
|
31
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -41,26 +47,24 @@ dependencies:
|
|
41
47
|
- !ruby/object:Gem::Version
|
42
48
|
version: '1.4'
|
43
49
|
description: the instafailing RSpec progress bar formatter
|
44
|
-
email:
|
45
|
-
- jeff@kreeftmeijer.nl
|
50
|
+
email: '["jeff@kreeftmeijer.nl"]'
|
46
51
|
executables: []
|
47
52
|
extensions: []
|
48
|
-
extra_rdoc_files:
|
49
|
-
- README.md
|
50
|
-
- LICENSE
|
53
|
+
extra_rdoc_files: []
|
51
54
|
files:
|
52
|
-
- LICENSE
|
55
|
+
- LICENSE.txt
|
53
56
|
- README.md
|
57
|
+
- Rakefile
|
54
58
|
- lib/fuubar.rb
|
59
|
+
- lib/fuubar/output.rb
|
60
|
+
- spec/fuubar/output_spec.rb
|
55
61
|
- spec/fuubar_spec.rb
|
56
62
|
homepage: https://github.com/jeffkreeftmeijer/fuubar
|
57
63
|
licenses:
|
58
64
|
- MIT
|
59
65
|
metadata: {}
|
60
66
|
post_install_message:
|
61
|
-
rdoc_options:
|
62
|
-
- "--charset"
|
63
|
-
- UTF-8
|
67
|
+
rdoc_options: []
|
64
68
|
require_paths:
|
65
69
|
- lib
|
66
70
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -70,14 +74,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
74
|
version: '0'
|
71
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
76
|
requirements:
|
73
|
-
- - "
|
77
|
+
- - ">"
|
74
78
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
79
|
+
version: 1.3.1
|
76
80
|
requirements: []
|
77
81
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.4.5.1
|
79
83
|
signing_key:
|
80
84
|
specification_version: 4
|
81
85
|
summary: the instafailing RSpec progress bar formatter
|
82
86
|
test_files:
|
87
|
+
- spec/fuubar/output_spec.rb
|
83
88
|
- spec/fuubar_spec.rb
|
89
|
+
has_rdoc:
|
data/LICENSE
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
(The MIT License)
|
2
|
-
|
3
|
-
Copyright (c) 2010 Jeff Kreeftmeijer.
|
4
|
-
Copyright (c) 2013 The Kompanee - Jeff Felchner
|
5
|
-
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
-
a copy of this software and associated documentation files (the
|
8
|
-
"Software"), to deal in the Software without restriction, including
|
9
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
-
permit persons to whom the Software is furnished to do so, subject to
|
12
|
-
the following conditions:
|
13
|
-
|
14
|
-
The above copyright notice and this permission notice shall be
|
15
|
-
included in all copies or substantial portions of the Software.
|
16
|
-
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|