From 1e041495715aa7ad760f6fbb483c0584d14cc413 Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 25 Sep 2024 19:28:35 +0200 Subject: [PATCH] Use match operator instead of multiple examples --- spec/grape/dsl/inside_route_spec.rb | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/spec/grape/dsl/inside_route_spec.rb b/spec/grape/dsl/inside_route_spec.rb index 435dcbe4b..3e09e23d7 100644 --- a/spec/grape/dsl/inside_route_spec.rb +++ b/spec/grape/dsl/inside_route_spec.rb @@ -219,19 +219,14 @@ def initialize expect(subject.sendfile).to eq file_response end - it 'does not change the Cache-Control header' do - expect(subject.header[Rack::CACHE_CONTROL]).to eq 'cache' + it 'set the correct headers' do + expect(subject.header).to match( + Rack::CACHE_CONTROL => 'cache', + Rack::CONTENT_LENGTH => 123, + Grape::Http::Headers::TRANSFER_ENCODING => 'base64' + ) end - it 'does not change the Content-Length header' do - expect(subject.header[Rack::CONTENT_LENGTH]).to eq 123 - end - - it 'does not change the Transfer-Encoding header' do - subject.sendfile file_path - - expect(subject.header[Grape::Http::Headers::TRANSFER_ENCODING]).to eq 'base64' - end end context 'as object' do @@ -308,7 +303,7 @@ def initialize it 'returns default' do expect(subject.stream).to be_nil - expect(subject.header[Rack::CACHE_CONTROL]).to be_nil + expect(subject.header).to be_empty end end