From 7d066d16e629cea28b9f6c56bd8a5626815e6fd7 Mon Sep 17 00:00:00 2001 From: Rashmi Yadav Date: Fri, 3 Feb 2017 20:24:08 +0530 Subject: [PATCH] =?UTF-8?q?Call=20parent=20class=20callback=5Furl=20when?= =?UTF-8?q?=20params[=E2=80=98callback=5Furl=E2=80=99]=20is=20nil?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/omniauth/strategies/twitter.rb | 8 +++++++- spec/omniauth/strategies/twitter_spec.rb | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/omniauth/strategies/twitter.rb b/lib/omniauth/strategies/twitter.rb index 3d890b61..26ada821 100644 --- a/lib/omniauth/strategies/twitter.rb +++ b/lib/omniauth/strategies/twitter.rb @@ -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 diff --git a/spec/omniauth/strategies/twitter_spec.rb b/spec/omniauth/strategies/twitter_spec.rb index 08d726f7..7b1f8f57 100644 --- a/spec/omniauth/strategies/twitter_spec.rb +++ b/spec/omniauth/strategies/twitter_spec.rb @@ -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