* Add Slack::Announcer and SlackClient * Add Slack::Messengers::Feedback class * Use Slack::Messengers::Feedback and refactor test * Should not raise an error if params are nil, let the job fail * Add Slack::Messengers::Sponsorship * Rename spec * Use Slack::Messengers::Sponsorship * Add Slack::Messengers::PotentialSpammer * Use Slack::Messengers::PotentialSpammer * Add Slack::Messengers::RateLimit and use it * Refactor a bit and improve tests * Add Slack::Messengers::Note and use it * Use Slack::Announcer and fix spec * Fix specs * Update app/services/slack/announcer.rb Co-Authored-By: Vaidehi Joshi <vaidehi.sj@gmail.com> * Implement review suggestions * Empty commit to trigger Travis Co-authored-by: Vaidehi Joshi <vaidehi.sj@gmail.com>
44 lines
1 KiB
Ruby
44 lines
1 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe SlackBotPingWorker, type: :worker do
|
|
let(:worker) { subject }
|
|
let(:params) do
|
|
{
|
|
message: "hello",
|
|
channel: "#help",
|
|
username: "sloan_watch_bot",
|
|
icon_emoji: ":sloan:"
|
|
}
|
|
end
|
|
|
|
include_examples "#enqueues_on_correct_queue", "default", [
|
|
{ message: "hello", channel: "#help", username: "sloan_watch_bot", icon_emoji: ":sloan:" },
|
|
]
|
|
|
|
describe "#perform_now" do
|
|
before { allow(Slack::Announcer).to receive(:call) }
|
|
|
|
it "calls the SlackBot" do
|
|
worker.perform(params)
|
|
|
|
expect(Slack::Announcer).to have_received(:call).with(params)
|
|
end
|
|
|
|
it "does nothing if there is missing data" do
|
|
worker.perform(
|
|
message: nil,
|
|
channel: nil,
|
|
username: nil,
|
|
icon_emoji: nil,
|
|
)
|
|
|
|
expect(Slack::Announcer).not_to have_received(:call)
|
|
end
|
|
|
|
it "works with keys as Strings" do
|
|
worker.perform(params.stringify_keys)
|
|
|
|
expect(Slack::Announcer).to have_received(:call).with(params)
|
|
end
|
|
end
|
|
end
|