RSpec::Fuubar
RSpec::Fuubar is an instafailing RSpec formatter that uses a progress bar instead of a string of letters and dots as feedback. It provides immediate feedback when tests fail and displays a progress bar with ETA for your test suite.
Features
- Immediate Failure Output: See failures as they happen, not at the end
- Progress Bar with ETA: Know how long your test suite will take
- Color-Coded Output: Green for passing, yellow for pending, red for failing
- Customizable: Configure the progress bar format and behavior
- CI Friendly: Automatically disables features that don't work well in CI environments
Installation
Add this line to your application's Gemfile:
gem "rspec-fuubar"
And then execute:
bundle install
Or install it yourself as:
gem install rspec-fuubar
Usage
There are several ways to use RSpec::Fuubar:
Option 1: Command Line
rspec --format RSpec::Fuubar --color
Option 2: .rspec
Configuration File
Add to your project's .rspec
file:
--format RSpec::Fuubar
--color
Option 3: spec_helper.rb
Add to your spec/spec_helper.rb
:
RSpec.configure do |config|
config.add_formatter "RSpec::Fuubar"
end
Option 4: Rake Task
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = "--format RSpec::Fuubar --color"
end
Configuration
Customizing the Progress Bar
RSpec::Fuubar uses ruby-progressbar under the hood. You can customize the progress bar by setting the fuubar_progress_bar_options
configuration option:
RSpec.configure do |config|
config.fuubar_progress_bar_options = {
format: "My Custom Bar: <%B> %p%% %a",
progress_mark: "■",
remainder_mark: "□"
}
end
This would produce output like:
My Custom Bar: <■■■■■■■■■□□□□□□□□□□□> 45.00% 00:12:31
See the ruby-progressbar documentation for all available options.
Hiding Pending Specs Summary
By default, RSpec::Fuubar displays a summary of pending specs at the end of the test run. You can disable this:
RSpec.configure do |config|
config.fuubar_output_pending_results = false
end
Auto-Refresh
RSpec::Fuubar can automatically refresh the progress bar every second to update the ETA:
RSpec.configure do |config|
config.fuubar_auto_refresh = true
end
Note: This feature may interfere with debugging tools. See the section below for workarounds.
Compatibility
- Ruby 3.2+
- RSpec 3.0+
Debugging
With Pry
When using auto-refresh with Pry, you can disable it during debugging sessions:
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
With Byebug
Byebug doesn't provide hooks, so disable auto-refresh manually:
RSpec.configuration.fuubar_auto_refresh = false
byebug
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bundle exec rspec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/mhenrixon/rspec-fuubar. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Note: We use
MediumSecurity
because RSpec itself isn't signed, preventing us from usingHighSecurity
.
Credits
Fuubar was originally written by Jeff Kreeftmeijer and is now maintained by Jeff Felchner.
RSpec::Fuubar is maintained and funded by Mikael Henriksson
License
RSpec::Fuubar is Copyright © 2025 Mikael Henriksson. It is free software, and may be redistributed under the terms specified in the LICENSE file.