Paul.Kelly at infineon.com
2009-Apr-24 17:32 UTC
[rspec-users] rspec-rails fails to find a controller name
Hi,
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
end
This is the result of running this command over this file
Command : spec -c -fs spec/controllers/host_controller_spec.rb
File:
require File.expand_path(File.dirname(__FILE__) +
''/../spec_helper'')
describe HostController, "Retrieving /host via GET" do
integrate_views
controller_name :host
it "should redirect if not logged in" do
#session[:user] = nil
#get :index
#response.should redirect_to("/user/login")
end
end
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
Jonathan Linowes
2009-Apr-25 04:46 UTC
[rspec-users] rspec-rails fails to find a controller name
I assume you tried it with the 3 lines (including get :index) uncommented On Apr 24, 2009, at 1:32 PM, <Paul.Kelly at infineon.com> <Paul.Kelly at infineon.com> wrote:> Hi, > 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 > end > > This is the result of running this command over this file > > Command : spec -c -fs spec/controllers/host_controller_spec.rb > File: > require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') > > describe HostController, "Retrieving /host via GET" do > integrate_views > controller_name :host > it "should redirect if not logged in" do > #session[:user] = nil > #get :index > #response.should redirect_to("/user/login") > end > end > > 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 > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2009-Apr-25 13:25 UTC
[rspec-users] rspec-rails fails to find a controller name
On Fri, Apr 24, 2009 at 12:32 PM, <Paul.Kelly at infineon.com> wrote:> Hi, > ? ? ? ?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 > end > > This is the result of running this command over this file > > Command : spec -c -fs spec/controllers/host_controller_spec.rb > File: > require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') > > describe HostController, "Retrieving /host via GET" do > ?integrate_views > ?controller_name :host > ?it "should redirect if not logged in" do > ? ?#session[:user] = nil > ? ?#get :index > ? ?#response.should redirect_to("/user/login") > ?end > end > > ?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.2The oldest rails supported by rspec-1.2.x is rails-2.0.5. Your options are to either upgrade your rails app to 2.0.5, which is what I''d recommend (path of least resistance since you''re not crossing a minor version boundary) or to downgrade rspec to pre 1.2. Good luck. Cheers, David> > 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 > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2009-Apr-25 13:28 UTC
[rspec-users] rspec-rails fails to find a controller name
On Sat, Apr 25, 2009 at 8:25 AM, David Chelimsky <dchelimsky at gmail.com> wrote:> On Fri, Apr 24, 2009 at 12:32 PM, ?<Paul.Kelly at infineon.com> wrote: >> Hi, >> ? ? ? ?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 >> end >> >> This is the result of running this command over this file >> >> Command : spec -c -fs spec/controllers/host_controller_spec.rb >> File: >> require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') >> >> describe HostController, "Retrieving /host via GET" do >> ?integrate_views >> ?controller_name :host >> ?it "should redirect if not logged in" do >> ? ?#session[:user] = nil >> ? ?#get :index >> ? ?#response.should redirect_to("/user/login") >> ?end >> end >> >> ?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 > > The oldest rails supported by rspec-1.2.x is rails-2.0.5. Your options > are to either upgrade your rails app to 2.0.5, which is what I''d > recommend (path of least resistance since you''re not crossing a minor > version boundary) or to downgrade rspec to pre 1.2.BTW, I was able to reproduce the behaviour you describe with rspec-1.2.4 and rails-2.0.2, so there is an incompatibility there (i.e. it''s not something else that you''re missing or is specific to your particular app or environment)> > Good luck. > > Cheers, > David > >> >> 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 >> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> >