Created
January 11, 2022 20:37
-
-
Save joshmfrankel/0d52835bc0f9d5dc8a87ea09bd794d8b to your computer and use it in GitHub Desktop.
RSpec: Notify hook
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
config.after(:suite) do | |
reporter = config.reporter | |
total_examples = reporter.examples.count | |
failed_examples = reporter.failed_examples.count | |
if failed_examples == 0 | |
fork { exec("osascript -e 'display notification \"#{total_examples} test(s) passed\" with title \"\u2705 RSpec Passed\"'") } | |
else | |
fork { exec("osascript -e 'display notification \"#{failed_examples} failed, #{total_examples - failed_examples} passed\" with title \"\u26D4 RSpec Failed\"'") } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment