Skip to content

Commit ea2fa90

Browse files
committed
Fix a pending test
Simply removing pending and adjusting the value allowed the test to pass when run individually(e.g., `rspec ./spec/controllers/controller_oauth_spec.rb:93`), but it failed when runnning the whole file (e.g., rspec ./spec/controllers/controller_oauth_spec.rb) The cause was that the test above was updating `original_callback_url`, and it wasn't beging reset for test next test ( [related code](https://github.com/Sorcery/sorcery/blob/24463e026609072ee51be30a8539a22f97844078/lib/sorcery/controller/submodules/external.rb#L106) ).Resetting `original_callback_url` in each test made the test pass.
1 parent 24463e0 commit ea2fa90

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

spec/controllers/controller_oauth_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,22 @@ def response.body
8181
end
8282
after do
8383
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
84+
sorcery_controller_external_property_set(:twitter, :original_callback_url, nil)
8485
end
8586
end
8687

8788
context 'when callback_url begin with http://' do
8889
before do
89-
sorcery_controller_external_property_set(:twitter, :callback_url, '/oauth/twitter/callback')
90+
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com/oauth/twitter/callback')
9091
end
91-
it 'login_at redirects correctly', pending: true do
92+
it 'login_at redirects correctly' do
9293
get :login_at_test
9394
expect(response).to be_a_redirect
94-
expect(response).to redirect_to('http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla.com&oauth_token=')
95+
expect(response).to redirect_to('http://myapi.com/oauth/authorize?oauth_callback=http%3A%2F%2Fblabla.com%2Foauth%2Ftwitter%2Fcallback&oauth_token=')
9596
end
9697
after do
9798
sorcery_controller_external_property_set(:twitter, :callback_url, 'http://blabla.com')
99+
sorcery_controller_external_property_set(:twitter, :original_callback_url, nil)
98100
end
99101
end
100102

0 commit comments

Comments
 (0)