Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Color background red if specs fail. #2

Closed
wants to merge 4 commits into from

2 participants

@nightscape

No description provided.

@juanibiapina
Owner

Cool! I'll take a look at this soon.

@juanibiapina

For my current setup I use guard and they recently added a tmux notifier. The background of the left side of the bar changes color according to test results (even though it only happens in the end, I think). For now this is better for me because is more subtle and allows me to configure the colors in my guardfile.

I don't usually run tests outside of guard though. And I also use this: https://github.com/juanibiapina/rspec-nc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 1 deletion.
  1. +3 −1 README.md
  2. +6 −0 lib/tmuxbar.rb
View
4 README.md
@@ -26,4 +26,6 @@ The progress bar should appear on the current attached session.
## Under the hood
-Tmuxbar is just a wrapper over [Fuubar](https://github.com/jeffkreeftmeijer/fuubar) that uses tmux-ruby to display the progress bar widget. It doesn't actually notify you of passing or failing tests. For that I use [guard](https://github.com/guard/guard) and [terminal-notifier-guard](https://github.com/Springest/terminal-notifier-guard).
+Tmuxbar is just a wrapper over [Fuubar](https://github.com/jeffkreeftmeijer/fuubar) that uses tmux-ruby to display the progress bar widget.
+It notifies you of passing or failing tests by setting the background color.
+For the same purpose you can also use [guard](https://github.com/guard/guard) and [terminal-notifier-guard](https://github.com/Springest/terminal-notifier-guard).
View
6 lib/tmuxbar.rb
@@ -6,6 +6,7 @@ class Tmuxbar < RSpec::Core::Formatters::BaseTextFormatter
def start(example_count)
super
init_bar example_count
+ self.background = :green
end
def stop
@@ -25,6 +26,7 @@ def example_pending(example)
def example_failed(example)
super
+ self.background = :red
increment_bar
end
@@ -46,6 +48,10 @@ def increment_bar
@bar.value += 1 if @bar
end
+ def background=(color)
+ @bar.field.background_color = color if @bar
+ end
+
def init_bar(size)
server = Tmux::Server.new
if (@session = server.sessions(attached: true).first)
Something went wrong with that request. Please try again.