Skip to content

Commit 5d4c2d4

Browse files
authored
Fix failing isolated tests (#249)
1 parent a6cef7e commit 5d4c2d4

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

spec/controllers/controller_oauth2_spec.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,21 @@
116116
end
117117

118118
context 'when callback_url begin with http://' do
119+
before do
120+
sorcery_controller_external_property_set(:facebook, :callback_url, '/oauth/twitter/callback')
121+
sorcery_controller_external_property_set(:facebook, :api_version, 'v2.2')
122+
end
123+
119124
it 'login_at redirects correctly' do
120125
create_new_user
121126
get :login_at_test_facebook
122127
expect(response).to be_a_redirect
123128
expect(response).to redirect_to("https://www.facebook.com/v2.2/dialog/oauth?client_id=#{::Sorcery::Controller::Config.facebook.key}&display=page&redirect_uri=http%3A%2F%2Ftest.host%2Foauth%2Ftwitter%2Fcallback&response_type=code&scope=email&state")
124129
end
130+
131+
after do
132+
sorcery_controller_external_property_set(:facebook, :callback_url, 'http://blabla.com')
133+
end
125134
end
126135

127136
it "'login_from' logins if user exists" do

spec/controllers/controller_oauth_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,17 @@ def stub_all_oauth_requests!
8484
end
8585

8686
context 'when callback_url begin with http://' do
87+
before do
88+
sorcery_controller_external_property_set(:twitter, :callback_url, '/oauth/twitter/callback')
89+
end
8790
it 'login_at redirects correctly', pending: true do
8891
get :login_at_test
8992
expect(response).to be_a_redirect
9093
expect(response).to redirect_to('http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla.com&oauth_token=')
9194
end
95+
after do
96+
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
97+
end
9298
end
9399

94100
it 'logins if user exists' do

0 commit comments

Comments
 (0)