Created
October 29, 2013 18:46
-
-
Save davidbella/7220354 to your computer and use it in GitHub Desktop.
RSpec: Good simplecov config using Guard notifier
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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