Update rubocop to 2.3.1.

This commit is contained in:
Guo Xiang Tan
2020-07-24 17:16:52 +08:00
parent a9905ef7e5
commit c6202af005
24 changed files with 360 additions and 210 deletions

View File

@@ -134,38 +134,27 @@ RSpec.describe ReviewableUser, type: :model do
before do
SiteSetting.must_approve_users = true
Jobs.run_immediately!
@reviewable = ReviewableUser.find_by(target: user)
Jobs.run_later!
end
it "creates the ReviewableUser for a user, with moderator access" do
reviewable = ReviewableUser.find_by(target: user)
expect(reviewable).to be_present
expect(reviewable.reviewable_by_moderator).to eq(true)
expect(@reviewable.reviewable_by_moderator).to eq(true)
end
context "email jobs" do
let(:reviewable) { ReviewableUser.find_by(target: user) }
before do
reviewable
# We can ignore these notifications for the purpose of this test
Jobs.stubs(:enqueue).with(:notify_reviewable, has_key(:reviewable_id))
end
after do
ReviewableUser.find_by(target: user).perform(admin, :approve_user)
end
it "enqueues a 'signup after approval' email if must_approve_users is true" do
Jobs.expects(:enqueue).with(
:critical_user_email, has_entries(type: :signup_after_approval)
)
expect_enqueued_with(job: :critical_user_email, args: { type: :signup_after_approval }) do
@reviewable.perform(admin, :approve_user)
end
end
it "doesn't enqueue a 'signup after approval' email if must_approve_users is false" do
SiteSetting.must_approve_users = false
Jobs.expects(:enqueue).with(
:critical_user_email, has_entries(type: :signup_after_approval)
).never
expect_not_enqueued_with(job: :critical_user_email, args: { type: :signup_after_approval }) do
@reviewable.perform(admin, :approve_user)
end
end
end