mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 15:06:17 +08:00
DEV: add a spec for "accept invite" log_on_user behaviour
This commit is contained in:
parent
3457395f75
commit
05c015d252
|
@ -335,7 +335,10 @@ describe InvitesController do
|
||||||
before { invite.update_column(:via_email, true) }
|
before { invite.update_column(:via_email, true) }
|
||||||
|
|
||||||
it "doesn't send an activation email and activates the user" do
|
it "doesn't send an activation email and activates the user" do
|
||||||
put "/invites/show/#{invite.invite_key}.json", params: { password: "verystrongpassword" }
|
expect do
|
||||||
|
put "/invites/show/#{invite.invite_key}.json", params: { password: "verystrongpassword" }
|
||||||
|
end.to change { UserAuthToken.count }.by(1)
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
expect(JSON.parse(response.body)["success"]).to eq(true)
|
expect(JSON.parse(response.body)["success"]).to eq(true)
|
||||||
|
|
||||||
|
@ -352,7 +355,10 @@ describe InvitesController do
|
||||||
before { invite.update_column(:via_email, false) }
|
before { invite.update_column(:via_email, false) }
|
||||||
|
|
||||||
it "sends an activation email and doesn't activate the user" do
|
it "sends an activation email and doesn't activate the user" do
|
||||||
put "/invites/show/#{invite.invite_key}.json", params: { password: "verystrongpassword" }
|
expect do
|
||||||
|
put "/invites/show/#{invite.invite_key}.json", params: { password: "verystrongpassword" }
|
||||||
|
end.not_to change { UserAuthToken.count }
|
||||||
|
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
expect(JSON.parse(response.body)["success"]).to eq(true)
|
expect(JSON.parse(response.body)["success"]).to eq(true)
|
||||||
expect(JSON.parse(response.body)["message"]).to eq(I18n.t("invite.confirm_email"))
|
expect(JSON.parse(response.body)["message"]).to eq(I18n.t("invite.confirm_email"))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user