class ConditionalGetApiTest

Public Instance Methods

setup() click to toggle source
# File actionpack/test/controller/api/conditional_get_test.rb, line 30
def setup
  @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/api/conditional_get_test.rb, line 46
def test_last_modified_works_with_less_than_too
  @request.if_modified_since = 5.years.ago.httpdate
  get :two
  assert_response :success
end
test_request_gets_last_modified() click to toggle source
# File actionpack/test/controller/api/conditional_get_test.rb, line 34
def test_request_gets_last_modified
  get :two
  assert_equal @last_modified, @response.headers["Last-Modified"]
  assert_response :success
end
test_request_not_modified() click to toggle source
# File actionpack/test/controller/api/conditional_get_test.rb, line 52
def test_request_not_modified
  @request.if_modified_since = @last_modified
  get :one
  assert_equal 304, @response.status.to_i
  assert @response.body.blank?
  assert_equal @last_modified, @response.headers["Last-Modified"]
end
test_request_obeys_last_modified() click to toggle source
# File actionpack/test/controller/api/conditional_get_test.rb, line 40
def test_request_obeys_last_modified
  @request.if_modified_since = @last_modified
  get :two
  assert_response :not_modified
end