Skip to content

Instantly share code, notes, and snippets.

@davidbella
Created October 29, 2013 18:46
Show Gist options
  • Save davidbella/7220354 to your computer and use it in GitHub Desktop.
Save davidbella/7220354 to your computer and use it in GitHub Desktop.
RSpec: Good simplecov config using Guard notifier
require 'simplecov'
SimpleCov.start do
add_filter '/db/'
add_filter '/config/'
add_filter '/spec/'
add_filter '/public/'
add_filter '/lib/' # Feel free to write coverage for the StudentScrape
SimpleCov.at_exit do
SimpleCov.result.format!
result = SimpleCov.result
percentage = result.covered_lines / Float(result.total_lines) * 100
text = result.covered_lines.to_s
text << " / " + result.total_lines.to_s
text << " lines - " + percentage.to_s + "%"
Guard::Notifier.notify(
text,
:title => "SimpleCov",
:image => percentage < 95 ? :failed : :success
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment