Merge pull request #73 from joona/use_authorize
use_authorize setting should be retrieved from passed options
Rashmi Yadav
9 years ago
50 | 50 |
end
|
51 | 51 |
end
|
52 | 52 |
|
53 | |
if request.params['use_authorize'] == 'true'
|
|
53 |
if (options[:use_authorize] && options[:use_authorize] != false) || request.params['use_authorize'] == 'true'
|
54 | 54 |
options[:client_options][:authorize_path] = '/oauth/authorize'
|
55 | 55 |
else
|
56 | 56 |
options[:client_options][:authorize_path] = '/oauth/authenticate'
|
65 | 65 |
expect { subject.request_phase }.not_to raise_error
|
66 | 66 |
end
|
67 | 67 |
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
|
68 | 82 |
end
|
69 | 83 |
end
|