Skip to content

Commit

Permalink
Add a sample rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
saturnflyer committed Apr 19, 2023
1 parent 5130199 commit 0549e91
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

0 comments on commit 0549e91

Please sign in to comment.