Codebase list ruby-omniauth-twitter / bc39062
Merge pull request #73 from joona/use_authorize use_authorize setting should be retrieved from passed options Rashmi Yadav 9 years ago
2 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
5050 end
5151 end
5252
53 if request.params['use_authorize'] == 'true'
53 if (options[:use_authorize] && options[:use_authorize] != false) || request.params['use_authorize'] == 'true'
5454 options[:client_options][:authorize_path] = '/oauth/authorize'
5555 else
5656 options[:client_options][:authorize_path] = '/oauth/authenticate'
6565 expect { subject.request_phase }.not_to raise_error
6666 end
6767 end
68
69 context "with no request params set and use_authorize options provided" do
70 before do
71 @options = { :use_authorize => true }
72 subject.stub(:request).and_return(
73 double('Request', {:params => {}})
74 )
75 subject.stub(:old_request_phase).and_return(:whatever)
76 end
77
78 it "should switch authorize_path from authenticate to authorize" do
79 expect { subject.request_phase }.to change { subject.options.client_options.authorize_path }.from('/oauth/authenticate').to('/oauth/authorize')
80 end
81 end
6882 end
6983 end