[rspec-users] rspec-rails fails to find a controller name

Paul.Kelly at infineon.com Paul.Kelly at infineon.com
Fri Apr 24 13:32:41 EDT 2009

	I have a problem that seems a bit strange. No matter how I specify the controller name in a rails controller rspec I am always presented with

'HostController Retrieving /host via GET should redirect if not logged in' FAILED
Controller specs need to know what controller is being specified. You can
indicate this by passing the controller to describe():

  describe MyController do

or by declaring the controller's name

  describe "a MyController" do
    controller_name :my #invokes the MyController

This is the result of running this command over this file

Command : spec -c -fs spec/controllers/host_controller_spec.rb
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe HostController, "Retrieving /host via GET" do
  controller_name :host
  it "should redirect if not logged in" do
    #session[:user] = nil
    #get :index
    #response.should redirect_to("/user/login")

 In have tried this with and without the text string after the controller name on the describe line. I have also tried it with and without the controller_name directive. It always gives this message. What am I doing wrong?!?!?

Rails version 2.0.2

Rpec version 1.2.4 and 1.2.0
Rpsec-rails version 1.2.4 and 1.2.0

Thanks a lot if you can help in any way.

	Paul.kelly at infineon.com

More information about the rspec-users mailing list