File: README.md

package info (click to toggle)
ruby-fuubar 2.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ruby: 377; sh: 29; makefile: 7
file content (224 lines) | stat: -rw-r--r-- 6,849 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
Fuubar
================================================================================

<div align="center">
  <a href="https://rubygems.org/gems/fuubar" alt="RubyGems Version">
    <img src="https://img.shields.io/gem/v/fuubar.svg?style=flat-square&label=current-version" alt="RubyGems Version" />
  </a>

  <a href="https://rubygems.org/gems/fuubar" alt="RubyGems Rank Overall">
    <img src="https://img.shields.io/gem/rt/fuubar.svg?style=flat-square&label=total-rank" alt="RubyGems Rank Overall" />
  </a>

  <a href="https://rubygems.org/gems/fuubar" alt="RubyGems Rank Daily">
    <img src="https://img.shields.io/gem/rd/fuubar.svg?style=flat-square&label=daily-rank" alt="RubyGems Rank Daily" />
  </a>

  <a href="https://rubygems.org/gems/fuubar" alt="RubyGems Downloads">
    <img src="https://img.shields.io/gem/dt/fuubar.svg?style=flat-square&label=total-downloads" alt="RubyGems Downloads" />
  </a>

  <a href="https://github.com/thekompanee/fuubar/actions?query=workflow%3ABuild" alt="Build Status">
    <img src="https://img.shields.io/github/workflow/status/jfelchner/fuubar/Build?label=CI&style=flat-square&logo=github" alt="Build Status" />
  </a>
</div>

<br>

fuubar is an instafailing [RSpec][rspec] formatter that uses
a progress bar instead of a string of letters and dots as feedback.

![examples][example-gif]

Installation
--------------------------------------------------------------------------------

```ruby
gem install fuubar

# or in your Gemfile

gem 'fuubar'
```

Usage
--------------------------------------------------------------------------------

In order to use fuubar, you have three options.

### Option 1: Invoke It Manually Via The Command Line

```bash
rspec --format Fuubar --color
```

### Option 2: Add It To Your Local `.rspec` File

```text
# .rspec

--format Fuubar
--color
```

### Option 3: Add It To Your `spec_helper.rb`

```ruby
# spec/spec_helper.rb

RSpec.configure do |config|
  config.add_formatter 'Fuubar'
end
```

Advanced Usage
--------------------------------

### Customizing The Bar

fuubar exposes an RSpec configuration variable called
`fuubar_progress_bar_options` which, when set will be passed directly to
[ruby-progressbar][rpb-github] which does all the heavy lifting.  Take a look at
the [ruby-progressbar documentation][rpb-docs] for details on all of the options
you can pass in.

#### Example

Let's say for example that you would like to change the format of the bar. You
would do that like so:

```ruby
# spec/spec_helper.rb

RSpec.configure do |config|
  config.fuubar_progress_bar_options = { :format => 'My Fuubar! <%B> %p%% %a' }
end
```

would make it so that, when fuubar is output, it would look something like:

```text
My Fuubar! <================================                  > 53.44% 00:12:31
```

### Hiding Pending/Skipped Spec Summary

By default fuubar follows RSpec's lead and will dump out a summary of all of the
pending specs in the suite once the test run is over.  This is a good idea
because the additional noise is a nudge to fix those tests.  We realize however
that not all teams have the luxury of implementing all of the pending specs and
therefore fuubar gives you the option of supressing that summary.

#### Example

```ruby
# spec/spec_helper.rb

RSpec.configure do |config|
  config.fuubar_output_pending_results = false
end
```

### Enabling Auto-Refresh

By default fuubar refreshes the bar only between each spec.
You can enable an auto-refresh feature that will keep refreshing the bar (and
therefore the ETA) every second.
You can enable the feature as follows:

```ruby
# spec/spec_helper.rb

RSpec.configure do |config|
  config.fuubar_auto_refresh = true
end
```

#### Undesirable Effects

Unfortunately this option doesn't play well with things like debuggers, as
having a bar show up every second would be undesireable (which is why the
feature is disabled by default). Depending on what you are using, you may be
given ways to work around this problem.

##### Pry

[Pry][pry] provides hooks that can be used to disable fuubar during a debugging
session, you could for example add the following to your spec helper:

```ruby
# spec/spec_helper.rb

Pry.config.hooks.add_hook(:before_session, :disable_fuubar_auto_refresh) do |_output, _binding, _pry|
  RSpec.configuration.fuubar_auto_refresh = false
end

Pry.config.hooks.add_hook(:after_session, :restore_fuubar_auto_refresh) do |_output, _binding, _pry|
  RSpec.configuration.fuubar_auto_refresh = true
end
```

##### Byebug

Unfortunately [byebug][byebug] does not provide hooks, so your best bet is to
disable auto-refresh manually before calling `byebug`.

```ruby
RSpec.configuration.fuubar_auto_refresh = false
byebug
```

Security
--------------------------------------------------------------------------------

fuubar is cryptographically signed. To be sure the gem you install hasn’t been
tampered with, follow these steps:

* Add my public key (if you haven’t already) as a trusted certificate

  ```bash
  gem cert --add <(curl -Ls https://raw.github.com/thekompanee/fuubar/master/certs/thekompanee.pem)
  ```

* Install fuubar telling it to use security checks when possible.

  ```bash
  gem install fuubar -P MediumSecurity
  ```

> **Note:** The `MediumSecurity` trust profile will verify signed gems, but
> allow the installation of unsigned dependencies.
>
> This is necessary because fuubar has a dependency on RSpec which isn't signed,
> and therefore we cannot use `HighSecurity`, which requires signed gems.

Credits
--------------------------------------------------------------------------------

fuubar was written by [Jeff Felchner][jefff-profile] and [Jeff
Kreeftmeijer][jeffk-profile]

![The Kompanee][kompanee-logo]

fuubar is maintained and funded by [The Kompanee, Ltd.][kompanee-site]

The names and logos for The Kompanee are trademarks of The Kompanee, Ltd.

License
--------------------------------------------------------------------------------

fuubar is Copyright &copy; 2010-2021 Jeff Kreeftmeijer and Jeff Felchner. It is
free software, and may be redistributed under the terms specified in the
[LICENSE][license] file.

[byebug]:        https://github.com/deivid-rodriguez/byebug
[example-gif]:   https://kompanee-public-assets.s3.amazonaws.com/readmes/fuubar-examples.gif
[jefff-profile]: https://github.com/jfelchner
[jeffk-profile]: https://github.com/jeffkreeftmeijer
[kompanee-logo]: https://kompanee-public-assets.s3.amazonaws.com/readmes/kompanee-horizontal-black.png
[kompanee-site]: http://www.thekompanee.com
[license]:       https://github.com/thekompanee/fuubar/blob/master/LICENSE.txt
[pry]:           https://github.com/pry/pry
[rpb-docs]:      https://github.com/jfelchner/ruby-progressbar/wiki/Options
[rpb-github]:    https://github.com/jfelchner/ruby-progressbar
[rspec]:         https://github.com/rspec