Skip to content

Commit

Permalink
Call parent class callback_url when params[‘callback_url’] is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
raysrashmi authored and bzf committed Feb 6, 2017
1 parent 4b6122a commit 7d066d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/omniauth/strategies/twitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ def request_phase
old_request_phase
end

alias :old_callback_url :callback_url

def callback_url
request.params['callback_url']
if request.params['callback_url']
request.params['callback_url']
else
old_callback_url
end
end

def callback_path
Expand Down
3 changes: 2 additions & 1 deletion spec/omniauth/strategies/twitter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,11 @@
double('Session', :[] => {})
end
allow(subject).to receive(:old_request_phase) { :whatever }
allow(subject).to receive(:old_callback_url).and_return(:old_callback)
end

it 'callback_url should return nil' do
expect(subject.callback_url).to be_nil
expect(subject.callback_url).to eq :old_callback
end

it 'should return the default callback_path value' do
Expand Down

0 comments on commit 7d066d1

Please sign in to comment.