FIX: Update activation email route was returning a generic json error.

This commit is contained in:
Guo Xiang Tan 2018-05-31 12:15:28 +08:00
parent 5a8d2b5e45
commit 95f9b72351
2 changed files with 8 additions and 8 deletions

View File

@ -749,7 +749,7 @@ class UsersController < ApplicationController
enqueue_activation_email
render json: success_json
else
render_json_error(@user)
render_json_error(primary_email)
end
end
end

View File

@ -2200,7 +2200,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to be_success
expect(response.status).to eq(200)
user.reload
expect(user.email).to eq('updatedemail@example.com')
@ -2219,7 +2219,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to_not be_success
expect(response.status).to eq(403)
end
it "raises an error with an invalid password" do
@ -2229,7 +2229,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to_not be_success
expect(response.status).to eq(403)
end
it "raises an error for an active user" do
@ -2239,7 +2239,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to_not be_success
expect(response.status).to eq(403)
end
it "raises an error when logged in" do
@ -2251,7 +2251,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to_not be_success
expect(response.status).to eq(403)
end
it "raises an error when the new email is taken" do
@ -2263,7 +2263,7 @@ describe UsersController do
email: user.email
}
expect(response).to_not be_success
expect(response.status).to eq(422)
end
it "can be updated" do
@ -2276,7 +2276,7 @@ describe UsersController do
email: 'updatedemail@example.com'
}
expect(response).to be_success
expect(response.status).to eq(200)
user.reload
expect(user.email).to eq('updatedemail@example.com')