class LastModifiedRenderTest

Public Instance Methods

setup() click to toggle source
Calls superclass method
# File actionpack/test/controller/render_test.rb, line 383
def setup
  super
  @last_modified = Time.now.utc.beginning_of_day.httpdate
end
test_last_modified_works_with_less_than_too() click to toggle source
# File actionpack/test/controller/render_test.rb, line 485
def test_last_modified_works_with_less_than_too
  @request.if_modified_since = 5.years.ago.httpdate
  get :conditional_hello_with_bangs
  assert_response :success
end
test_request_modified() click to toggle source
# File actionpack/test/controller/render_test.rb, line 408
def test_request_modified
  @request.if_modified_since = "Thu, 16 Jul 2008 00:00:00 GMT"
  get :conditional_hello
  assert_equal 200, @response.status.to_i
  assert @response.body.present?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_modified_with_collection_of_records() click to toggle source
# File actionpack/test/controller/render_test.rb, line 465
def test_request_modified_with_collection_of_records
  @request.if_modified_since = "Thu, 16 Jul 2008 00:00:00 GMT"
  get :conditional_hello_with_collection_of_records
  assert_equal 200, @response.status.to_i
  assert @response.body.present?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_modified_with_record() click to toggle source
# File actionpack/test/controller/render_test.rb, line 437
def test_request_modified_with_record
  @request.if_modified_since = "Thu, 16 Jul 2008 00:00:00 GMT"
  get :conditional_hello_with_record
  assert_equal 200, @response.status.to_i
  assert @response.body.present?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_not_modified() click to toggle source
# File actionpack/test/controller/render_test.rb, line 393
def test_request_not_modified
  @request.if_modified_since = @last_modified
  get :conditional_hello
  assert_equal 304, @response.status.to_i
  assert @response.body.blank?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_not_modified_but_etag_differs() click to toggle source
# File actionpack/test/controller/render_test.rb, line 401
def test_request_not_modified_but_etag_differs
  @request.if_modified_since = @last_modified
  @request.if_none_match = '"234"'
  get :conditional_hello
  assert_response :success
end
test_request_not_modified_but_etag_differs_with_collection_of_records() click to toggle source
# File actionpack/test/controller/render_test.rb, line 458
def test_request_not_modified_but_etag_differs_with_collection_of_records
  @request.if_modified_since = @last_modified
  @request.if_none_match = '"234"'
  get :conditional_hello_with_collection_of_records
  assert_response :success
end
test_request_not_modified_but_etag_differs_with_record() click to toggle source
# File actionpack/test/controller/render_test.rb, line 430
def test_request_not_modified_but_etag_differs_with_record
  @request.if_modified_since = @last_modified
  @request.if_none_match = '"234"'
  get :conditional_hello_with_record
  assert_response :success
end
test_request_not_modified_with_collection_of_records() click to toggle source
# File actionpack/test/controller/render_test.rb, line 450
def test_request_not_modified_with_collection_of_records
  @request.if_modified_since = @last_modified
  get :conditional_hello_with_collection_of_records
  assert_equal 304, @response.status.to_i
  assert @response.body.blank?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_not_modified_with_record() click to toggle source
# File actionpack/test/controller/render_test.rb, line 421
def test_request_not_modified_with_record
  @request.if_modified_since = @last_modified
  get :conditional_hello_with_record
  assert_equal 304, @response.status.to_i
  assert @response.body.blank?
  assert_not_nil @response.etag
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_with_bang_gets_last_modified() click to toggle source
# File actionpack/test/controller/render_test.rb, line 473
def test_request_with_bang_gets_last_modified
  get :conditional_hello_with_bangs
  assert_equal @last_modified, @response.headers["Last-Modified"]
  assert_response :success
end
test_request_with_bang_obeys_last_modified() click to toggle source
# File actionpack/test/controller/render_test.rb, line 479
def test_request_with_bang_obeys_last_modified
  @request.if_modified_since = @last_modified
  get :conditional_hello_with_bangs
  assert_response :not_modified
end
test_responds_with_last_modified() click to toggle source
# File actionpack/test/controller/render_test.rb, line 388
def test_responds_with_last_modified
  get :conditional_hello
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_responds_with_last_modified_with_collection_of_records() click to toggle source
# File actionpack/test/controller/render_test.rb, line 445
def test_responds_with_last_modified_with_collection_of_records
  get :conditional_hello_with_collection_of_records
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_responds_with_last_modified_with_record() click to toggle source
# File actionpack/test/controller/render_test.rb, line 416
def test_responds_with_last_modified_with_record
  get :conditional_hello_with_record
  assert_equal @last_modified, @response.headers["Last-Modified"]
end