A platform for community discussion. Free, open, simple.
DEV: add a spec for "accept invite" log_on_user behaviour
Arpit Jalan05c015d25277
diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rbindex b814df7234b..037d2aa0476 100644--- a/spec/requests/invites_controller_spec.rb+++ b/spec/requests/invites_controller_spec.rb@@ -335,7 +335,10 @@ describe InvitesController dobefore { invite.update_column(:via_email, true) }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(JSON.parse(response.body)["success"]).to eq(true)@@ -352,7 +355,10 @@ describe InvitesController dobefore { invite.update_column(:via_email, false) }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(JSON.parse(response.body)["success"]).to eq(true)expect(JSON.parse(response.body)["message"]).to eq(I18n.t("invite.confirm_email"))