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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:16:01+00:00 2026-05-30T08:16:01+00:00

I have defined: a view at views/pages/about.html.rb , a test in spec/controllers/pages_controller_spec.rb : describe

  • 0

I have defined:

  • a view at views/pages/about.html.rb,
  • a test in spec/controllers/pages_controller_spec.rb:

    describe "GET 'about'" do
      it "should be successful" do
        get 'about'
        response.should be_success
      end
    end
    

I have not defined:

  • a corresponding action:

    class PagesController < ApplicationController
    
      # def about
      # end
    
    end
    
  • a route in routes.rb:

    Lily::Application.routes.draw do
      # get "pages/about"
    

I get an error in web browser but RSpec tests pass successfully as long as view is defined.
Is this expected behavior?


I’m using rspec-rails 2.0.1, webrat 0.7.1 and rails 3.2.1.
Scott found a similar issue closed by rspec-rails maintainers.

  • 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-30T08:16:02+00:00Added an answer on May 30, 2026 at 8:16 am

    This is the expected (perhaps somewhat surprising) behavior.

    If you keep in mind how Rails separates concerns, it makes sense.
    Controllers don’t route—that happens in the dispatcher.

    Try adding this in your test:

    raise controller.params.inspect

    Failures:
      1) PagesController GET pages/about
         Failure/Error: raise controller.params.inspect
         {"action"=>"about", "controller"=>"pages"}
    

    get 'about' does not need to routed—the Rails testing framework takes care of that. Since the spec already knows what action it is supposed to handle, it goes ahead and calls PagesController#about.

    The missing piece of the puzzle is that Rails doesn’t need an action to be defined as long as the template exists; it will simply render about.html.erb.

    So this test succeeds, as it should. When you call it live, it fails because there is no route. If you had written a request spec, routing spec, or a Cucumber test, it would also fail.

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

Sidebar

Related Questions

I have defined my binding thus: <TreeView ItemsSource={Binding UsersView.View} ItemTemplate={StaticResource MyDataTemplate} /> The CollectionViewSource
I have a tree view defined as follows: <HierarchicalDataTemplate x:Key=ChildTemplate ItemsSource={Binding Children}> <TextBlock Text={Binding
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I have a class Wizard which creates a wizard with pages defined in the
I have defined a custom Sharepoint list for special attributes related to a software
I have defined an interface in C++, i.e. a class containing only pure virtual
I have defined a personalizable property on a web part and I would like
I have defined a new dialog and its controls in an already existing resource
I have defined the global nls_date_format on Oracle 10.2 XE as follows: alter system
I have defined a custom list template type for SharePoint . I install it

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.