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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:35:54+00:00 2026-06-18T09:35:54+00:00

RSpec is saying everything is fine and dandy with my Help page, but it

  • 0

RSpec is saying everything is fine and dandy with my Help page, but it shouldn’t be. What would cause the false positive. (I have restarted my test suite several times).

Here’s my spec page:

require 'spec_helper'

describe "Static pages" do

  subject { page }

  shared_examples_for "all static pages" do
    it { should have_selector 'h1',    text: heading }
    it { should have_selector 'title', text: full_title(page_title) }
  end

.
.
.

  describe "Help page" do
    before { visit help_path }

    let(:heading) { 'Help' }
    let(:page_title) { 'Help' }
  end

.
.
.

end

Here’s my Help page:

<% provide(:title, '') %>
<h1></h1>
<p>
  Get help on the Ruby on Rails Tutorial at the
  <a href="http://railstutorial.org/help">Rails Tutorial help page</a>.
  To get help on this sample app, see the
  <a href="http://railstutorial.org/book">Rails Tutorial book</a>.
</p>

It’s saying the tests pass. How to fix?

  • 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-18T09:35:55+00:00Added an answer on June 18, 2026 at 9:35 am

    Looks like you’re missing:

    it_should_behave_like 'all static pages'
    

    in the describe 'Help Page' block. You’ve defined the shared examples for ‘all static pages’ but are not telling rspec that the ‘Help Page’ should behave like one.

    Also, please look this answer to a very similar question. It shows how you might refactor your specs to express intent more clearly.

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

Sidebar

Related Questions

Im trying to implement rspec for a http call... But I have not succeeded
Rspec has been running fine for a while but then I suddenly encounter this
I have a RSpec test that keeps failing. subject { page } visit user_path(user)
I have some RSpec tests for my models and I would like to turn
The rspec test fails when trying to click_button Create my account saying The action
What does rspec gem do? It is named Behaviour driven development tool, but these
In some Rspec model specs, we have several tests like this: it { should
I have the following rspec: require 'spec_helper' describe KnowledgesController do before (:each) do @knowledge
I have the following RSpec example which is passing: describe UsersController do it should
I am new to rspec and wanted to ask how one would go about

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.