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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:25:08+00:00 2026-06-15T02:25:08+00:00

Am a beginner, learning Ruby on Rails and I have an issue getting my

  • 0

Am a beginner, learning Ruby on Rails and I have an issue getting my test to work. Am using rspec and capybara. The problem is Capybara is not rendering the page or its not getting to the right page. The page opens properly in the browser when I execute: $rails s.
But when I test with save_and_open_page, the html is empty.

My Specs

The following is my first PagesController spec:

 require 'spec_helper'

describe PagesController do
describe "GET 'home'" do
    it "returns http success" do
      visit pages_home_path
      save_and_open_page #at this point it opens the a blank html page
    end
  end
end

My controller spec, this opens a blank page.

I tried an alternative syntax for the Pagescontroller spec:

require 'spec_helper'

describe PagesController do

  describe "GET 'home'" do
    it "returns http success" do
       get :home           
       response.should render_template('home')
       response.should have_content("home") #it fails here
     end
  end
end

This shows the following error in the console
Failures:

1) PagesController GET ‘home’ returns http success
Failure/Error: response.should have_content(“home”)
expected there to be text “home” in “#”
# ./spec/controllers/pages_controller_spec.rb:10:in `block (3 levels) in ‘

Finished in 1.91 seconds
1 example, 1 failure

Other Configurations:

In the spec_helper I have added the following line, the rest is untouched.

require 'capybara/rspec'

*Gem file: *

    gem 'rails', '3.1.0'
    group :development, :test do
              gem 'autotest-rails'
      gem 'sqlite3'
      gem 'ruby-debug19', :require => 'ruby-debug'
      gem 'cucumber-rails', :require => false
      gem 'cucumber-rails-training-wheels'
      gem 'database_cleaner'
      gem 'capybara'
      gem 'launchy'
      gem 'rspec-rails'
      gem 'simplecov'
      gem 'rspec-core', '2.8.0'
    end
    group :assets do
      gem 'therubyracer'              
      gem 'sass-rails', "  ~> 3.1.0"
      gem 'coffee-rails', "~> 3.1.0"
      gem 'uglifier'
    end

    gem 'jquery-rails'
    gem 'haml'

I have not installed Webrat and verified its not in my Gem list.
Thank you for your help.

  • 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-15T02:25:09+00:00Added an answer on June 15, 2026 at 2:25 am

    From the documentation it seems that you should tag your specs as feature or put them into the spec/features folder.

    For me it seems like you have the default behavior for controller test, which is to not render anything. You could override this, but I think it’ll be better to have your integration tests separate from the controller tests.

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

Sidebar

Related Questions

I am a beginner in learning Ruby and Rails. I was going through the
A few years back, I started learning Ruby/Rails from some beginner's guide for Rails.
I'm just learning Ruby and have and have an extremely beginner question. Is the
This is a beginner's rails learning confusion. When I learn rails, from time to
I have only started learning python recently. I would still be considered a beginner.
Beginner iOS dev here. I have a problem in my array. Im making an
I am beginner to freeswitch.While learning this I have seen the terms 'leg A'
I'm a beginner programmer, and I'm learning to program a web app using WampServer.
I have a question regarding this code. I'm a beginner and enjoy learning C#.
I'm a beginner in learning Python. The version of python I'm using is 3.2.1.1

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.