Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (38 sloc) 947 Bytes
require 'rspec/core/formatters/base_text_formatter'
require "tmux"
require "tmux/widgets/progress_bar"
class Tmuxbar < RSpec::Core::Formatters::BaseFormatter
RSpec::Core::Formatters.register self,
:example_passed,
:example_pending,
:example_failed,
:start,
:stop
def start(notification)
init_bar notification.count
end
def stop(notification)
@session.status_bar.right.pop_widget(@bar) if @session
end
def example_passed(notification)
increment_bar
end
def example_pending(notification)
increment_bar
end
def example_failed(notification)
increment_bar
end
private
def increment_bar
@bar.value += 1 if @bar
end
def init_bar(size)
server = Tmux::Server.new
if (@session = server.sessions(:attached => true).first)
@bar = Tmux::Widgets::ProgressBar.new("RSpec")
@bar.total = size
@session.status_bar.right.add_widget(@bar)
end
end
end
Jump to Line
Something went wrong with that request. Please try again.