Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 737485
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:43:36+00:00 2026-05-14T07:43:36+00:00

Is it possible to cover my controller, that is highly depeinding on Etags with

  • 0

Is it possible to cover my controller, that is highly depeinding on Etags with unit tests?

Here’s what i’m trying to do:
in case if page is not stale (meaning that it’s fresh), i’m adding some header to response.

When i’m trying to test it all (rspec), no matter how many similar requests i have, i still receive 200 OK instead of 304, and my header doesn’t get modified. Furthermore, if i track request.fresh?(response), it’s ALWAYS false.

However, it perfectly works in browser.
I’ve already tried to state ActionController::Base.perform_caching = true, it doesn’t change the overall situation.

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T07:43:37+00:00Added an answer on May 14, 2026 at 7:43 am

    Ok, here’s a point:

    Before hitting the request, read up everything that’s related to ETags in Rails code
    and Don’t forget to set:

    request.env["HTTP_IF_MODIFIED_SINCE"]
    request.env["HTTP_IF_NONE_MATCH"]
    

    Since they’re required for ETag testing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to code-coverage, and I am trying to get my unit tests
I want to ask that, is it possible to make any cover opening effect
I want to create a cover page that has text over a background image.
I'm trying to make sure to cover all my bases with regard to ALAssetsLibrary
Let's say I have a PHP Model-View-Controller framework that maps an address like http://example.com/admin/posts/edit/5
I'm trying to do something that shouldn't be that complicated, but I can't figure
Possible Duplicate: why don't css resets use '*' to cover all elements? Currently I
Is it possible to create a Home Screen widget dynamically (that is without defining
Possible Duplicate: Setting up a cover flow in Android i wish to create a
Possible Duplicate: Does anyone have a good Proper Case algorithm I am currently in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.