Skip to content

Instantly share code, notes, and snippets.

@joshmfrankel
Created January 11, 2022 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshmfrankel/0d52835bc0f9d5dc8a87ea09bd794d8b to your computer and use it in GitHub Desktop.
Save joshmfrankel/0d52835bc0f9d5dc8a87ea09bd794d8b to your computer and use it in GitHub Desktop.
RSpec: Notify hook
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