diff --git a/README.md b/README.md index e103d90..cd5aa9b 100644 --- a/README.md +++ b/README.md @@ -15,3 +15,27 @@ Add to your `spec_helper.rb` or `rails_helper.rb`: ``` require "chat_notifier/rspec_formatter" ``` + +### Debug your Slack setup + +Create rake task to test the connection to your Slack channel + +```ruby +namespace :chat_notifier do + task debug: :environment do + unless ENV["SLACK_WEBHOOK_URL"] + puts "You MUST set the environment variables for:\nSLACK_WEBHOOK_URL" + return + end + ENV["DEBUG"] = "1" + ENV["CURRENT_REPOSITORY_URL"] = "https://example.com" + ENV["TEST_RUN_ID"] = "9999" + require "chat_notifier" + + failure = ChatNotifier::DebugExceptionLocation.new(location: "fake/path.rb") + summary = ChatNotifier::DebugSummary.new(failed_examples: [failure]) + + ChatNotifier.debug!(ENV, summary:) + end +end +```