@@ -537,16 +537,38 @@ def subject.enable_root_route!
537
537
expect ( last_response . headers [ 'Content-Type' ] ) . to eql 'text/plain'
538
538
end
539
539
540
- it 'adds an OPTIONS route that returns a 204, an Allow header and a X-Custom-Header' do
541
- subject . before { header 'X-Custom-Header' , 'foo' }
542
- subject . get 'example' do
543
- 'example'
540
+ describe 'adds an OPTIONS route that' do
541
+ before do
542
+ subject . before { header 'X-Custom-Header' , 'foo' }
543
+ subject . get 'example' do
544
+ 'example'
545
+ end
546
+ options '/example'
547
+ end
548
+
549
+ it 'returns a 204' do
550
+ expect ( last_response . status ) . to eql 204
551
+ end
552
+
553
+ it 'has an empty body' do
554
+ expect ( last_response . body ) . to be_blank
555
+ end
556
+
557
+ it 'has an Allow header' do
558
+ expect ( last_response . headers [ 'Allow' ] ) . to eql 'OPTIONS, GET, HEAD'
559
+ end
560
+
561
+ it 'has a X-Custom-Header' do
562
+ expect ( last_response . headers [ 'X-Custom-Header' ] ) . to eql 'foo'
563
+ end
564
+
565
+ it 'has no Content-Type' do
566
+ expect ( last_response . content_type ) . to be_nil
567
+ end
568
+
569
+ it 'has no Content-Length' do
570
+ expect ( last_response . content_length ) . to be_nil
544
571
end
545
- options '/example'
546
- expect ( last_response . status ) . to eql 204
547
- expect ( last_response . body ) . to eql ''
548
- expect ( last_response . headers [ 'Allow' ] ) . to eql 'OPTIONS, GET, HEAD'
549
- expect ( last_response . headers [ 'X-Custom-Header' ] ) . to eql 'foo'
550
572
end
551
573
552
574
it 'allows HEAD on a GET request' do
0 commit comments