discourse/spec/jobs/create_user_reviewable_spec.rb
Robin Ward 111a502231 FIX: Deleting Users should work nicely with Reviewable Users
"Rejecting" a user in the queue is equivalent to deleting them, which
would then making it impossible to review rejected users. Now we store
information about the user in the payload so if they are deleted things
still display in the Rejected view.

Secondly, if a user is destroyed outside of the review queue, it will
now automatically "Reject" that queue item.
2019-04-03 16:42:39 -04:00

20 lines
614 B
Ruby

require 'rails_helper'
require_dependency 'jobs/regular/create_user_reviewable'
describe Jobs::CreateUserReviewable do
let(:user) { Fabricate(:user) }
it "creates the reviewable" do
described_class.new.execute(user_id: user.id)
reviewable = Reviewable.find_by(target: user)
expect(reviewable).to be_present
expect(reviewable.pending?).to eq(true)
expect(reviewable.reviewable_scores).to be_present
expect(reviewable.payload['username']).to eq(user.username)
expect(reviewable.payload['name']).to eq(user.name)
expect(reviewable.payload['email']).to eq(user.email)
end
end