spec/grape/app/helpers/caching_spec.rb in grape-app-0.8.4 vs spec/grape/app/helpers/caching_spec.rb in grape-app-0.8.5

- old
+ new

@@ -28,10 +28,18 @@ 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 handle fresh_when for records that were never updated' do + get '/articles/never_updated' + expect(last_response.status).to eq(200) + expect(last_response.headers).to include( + 'Last-Modified' => 'Fri, 05 Jan 2018 11:25:00 GMT', + ) + 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', @@ -49,9 +57,10 @@ ) expect(JSON.parse(last_response.body)).to eq( 'id' => 1, 'title' => 'Welcome', 'updated_at' => '2018-01-05 11:25:10 UTC', + 'created_at' => '2018-01-05 11:25:00 UTC', ) get '/articles/1', {}, 'HTTP_IF_NONE_MATCH' => last_response.headers['ETag'] expect(last_response.status).to eq(304) expect(last_response.headers).to include(