File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ def email_not_already_used_by_organization
9494 end
9595
9696 def email_not_already_used_by_user
97+ return if rejected? || admin_closed?
9798 user = User . find_by ( email : email )
9899 if user && ( !organization || user . organization_id != organization . id )
99100 errors . add ( :email , 'already used by an existing User' )
Original file line number Diff line number Diff line change 6161 expect ( subject . valid? ) . to eq ( false )
6262 expect ( subject . errors . messages [ :email ] ) . to match_array ( [ "already used by an existing User" ] )
6363 end
64+
65+ [ :rejected , :admin_closed ] . each do |status |
66+ context "when the status is #{ status } " do
67+ before { subject . status = status }
68+
69+ it 'allows the email' do
70+ expect ( subject ) . to be_valid
71+ end
72+ end
73+ end
6474 end
6575 end
6676
You can’t perform that action at this time.
0 commit comments