Add Suspend User to flags page

This commit is contained in:
Robin Ward
2017-09-14 14:10:39 -04:00
parent 079f108ceb
commit 09ed2ed749
17 changed files with 177 additions and 55 deletions

View File

@ -122,9 +122,9 @@ describe Admin::UsersController do
context '.suspend' do
let(:user) { Fabricate(:evil_trout) }
let!(:api_key) { Fabricate(:api_key, user: user) }
it "works properly" do
Fabricate(:api_key, user: user)
put(
:suspend,
user_id: user.id,
@ -144,6 +144,24 @@ describe Admin::UsersController do
expect(log.details).to match(/because I said so/)
end
it "can have an associated post" do
post = Fabricate(:post)
put(
:suspend,
user_id: user.id,
suspend_until: 5.hours.from_now,
reason: "because of this post",
post_id: post.id,
format: :json
)
expect(response).to be_success
log = UserHistory.where(target_user_id: user.id).order('id desc').first
expect(log).to be_present
expect(log.post_id).to eq(post.id)
end
it "can send a message to the user" do
Jobs.expects(:enqueue).with(
:critical_user_email,