Sha256: e940160337a5b8fb87f5170d630c312cb2e670717db34db4d0330a18c2158d90
Contents?: true
Size: 1.27 KB
Versions: 5
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' describe CacheableClientsController do before(:each) do request.accept = "application/json" end context "requesting a single resource" do it "should return 304 Not Modified if client's cache is still valid" do request.env["HTTP_IF_MODIFIED_SINCE"] = Time.utc(2010).httpdate get :single response.status.to_i.should == 304 end it "refreshes Last-Modified if cache is expired" do request.env["HTTP_IF_MODIFIED_SINCE"] = Time.utc(1999) get :single response.last_modified.should == Time.utc(2010) response.status.to_i.should == 200 end it "does not set cache if Last-Modified is already in response" do get :single, :last_modified => true response.last_modified.should == Time.utc(2010, 2) end end context "collection" do it "sets Last-Modified using the most recent updated_at" do get :collection response.last_modified.should == Time.utc(2010) response.status.to_i.should == 200 end it "works with empty array" do get :empty response.last_modified.should be_nil response.status.to_i.should == 200 end end end
Version data entries
5 entries across 5 versions & 2 rubygems