Commit c30a8f26 authored by Serena Fang's avatar Serena Fang

Add confirmed to email entity

parent 4371aec5
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module API module API
module Entities module Entities
class Email < Grape::Entity class Email < Grape::Entity
expose :id, :email expose :id, :email, :confirmed?
end end
end end
end end
...@@ -1795,8 +1795,7 @@ RSpec.describe API::Users do ...@@ -1795,8 +1795,7 @@ RSpec.describe API::Users do
post api("/users/#{user.id}/emails", admin), params: email_attrs post api("/users/#{user.id}/emails", admin), params: email_attrs
end.to change { user.emails.count }.by(1) end.to change { user.emails.count }.by(1)
email = Email.find_by(user_id: user.id, email: email_attrs[:email]) expect(json_response['confirmed?']).to be_falsey
expect(email).not_to be_confirmed
end end
it "returns a 400 for invalid ID" do it "returns a 400 for invalid ID" do
...@@ -1813,8 +1812,7 @@ RSpec.describe API::Users do ...@@ -1813,8 +1812,7 @@ RSpec.describe API::Users do
expect(response).to have_gitlab_http_status(:created) expect(response).to have_gitlab_http_status(:created)
email = Email.find_by(user_id: user.id, email: email_attrs[:email]) expect(json_response['confirmed?']).to be_truthy
expect(email).to be_confirmed
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment