From 7a7ec0d6f3be6705ec504b973893969b412627bd Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Wed, 18 May 2022 13:19:29 +0100 Subject: [PATCH] User is confirmable --- spec/models/user_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 9dff75fe3..eb8ce59c0 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -73,6 +73,18 @@ RSpec.describe User, type: :model do expect(user.need_two_factor_authentication?(nil)).to be false end + it "is confirmable" do + allow(DeviseNotifyMailer).to receive(:confirmation_instructions).and_return(OpenStruct.new(deliver: true)) + expect(DeviseNotifyMailer).to receive(:confirmation_instructions).once + User.create!( + name: "unconfirmed_user", + email: "unconfirmed_user@example.com", + password: "password123", + organisation: other_organisation, + role: "data_provider", + ) + end + context "when the user is a data provider" do it "cannot assign roles" do expect(user.assignable_roles).to eq({})