Use Fuubar with RSpec
masterFuubar is an instafailing RSpec formatter. You can use it via the command line, by configuring your .rspec file, or by adding it to your spec_helper.rb.
# Option 1: Command Line
rspec --format Fuubar --colorrepository·master·Indexed 21 days ago
https://github.com/thekompanee/fuubarAn instafailing RSpec formatter that replaces standard output with a visual progress bar, providing real-time feedback and ETA during test runs. It supports customization via ruby-progressbar options, auto-refresh settings, and integration with debuggers like Pry and Byebug.
Fuubar is an instafailing RSpec formatter. You can use it via the command line, by configuring your .rspec file, or by adding it to your spec_helper.rb.
# Option 1: Command Line
rspec --format Fuubar --colorYou can install Fuubar as a standalone gem or add it to your project's Gemfile.
gem install fuubar
# or in your Gemfile
gem 'fuubar'Fuubar is cryptographically signed. To ensure you are installing a legitimate version, you can add the maintainer's public key and install using the MediumSecurity profile. Note that MediumSecurity is required because the dependency RSpec is not signed.
# Add the public key
gem cert --add <(curl -Ls https://raw.github.com/thekompanee/fuubar/master/certs/thekompanee.pem)
# Install with MediumSecurity
gem install fuubar -P MediumSecurityAlternatively, you can register the formatter within your RSpec configuration block in spec/spec_helper.rb:
# spec/spec_helper.rb
RSpec.configure do |config|
config.add_formatter 'Fuubar'
endTo make Fuubar the default formatter for your project, add the following lines to your .rspec file:
# .rspec
--format Fuubar
--colorFuubar is an RSpec formatter that provides real-time progress bar feedback. To use it, you must register it as a formatter in your RSpec configuration. This is typically done by adding it to your .rspec file or your spec_helper.rb.
Note: Fuubar automatically detects if it is running in a Continuous Integration (CI) environment by checking the CONTINUOUS_INTEGRATION environment variable. In CI, it disables certain color features and adjusts the progress bar throttle rate to 1.0 to prevent excessive output.
# Example: Adding to .rspec
--format FuubarSince byebug does not support hooks, you must manually disable auto-refresh before calling byebug to avoid undesirable terminal behavior.
RSpec.configuration.fuubar_auto_refresh = false
byebugIf you use Pry for debugging, you can use its hooks to automatically disable fuubar_auto_refresh when entering a session and re-enable it when exiting, preventing visual interference.
# 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
endBy default, Fuubar only refreshes the bar between specs. To enable an auto-refresh feature that updates the bar (and the ETA) every second, set fuubar_auto_refresh to true.
Warning: This can interfere with debuggers like byebug or pry by causing the bar to redraw frequently during a session.
# spec/spec_helper.rb
RSpec.configure do |config|
config.fuubar_auto_refresh = true
endFuubar uses ruby-progressbar for its display. You can pass custom options to the progress bar by setting the fuubar_progress_bar_options configuration variable in your RSpec.configure block. This allows you to change the format, ETA display, and other progress bar behaviors.
# spec/spec_helper.rb
RSpec.configure do |config|
config.fuubar_progress_bar_options = { :format => 'My Fuubar! <%B> %p%% %a' }
endBy default, Fuubar outputs a summary of pending specs at the end of the run. To suppress this summary, set fuubar_output_pending_results to false in your RSpec configuration.
# spec/spec_helper.rb
RSpec.configure do |config|
config.fuubar_output_pending_results = false
endFuubar exposes several RSpec configuration settings to customize the progress bar behavior and output. You can set these in your spec_helper.rb or .rspec file using the RSpec.configure block.
Available settings:
fuubar_progress_bar_options: A Hash of options passed directly to ruby-progressbar. This allows you to customize the :format, :throttle_rate, and other progress bar parameters.fuubar_auto_refresh: A Boolean (default: false). When set to true, Fuubar will periodically refresh the progress bar via a background thread.fuubar_output_pending_results: A Boolean (default: true). Controls whether pending results are outputted during the test run.RSpec.configure do |config|
config.fuubar_progress_bar_options = { format: ' %c/%C |%w>%i| %e ' }
config.fuubar_auto_refresh = true
config.fuubar_output_pending_results = false
end