|
242 | 242 | context "authorize option #{k}" do |
243 | 243 | let(:request) { double('Request', params: { k.to_s => 'http://example.com' }, cookies: {}, env: {}) } |
244 | 244 |
|
245 | | - it "should set the #{k} authorize option dynamically in the request" do |
246 | | - @options = { k: '' } |
247 | | - expect(subject.authorize_params[k.to_s]).to eq('http://example.com') |
| 245 | + context 'when overridable_authorize_options is default' do |
| 246 | + it "should set the #{k} authorize option dynamically in the request" do |
| 247 | + @options = { k: '' } |
| 248 | + expect(subject.authorize_params[k.to_s]).to eq('http://example.com') |
| 249 | + end |
| 250 | + end |
| 251 | + |
| 252 | + context 'when overridable_authorize_options is empty' do |
| 253 | + it "should not set the #{k} authorize option dynamically in the request" do |
| 254 | + @options = { k: '', overridable_authorize_options: [] } |
| 255 | + expect(subject.authorize_params[k.to_s]).not_to eq('http://example.com') |
| 256 | + end |
248 | 257 | end |
249 | 258 | end |
250 | 259 | end |
251 | 260 |
|
252 | 261 | describe 'custom authorize_options' do |
253 | 262 | let(:request) { double('Request', params: { 'foo' => 'something' }, cookies: {}, env: {}) } |
254 | 263 |
|
255 | | - it 'should support request overrides from custom authorize_options' do |
256 | | - @options = { authorize_options: [:foo], foo: '' } |
257 | | - expect(subject.authorize_params['foo']).to eq('something') |
| 264 | + context 'when overridable_authorize_options is default' do |
| 265 | + it 'should not support request overrides from custom authorize_options' do |
| 266 | + @options = { authorize_options: [:foo], foo: '' } |
| 267 | + expect(subject.authorize_params['foo']).not_to eq('something') |
| 268 | + end |
| 269 | + end |
| 270 | + |
| 271 | + context 'when overridable_authorize_options is customized' do |
| 272 | + it 'should support request overrides from custom authorize_options' do |
| 273 | + @options = { authorize_options: [:foo], overridable_authorize_options: [:foo], foo: '' } |
| 274 | + expect(subject.authorize_params['foo']).to eq('something') |
| 275 | + end |
258 | 276 | end |
259 | 277 | end |
260 | 278 | end |
|
0 commit comments