Skip to content

Commit 7052d0b

Browse files
committed
Move the process of resetting configuration values to the top level to make it DRY�
1 parent a02ed27 commit 7052d0b

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

spec/controllers/controller_oauth_spec.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,34 +70,33 @@ def response.body
7070
stub_all_oauth_requests!
7171
end
7272

73+
after do
74+
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
75+
sorcery_controller_external_property_set(:twitter, :original_callback_url, nil)
76+
end
77+
7378
context 'when callback_url begins with /' do
7479
before do
7580
sorcery_controller_external_property_set(:twitter, :callback_url, '/oauth/twitter/callback')
7681
end
82+
7783
it 'login_at redirects correctly' do
7884
get :login_at_test
7985
expect(response).to be_a_redirect
8086
expect(response).to redirect_to('http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Ftest.host%2Foauth%2Ftwitter%2Fcallback&oauth_token=')
8187
end
82-
after do
83-
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
84-
sorcery_controller_external_property_set(:twitter, :original_callback_url, nil)
85-
end
8688
end
8789

8890
context 'when callback_url begins with http://' do
8991
before do
9092
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com/oauth/twitter/callback')
9193
end
94+
9295
it 'login_at redirects correctly' do
9396
get :login_at_test
9497
expect(response).to be_a_redirect
9598
expect(response).to redirect_to('http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla.com%2Foauth%2Ftwitter%2Fcallback&oauth_token=')
9699
end
97-
after do
98-
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
99-
sorcery_controller_external_property_set(:twitter, :original_callback_url, nil)
100-
end
101100
end
102101

103102
it 'logins if user exists' do

0 commit comments

Comments
 (0)