Permalink
Browse files

Fix typo that caused x_auth_access_type setting to fail sometimes

  • Loading branch information...
1 parent fb54d53 commit f2688df5ea4510e2d37e5e2288b1ccc1b2e89897 @sebbacon sebbacon committed Mar 18, 2013
Showing with 16 additions and 1 deletion.
  1. +1 −1 lib/omniauth/strategies/twitter.rb
  2. +15 −0 spec/omniauth/strategies/twitter_spec.rb
@@ -50,7 +50,7 @@ def request_phase
options[:authorize_params].merge!(:force_login => 'true', :screen_name => screen_name)
end
if x_auth_access_type
- options[:request_params] || {}
+ options[:request_params] ||= {}
options[:request_params].merge!(:x_auth_access_type => x_auth_access_type)
end
@@ -18,4 +18,19 @@
expect(subject.options.client_options.authorize_path).to eq('/oauth/authenticate')
end
end
+
+ describe 'request_phase' do
+ context 'no request params set and x_auth_access_type specified' do
+ before do
+ subject.options[:request_params] = nil
+ subject.stub(:session).and_return(
+ {'omniauth.params' => {'x_auth_access_type' => 'read'}})
+ subject.stub(:old_request_phase).and_return(:whatever)
+ end
+
+ it 'should not break' do
+ expect { subject.request_phase }.not_to raise_error
+ end
+ end
+ end
end

0 comments on commit f2688df

Please sign in to comment.