* Add delayed_job_web to dev environment for debugging * Add specs for the current Follow callbacks implementation * Move follower touching to ActiveJob * Spec for the touch followers job * Move Follow#create_chat_channel to ActiveJob and make the job safe * Add ActiveJob to send email notifications about follows * Enqueue SendEmailNotificationJob after the follow is created * Specs to wnsure jobs are enqueued on Follow creation * Make CreateChatChannelJob queue name more specific * Reaction specs for Reaction after_save callbacks logic * Touch user job * Call Users::TouchJob on reaction create * Move updating reactable to a separate job * Move busting reactable cache to a separate job * Bust homepage cache after reaction save in a separate job * Spec for enqueueing Users::TouchJob on reaction create * Refactor Reactions::UpdateReactable job * Fix observer spec
21 lines
582 B
Ruby
21 lines
582 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe CommentObserver, type: :observer do
|
|
let(:user) { create(:user) }
|
|
let(:article) { create(:article) }
|
|
|
|
before do
|
|
allow(SlackBot).to receive(:ping).and_return(true)
|
|
end
|
|
|
|
it "pings slack if user with warned role creates a comment" do
|
|
ActiveJob::Base.queue_adapter = :inline
|
|
user.add_role :warned
|
|
Comment.observers.enable :comment_observer do
|
|
run_background_jobs_immediately do
|
|
create(:comment, user: user, commentable: article)
|
|
end
|
|
end
|
|
expect(SlackBot).to have_received(:ping).twice
|
|
end
|
|
end
|