mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-03-14 00:50:14 -04:00
Have activate user return json
- Change activate user from admin controller to return json - Test that it returns json - Remove unnessary test from log_out spec This commit was created so that when you activate a user through the api it returns a json response.
This commit is contained in:
parent
f0dda91364
commit
1d0eccf710
2 changed files with 14 additions and 6 deletions
|
@ -198,7 +198,7 @@ class Admin::UsersController < Admin::AdminController
|
|||
def activate
|
||||
guardian.ensure_can_activate!(@user)
|
||||
@user.activate
|
||||
render nothing: true
|
||||
render json: success_json
|
||||
end
|
||||
|
||||
def deactivate
|
||||
|
|
|
@ -360,16 +360,24 @@ describe Admin::UsersController do
|
|||
end
|
||||
end
|
||||
|
||||
context 'activate' do
|
||||
before do
|
||||
@reg_user = Fabricate(:inactive_user)
|
||||
end
|
||||
|
||||
it "returns success" do
|
||||
xhr :put, :activate, user_id: @reg_user.id
|
||||
response.should be_success
|
||||
json = ::JSON.parse(response.body)
|
||||
json['success'].should == "OK"
|
||||
end
|
||||
end
|
||||
|
||||
context 'log_out' do
|
||||
before do
|
||||
@reg_user = Fabricate(:user)
|
||||
end
|
||||
|
||||
it 'returns JSON' do
|
||||
xhr :put, :log_out, user_id: @reg_user.id
|
||||
::JSON.parse(response.body).should be_present
|
||||
end
|
||||
|
||||
it "returns success" do
|
||||
xhr :put, :log_out, user_id: @reg_user.id
|
||||
response.should be_success
|
||||
|
|
Loading…
Reference in a new issue