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

  • Home
  • SEARCH
  • 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 8742359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:29:12+00:00 2026-06-13T11:29:12+00:00

When I login to my app the server sends me back cookies(credentials and some

  • 0

When I login to my app the server sends me back cookies(credentials and some app’s cookie):

Response sent 170 bytes of Cookie data:
 Set-Cookie: user_credentials=val; path=/; HttpOnly; Secure

Response sent 554 bytes of Cookie data:
 Set-Cookie: _app_session=otherVal; path=/; HttpOnly; Secure

…and then redirects to the home page;

Cookies include some flags: e.g. httpOnly, Secure, etc.

How can I test whether cookies do include those flags with Rspec?

At least where can I find those cookies?

it "should generate cookies with proper flags" do    
    params = Factory.attributes_for(:user,
      :username => "uname",
      :password => "upass"
    )
    # login
    post 'create', params

    response.should redirect_to home_url # => pass

    puts "response cookie = #{response.cookies.inspect}" # => {} // no cookies in response, why?
end
  • 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-06-13T11:29:13+00:00Added an answer on June 13, 2026 at 11:29 am

    Controller specs do not generate/invoke real http requests, they just set up the controller under test and invoke the requested action on it. No http request is made and no real http answer is generated. So you can only test the inner workings of a Rails controller on a more abstract level.

    The cookie handling in these specs is rather simple, setting cookies in an action like this:

    def set_cookies
      cookies[:foo]   = 'bar'
      cookies[:lorem] = {:value => 'ipsum', :expires => 3.days.from_now}
    
      render :nothing => true
    end
    

    results in the following values accessible in the spec:

    it "should set some cookie values" do
      get :set_cookies
    
      # response.cookies looks like this:
      # {'foo' => 'bar', 'lorem' => 'ipsum'}     
    
      response.cookies['foo'].should == 'bar'
      response.cookies['lorem'].should == 'ipsum'
    end
    

    To test the kind of cookie flags that you see in your responses, you would have to use something that does real http requests. Maybe you can use the capybara gem for it?

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

Sidebar

Related Questions

I have to send some login credentials to our server, which will validate them
I have an ASP.NET Login App that creates a cookie called 'ASP_LOGIN77' and gives
I have created an app which starts with a login page, after entering some
Im writing a client/server app for android that sends a username and password to
I have a web-app-database 3 tier server setup. Web requests data from app, and
I am working on an Android login app for a service called Netclassroom. There
Bit of a backstory to this one... I have an ASP.NET Login App on
I'm trying to send a getJson call from my app (login form) to get
I press login button to login into my app and I'm using asyncTask for
Am using django social-auth authentication for my app.After login to facebook or twitter from

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.