diff --git a/lib/sorcery/providers/twitter.rb b/lib/sorcery/providers/twitter.rb index 59205995..6eb8721e 100644 --- a/lib/sorcery/providers/twitter.rb +++ b/lib/sorcery/providers/twitter.rb @@ -15,7 +15,7 @@ def initialize super @site = 'https://api.twitter.com' - @user_info_path = '/1.1/account/verify_credentials.json' + @user_info_path = '/1.1/account/verify_credentials.json?include_email=true' end # Override included get_consumer method to provide authorize_path diff --git a/spec/shared_examples/user_shared_examples.rb b/spec/shared_examples/user_shared_examples.rb index c563cc95..938cf96e 100644 --- a/spec/shared_examples/user_shared_examples.rb +++ b/spec/shared_examples/user_shared_examples.rb @@ -550,14 +550,27 @@ def self.matches?(crypted, *tokens) end end - it 'supports nested attributes' do - sorcery_model_property_set(:authentications_class, Authentication) + context 'nested attributes' do + before(:each) do + sorcery_model_property_set(:authentications_class, Authentication) + end - expect do - User.create_from_provider('facebook', '123', username: 'Noam Ben Ari') - end.to change { User.count }.by(1) + it 'supports for facebook' do + expect do + User.create_from_provider('facebook', '123', username: 'Noam Ben Ari') + end.to change { User.count }.by(1) + + expect(User.first.username).to eq 'Noam Ben Ari' + end - expect(User.first.username).to eq 'Noam Ben Ari' + it 'supports for twitter' do + expect do + User.create_from_provider('twitter', '456', username: 'Evan B', email: 'hello@gmail.com') + end.to change { User.count }.by(1) + + expect(User.first.username).to eq 'Evan B' + expect(User.first.email).to eq 'hello@gmail.com' + end end context 'with block' do