@@ -505,5 +505,65 @@ def printed_response
505
505
end
506
506
end
507
507
end
508
+
509
+ context 'with settings on defined routes' do
510
+ before do
511
+ a_remounted_api . desc 'Identical description'
512
+ a_remounted_api . route_setting :custom , key : 'value'
513
+ a_remounted_api . route_setting :custom_diff , key : 'foo'
514
+ a_remounted_api . get '/api1' do
515
+ status 200
516
+ end
517
+
518
+ a_remounted_api . desc 'Identical description'
519
+ a_remounted_api . route_setting :custom , key : 'value'
520
+ a_remounted_api . route_setting :custom_diff , key : 'bar'
521
+ a_remounted_api . get '/api2' do
522
+ status 200
523
+ end
524
+ end
525
+
526
+ it 'has all the settings for both routes' do
527
+ expect ( a_remounted_api . routes . count ) . to be ( 2 )
528
+ expect ( a_remounted_api . routes [ 0 ] . settings ) . to include (
529
+ {
530
+ description : { description : 'Identical description' } ,
531
+ custom : { key : 'value' } ,
532
+ custom_diff : { key : 'foo' }
533
+ }
534
+ )
535
+ expect ( a_remounted_api . routes [ 1 ] . settings ) . to include (
536
+ {
537
+ description : { description : 'Identical description' } ,
538
+ custom : { key : 'value' } ,
539
+ custom_diff : { key : 'bar' }
540
+ }
541
+ )
542
+ end
543
+
544
+ context 'when mounting it' do
545
+ before do
546
+ root_api . mount a_remounted_api
547
+ end
548
+
549
+ it 'still has all the settings for both routes, even after mount' do
550
+ expect ( root_api . routes . count ) . to be ( 2 )
551
+ expect ( root_api . routes [ 0 ] . settings ) . to include (
552
+ {
553
+ description : { description : 'Identical description' } ,
554
+ custom : { key : 'value' } ,
555
+ custom_diff : { key : 'foo' }
556
+ }
557
+ )
558
+ expect ( root_api . routes [ 1 ] . settings ) . to include (
559
+ {
560
+ description : { description : 'Identical description' } ,
561
+ custom : { key : 'value' } ,
562
+ custom_diff : { key : 'bar' }
563
+ }
564
+ )
565
+ end
566
+ end
567
+ end
508
568
end
509
569
end
0 commit comments