diff --git a/lib/sorcery/model/submodules/external.rb b/lib/sorcery/model/submodules/external.rb index 9db22c24..226ad8dd 100644 --- a/lib/sorcery/model/submodules/external.rb +++ b/lib/sorcery/model/submodules/external.rb @@ -61,7 +61,7 @@ def create_from_provider(provider, uid, attrs) # For external services that don't offer an email like twitter. unless attrs.has_key?(:email) && user.attributes.has_key?('email') - user.send(:'email=', '') + user.send(:'email=', "#{SecureRandom.uuid}@example.com") end if block_given? diff --git a/spec/shared_examples/user_shared_examples.rb b/spec/shared_examples/user_shared_examples.rb index bd2b93ce..0614c744 100644 --- a/spec/shared_examples/user_shared_examples.rb +++ b/spec/shared_examples/user_shared_examples.rb @@ -551,7 +551,7 @@ def self.matches?(crypted, *tokens) User.create_from_provider('facebook', '123', username: 'Noam Ben Ari') { true } end.to change { User.count }.by(1) - expect(User.first.email).to eq '' + expect(User.first.email).not_to be_empty end end