DEV: add a spec for "accept invite" log_on_user behaviour

DEV: add a spec for “accept invite” log_on_user behaviour

diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb
index b814df7..037d2aa 100644
--- a/spec/requests/invites_controller_spec.rb
+++ b/spec/requests/invites_controller_spec.rb
@@ -335,7 +335,10 @@ describe InvitesController do
               before { 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 do
               before { 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"))

GitHub sha: 05c015d2

1 Like

Awesome! Thanks for adding this

1 Like