spec/grape/app/helpers/caching_spec.rb in grape-app-0.8.2 vs spec/grape/app/helpers/caching_spec.rb in grape-app-0.8.3
- old
+ new
@@ -7,11 +7,10 @@
it 'should handle fresh-when' do
get '/articles'
expect(last_response.status).to eq(200)
expect(last_response.headers).to include(
- 'Cache-Control' => 'public',
'Content-Type' => 'application/json',
'ETag' => '975ca8804565c1a569450d61090b2743',
'Last-Modified' => 'Fri, 05 Jan 2018 11:25:20 GMT',
)
expect(JSON.parse(last_response.body).size).to eq(2)
@@ -27,9 +26,17 @@
expect(last_response.status).to eq(200)
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:19 GMT', 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag']
expect(last_response.status).to eq(200)
get '/articles', {}, 'HTTP_IF_MODIFIED_SINCE' => 'Fri, 05 Jan 2018 11:25:20 GMT', 'HTTP_IF_NONE_MATCH' => 'other'
expect(last_response.status).to eq(200)
+ end
+
+ it 'should support cache-control' do
+ get '/articles?public=true'
+ expect(last_response.status).to eq(200)
+ expect(last_response.headers).to include(
+ 'Cache-Control' => 'public',
+ )
end
it 'should handle stale? (with cache-control)' do
get '/articles/1'
expect(last_response.status).to eq(200)