|
20 | 20 | end |
21 | 21 |
|
22 | 22 | it 'allows twitter login for new user' do |
23 | | - get :twitter |
| 23 | + post :callback, params: {provider: 'twitter'} |
24 | 24 | expect(response).to redirect_to(edit_profile_url) |
25 | 25 | expect(User.last.identities.find_by(provider: 'twitter')).to be_present |
26 | 26 | end |
|
37 | 37 | let!(:identity) { user.identities.create!(provider: 'github', uid: github_auth_hash.uid) } |
38 | 38 |
|
39 | 39 | it 'finds user via identity and signs in' do |
40 | | - expect { get :github }.not_to change { User.count } |
| 40 | + expect { post :callback, params: {provider: 'github'} }.not_to change { User.count } |
41 | 41 | expect(controller.current_user).to eq(user) |
42 | 42 | end |
43 | 43 | end |
|
46 | 46 | let!(:user) { create(:user, provider: 'github', uid: github_auth_hash.uid) } |
47 | 47 |
|
48 | 48 | it 'finds user via legacy lookup and signs in' do |
49 | | - expect { get :github }.not_to change { User.count } |
| 49 | + expect { post :callback, params: {provider: 'github'} }.not_to change { User.count } |
50 | 50 | expect(controller.current_user).to eq(user) |
51 | 51 | end |
52 | 52 | end |
|
63 | 63 | user = create(:user) |
64 | 64 | sign_in(user) |
65 | 65 |
|
66 | | - expect { get :github }.to change { user.identities.count }.by(1) |
| 66 | + expect { post :callback, params: {provider: 'github'} }.to change { user.identities.count }.by(1) |
67 | 67 | expect(response).to redirect_to(edit_profile_path) |
68 | 68 | expect(flash[:info]).to eq('Successfully connected GitHub to your account.') |
69 | 69 | end |
|
75 | 75 | user.identities.create!(provider: 'github', uid: github_auth_hash.uid) |
76 | 76 | sign_in(user) |
77 | 77 |
|
78 | | - expect { get :github }.not_to change { Identity.count } |
| 78 | + expect { post :callback, params: {provider: 'github'} }.not_to change { Identity.count } |
79 | 79 | expect(response).to redirect_to(edit_profile_path) |
80 | 80 | expect(flash[:info]).to eq('GitHub is already connected to your account.') |
81 | 81 | end |
|
89 | 89 | user = create(:user) |
90 | 90 | sign_in(user) |
91 | 91 |
|
92 | | - expect { get :github }.not_to change { Identity.count } |
| 92 | + expect { post :callback, params: {provider: 'github'} }.not_to change { Identity.count } |
93 | 93 | expect(response).to redirect_to(edit_profile_path) |
94 | 94 | expect(flash[:danger]).to eq('This GitHub account is already connected to another user.') |
95 | 95 | end |
|
101 | 101 | user = create(:user) |
102 | 102 | sign_in(user) |
103 | 103 |
|
104 | | - get :github |
| 104 | + post :callback, params: {provider: 'github'} |
105 | 105 |
|
106 | 106 | expect(response).to redirect_to(merge_profile_path) |
107 | 107 | expect(session[:pending_merge_user_id]).to eq(legacy_user.id) |
|
0 commit comments