* Lock erb_lint * Refactor moderation spec * Remove & replace RequestSpecHelper * Update uid to sequence * Lower the need for persistence in specs * Update moderation spec * Update shoulda-matchers * Enable backgroundjobs and update commenct spec * Fix fail specs * Update comment's validations * Remove redundent specs * Actually turn off DJ * Apply run_background_jobs_immediately * Remove giveawy specs * Create Identity spec
19 lines
486 B
Ruby
19 lines
486 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe ArticleObserver, type: :observer do
|
|
let(:user) { create(:user) }
|
|
|
|
before do
|
|
allow(SlackBot).to receive(:ping).and_return(true)
|
|
end
|
|
|
|
it "pings slack if user with warned role creates an article" do
|
|
user.add_role :warned
|
|
Article.observers.enable :article_observer do
|
|
run_background_jobs_immediately do
|
|
create(:article, user_id: user.id)
|
|
end
|
|
end
|
|
expect(SlackBot).to have_received(:ping).twice
|
|
end
|
|
end
|