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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:46:15+00:00 2026-05-24T06:46:15+00:00

My project is using Rails 3 and RSpec and Capybara for testing. I want

  • 0

My project is using Rails 3 and RSpec and Capybara for testing.

I want to support visitors without javascript, so I’ve added a ‘delete’ member to my resource routes. My non-js links look like /posts/3/delete. These then present a form to the user which then does a post request to the destroy action. I’m using extra javascript to strip off the /delete so that the links still work correctly for those who have it turned on.

The problem I’ve run in to, is that Capybara wants to follow the /posts/3/delete links using an HTTP DELETE request, but it doesn’t support the javascript which strips off the /delete. Is there a way I can tell Capybara to just follow all links with HTTP GET?

  • 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-24T06:46:16+00:00Added an answer on May 24, 2026 at 6:46 am

    While it is not an option you can simply turn on or off yet, this patch is how I ended up solving this for now.

    class Capybara::RackTest::Driver < Capybara::Driver::Base
      class Capybara::RackTest::Node < Capybara::Driver::Node
        def click
          if tag_name == 'a'
            driver.follow(:get, self[:href].to_s)
          elsif (tag_name == 'input' and %w(submit image).include?(type)) or
            ((tag_name == 'button') and type.nil? or type == "submit")
            Capybara::RackTest::Form.new(driver, form).submit(self)
          end
        end
      end
    end
    

    Edit: It appears that this will be changed to work this way in version 2. https://github.com/jnicklas/capybara/issues/184#issuecomment-1940520

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

Sidebar

Related Questions

We're working on a Rails 3 project and testing using Capybara/RSpec. The problem is
We are using RSpec in a rails project for unit testing. I would like
Configuration: Integration tests for Rails project using RSpec, Capybara, Selemium driver, SQLite database. Situation:
How can I start using Rspec with an existing Ruby on Rails 2.3.5 project
I'm using Cucumber with RSpec in a Rails project. When I use the rake
I have a normal Rails project (without Active Record) using CouchDB (couchrest_model) as a
I'm working on a rails project using, cucumber, capybara and factory girl, and recently
I'm writing a spec for a controller in Rails 3 project using RSpec and
In the rails project I'm working on I inserted support for rspec, cucumber and
I've started a project on rails, and so far I'm testing it using rails'

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.