126 | 126 |
|
127 | 127 |
it "should switch authorize_path from authenticate to authorize" do
|
128 | 128 |
expect { subject.request_phase }.to change { subject.options.client_options.authorize_path }.from('/oauth/authenticate').to('/oauth/authorize')
|
|
129 |
end
|
|
130 |
end
|
|
131 |
|
|
132 |
context 'with a specified callback_url in the params' do
|
|
133 |
before do
|
|
134 |
params = { 'callback_url' => 'http://foo.dev/auth/twitter/foobar' }
|
|
135 |
allow(subject).to receive(:request) do
|
|
136 |
double('Request', :params => params)
|
|
137 |
end
|
|
138 |
allow(subject).to receive(:session) do
|
|
139 |
double('Session', :[] => { 'callback_url' => params['callback_url'] })
|
|
140 |
end
|
|
141 |
allow(subject).to receive(:old_request_phase) { :whatever }
|
|
142 |
end
|
|
143 |
|
|
144 |
it 'should use the callback_url' do
|
|
145 |
expect(subject.callback_url).to eq 'http://foo.dev/auth/twitter/foobar'
|
|
146 |
end
|
|
147 |
|
|
148 |
it 'should return the correct callback_path' do
|
|
149 |
expect(subject.callback_path).to eq '/auth/twitter/foobar'
|
|
150 |
end
|
|
151 |
end
|
|
152 |
|
|
153 |
context 'with no callback_url set' do
|
|
154 |
before do
|
|
155 |
allow(subject).to receive(:request) do
|
|
156 |
double('Request', :params => {})
|
|
157 |
end
|
|
158 |
allow(subject).to receive(:session) do
|
|
159 |
double('Session', :[] => {})
|
|
160 |
end
|
|
161 |
allow(subject).to receive(:old_request_phase) { :whatever }
|
|
162 |
end
|
|
163 |
|
|
164 |
it 'callback_url should return nil' do
|
|
165 |
expect(subject.callback_url).to be_nil
|
|
166 |
end
|
|
167 |
|
|
168 |
it 'should return the default callback_path value' do
|
|
169 |
expect(subject.callback_path).to eq '/auth/twitter/callback'
|
129 | 170 |
end
|
130 | 171 |
end
|
131 | 172 |
|