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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T16:07:58+00:00 2026-06-15T16:07:58+00:00

I just updated a rails app bundle from capybara 2.0.0.beta2 to the current 2.0.1

  • 0

I just updated a rails app bundle from capybara 2.0.0.beta2 to the current 2.0.1 version. (Just happened to be on the beta still.) I also updated Rspec from 2.11.0 to 2.12.0 to be compatible with some changes to how url helpers are included.

Before this update I had a few tests verifying things like non-admin users not being able to create new users and similar permission/form hacking basics. I also have specs to verify that mass assignment attacks are covered. It was fairy easy and worked well but is now broken for me.

context "non-admin users can" do
  before(:each) do
    login_as_user
  end
  it "Not create new users" do
    page.driver.post users_path, { :params => {
      user_name: "user1",
      user_email: "name@example.com",
      user_password: "124mgldkg3",
      user_role: "user"
    } }
    page.status_code.should be 302
  end
end

It statements that only try to go (visit) somewhere unauthorised work just fine but I can not longer do a manipulated post of a form that this kind of user should not be allowed to post. I now get a 404 for any and all of these requests.

I am not at all sure what has changed in Capybara and/or Rspec. It could certainly be some small details that causes my request to “fall out of context”. What it looks like is that the request is performed without the same session and request context as visit’s and form posts.

I’d like to:

  • post using custom parameters and not a form visible to the user.
  • still be in the existing session and request context (sub-domain…)

I haven’t found a replacement technique. I started down the Rack::Test path but then I am definitely back at square 1 with out a login or a session…. which to be indicated that there probably is some way to check these common hacking attempts without manually setting up all the session context stuff capybara handles for me.

  • 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-15T16:07:59+00:00Added an answer on June 15, 2026 at 4:07 pm

    After digging in Capybaras internals I found that the current working way to perform a custom post request is to do the following:

    context "User class users can" do
      before(:each) do
        login_as_user
      end
      it "Not create new users" do
        page.driver.browser.reset_host! # just to be safe
        page.driver.browser.process(:post, users_path, { params: {
          user_name: "user1",
          user_email: "name@example.com",
          user_password: "124mgldkg3",
          user_role: "user"
        }})
        page.status_code.should be 302
      end
    end
    

    This is equivalent in behaviour to my original code (above in the question).

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

Sidebar

Related Questions

I have just updated my app from Rails 2.3.5 to Rails 3. One of
I've just recently updated my rails app's gems with gem update and bundle update
I just updated an app from .NET 2.0 to .NET 4.0 and I have
I've just updated rails to v2.3.6 on my app under a bamboo-ree-1.8.7 stack and
I just updated active scaffold on my rails app, and now all the links
My Rails app needs to retrieve an updated count from the server every minute.
I just updated my OS from Snow Leopard to LION 10.7.3, and I usually
I just updated to Rails 3.2 and I started to get errors like this:
I have recently been advised that for my current rails app relationships I should
My Rails app is starting to need complicated queries. Should I just start using

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.