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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:52:35+00:00 2026-05-25T01:52:35+00:00

RSpec2 does not include an have_tag test helper. Using webrat’s have_tag or have_selector matchers

  • 0

RSpec2 does not include an have_tag test helper. Using webrat’s have_tag or have_selector matchers instead is not possible because Webrat and Rails 3 are not compatible yet. Is there a way to write useful RSpec view tests? It is possible to use assert_select instead of have_tag, but then one could Test::Unit tests in the first place. Or is it no longer recommendable to write RSpec view tests, because integration tests with Capybara or Cucumber are better?

  • 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-25T01:52:36+00:00Added an answer on May 25, 2026 at 1:52 am

    Webrat caused too much trouble, it is also possible to use Capybara with RSpec. The Capybara DSL (with the functions has_selector?, has_content?, etc.) is available for the following RSpec tests: spec/requests, spec/acceptance, or spec/integration.

    If you use the latest version of Capybara (~> 1.0.1) – older versions like 0.4.0 won’t support this – and add the following lines to your spec_helper.rb file

    require "capybara/rspec"
    require "capybara/rails"
    

    then you could write for example the following RSpec request test

    require 'spec_helper'
    
    describe "Posts" do
      describe "GET /blog" do
        it "should get blog posts" do
          get blog_path
          response.status.should be(200)
          response.body.should have_selector "div#blog_header"
          response.body.should have_selector "div#blog_posts"
        end
      end
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I try and define (but not implement an it test) (pending method) using
I've written an rspec test using Watir against a web application and it's running
Ruby 1.9.2 Rails 3.1 Here is the problem bundle exec rspec spec/ does not
I am working on a basic Rspec test using Capybara that opens a webpage
I use Rails 3 and RSpec 2.6.0. Not sure if that's possible, but here
How would I write a test in rspec to ensure passwords are not stored
I have problems to get rspec running properly to test validates_inclusion_of my migration looks
I'm not new to Rails or Rspec, but I'm new to making gems. When
I'm writing some automated tests using Capybara/RSpec, I choose/configure the driver by using this
I am really missing heavily the ability to test Views independently of controllers. The

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.