parent
a60a67c431
commit
7ed7b1ef64
|
@ -159,6 +159,8 @@ describe EmailUpdater do
|
|||
|
||||
context 'confirming a valid token' do
|
||||
it "adds a user email" do
|
||||
expect(UserHistory.where(action: UserHistory.actions[:add_email], acting_user_id: user.id).last).to be_present
|
||||
|
||||
Jobs.expects(:enqueue).once.with(:critical_user_email, has_entries(type: :notify_old_email_add, to_address: old_email))
|
||||
updater.confirm(@change_req.new_email_token.token)
|
||||
expect(updater.errors).to be_blank
|
||||
|
|
|
@ -2581,7 +2581,8 @@ describe UsersController do
|
|||
expect(user_email.reload.primary).to eq(true)
|
||||
expect(other_email.reload.primary).to eq(false)
|
||||
|
||||
put "/u/#{user.username}/preferences/primary-email.json", params: { email: other_email.email }
|
||||
expect { put "/u/#{user.username}/preferences/primary-email.json", params: { email: other_email.email } }
|
||||
.to change { UserHistory.where(action: UserHistory.actions[:update_email], acting_user_id: user.id).count }.by(1)
|
||||
expect(response.status).to eq(200)
|
||||
expect(user_email.reload.primary).to eq(false)
|
||||
expect(other_email.reload.primary).to eq(true)
|
||||
|
@ -2604,7 +2605,8 @@ describe UsersController do
|
|||
expect(response.status).to eq(428)
|
||||
expect(user.reload.user_emails.pluck(:email)).to contain_exactly(user_email.email, other_email.email)
|
||||
|
||||
delete "/u/#{user.username}/preferences/email.json", params: { email: other_email.email }
|
||||
expect { delete "/u/#{user.username}/preferences/email.json", params: { email: other_email.email } }
|
||||
.to change { UserHistory.where(action: UserHistory.actions[:destroy_email], acting_user_id: user.id).count }.by(1)
|
||||
expect(response.status).to eq(200)
|
||||
expect(user.reload.user_emails.pluck(:email)).to contain_exactly(user_email.email)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue