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 5989181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:03:54+00:00 2026-05-22T23:03:54+00:00

I am creating a web application with Ruby on Rails 3.1 (RC1). I am

  • 0

I am creating a web application with Ruby on Rails 3.1 (RC1). I am using Factory Girl, RSpec and Cucumber (with Capybara) for testing, but I am experiencing unexpected raised ActionDispatch::ClosedErrors some of the times (not every time) when I am creating new users (through the User model’s create action). Below is the error message that I get:

Cannot modify cookies because it was closed. This means it was already streamed
back to the client or converted to HTTP headers. (ActionDispatch::ClosedError)

The error is raised when using these ways of creating users:

  • Creation using Factory Girl
    • Factory.create( :user )
    • Factory.build( :user ).save
  • Basic creation
    • User.create( { ... } )
    • User.new( { ... } ).save

What is funny is that they do work during some test, but not in others, and it does not seem random, although I cannot figure out the reason. Below is an excerpt from my code:

users_controller_spec.rb

require ‘spec_helper’

def user
  @user ||= Factory.create( :user )
end

def valid_attributes
  Factory.attributes_for :user
end

describe UsersController do

  describe 'GET index' do
    it 'assigns all users as @users' do
      users = [ user ] # The call to user() raises the error here
      get :index
      assigns[ :users ].should == users
    end
  end

  describe 'GET show' do
    it 'assigns the requested user as @user' do
      get :show, id: user.id # The call to user() raises the error here
      assigns[ :user ].should == user
    end
  end

However, the error is not raised in the following code block:

describe ‘GET edit’ do
it ‘assigns the requested user as @user’ do
get :edit, id: user.id # This raises no error
assigns[ :user ].should == user
end
end

Any other method below this does not raise the error, even though I am creating users in the exact same way.

Any suggestions to what I might be doing wrong would be greatly appreciated!

  • 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-22T23:03:55+00:00Added an answer on May 22, 2026 at 11:03 pm

    This is due to the way rails 3 streams the response now. They posted a fix in edge for the same issue in flash but not in cookies yet. For now I have turned off my request specs. I am going to look at the problem this weekend if no one gets to it before then.

    https://github.com/rails/rails/issues/1452

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

Sidebar

Related Questions

I am creating a web application using zend, here I create an interface from
I'm creating a web application and will be doing my own testing anyway to
I started creating a web service in Ruby on Rails. After some time I
I have a twitter like web application written in Ruby on Rails that allows
I am creating a web application using zkoss 5.0.4, Spring 3.0.3, Hibernate 3, and
I'm creating a web application which loads tabs using AJAX. My problem is that
I'm creating a web application using cakephp 1.2.6. There is a functionality that I
I am creating a Web application using ASP.NET MVC, and I'm trying to use
I am creating a web application on tomcat in framework struts2. I am using
I am working on a Ruby on Rails 3 web application and am not

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.