Hello all, I am facing a strange problem. I have generated rspec for a particular project.Similarly created a spec controller.Under that controller i have written post :create action When i run my spec i get an error as "undefined method `post'' for #<Spec::Rails::Example::RailsExampleGroup::Subclass_1::Subclass_1:0xb693fb3c>" Strangely my models are working fine.My rails version is 2.3.5 and rspec version is 1.1.12 I tried in some other project,in that i am getting error as "Undefined method controller for nil class" Earlier it was working fine,but dont know what is the problem. Please suggest. -- Posted via http://www.ruby-forum.com/.
Amit Kulkarni wrote:> Hello all, > I am facing a strange problem. > I have generated rspec for a particular project.Similarly created a spec > controller.Under that controller i have written post :create action > When i run my spec i get an error as > "undefined method `post'' for > #<Spec::Rails::Example::RailsExampleGroup::Subclass_1::Subclass_1:0xb693fb3c>" > > Strangely my models are working fine.My rails version is 2.3.5 and rspec > version is 1.1.12 > I tried in some other project,in that i am getting error as "Undefined > method controller for nil class" > Earlier it was working fine,but dont know what is the problem. > Please suggest.I created a fresh application and tried to write simple user signup controller. But when i tried to run then it is showing the same error as undefined method "post" Please suggest -- Posted via http://www.ruby-forum.com/.
On Fri, Mar 5, 2010 at 7:03 AM, Amit Kulkarni <lists at ruby-forum.com> wrote:> Amit Kulkarni wrote: >> Hello all, >> I am facing a strange problem. >> I have generated rspec for a particular project.Similarly created a spec >> controller.Under that controller i have written post :create action >> When i run my spec i get an error as >> "undefined method `post'' for >> #<Spec::Rails::Example::RailsExampleGroup::Subclass_1::Subclass_1:0xb693fb3c>" >> >> Strangely my models are working fine.My rails version is 2.3.5 and rspec >> version is 1.1.12 >> I tried in some other project,in that i am getting error as "Undefined >> method controller for nil class" >> Earlier it was working fine,but dont know what is the problem. >> Please suggest. > I created a fresh application and tried to write simple user signup > controller. > But when i tried to run then it is showing the same error as undefined > method "post" > Please suggestTake a look at these two pages: http://rubygems.org/gems/rspec-rails/versions http://rubygems.org/gems/rails/versions rspec-rails-1.1.12 was released in January of 2009 rails-2.3.5 was released in November of 2009 You''ve got to use a version of rspec-rails that was released _after_ the version of rails you''re working with. Cheers, David
As per the list there are 3 versions of rspec released in Jan 2010 i.e. 1.3.0,1.3.1 and 1.3.2 Also there are various versions starting from 2. So from all above version which one is a stable one so that i can install it. -- Posted via http://www.ruby-forum.com/.
On Mon, Mar 8, 2010 at 1:13 AM, Amit Kulkarni <lists at ruby-forum.com> wrote:> As per the list there are 3 versions of rspec released in Jan 2010 i.e. > 1.3.0,1.3.1 and 1.3.2 > Also there are various versions starting from 2. > So from all above version which one is a stable one so that i can > install it.Why would you want anything but the latest? I''d go with that: 1.3.2. Cheers, David
David Chelimsky wrote:> On Mon, Mar 8, 2010 at 1:13 AM, Amit Kulkarni <lists at ruby-forum.com> > wrote: >> As per the list there are 3 versions of rspec released in Jan 2010 i.e. >> 1.3.0,1.3.1 and 1.3.2 >> Also there are various versions starting from 2. >> So from all above version which one is a stable one so that i can >> install it. > > Why would you want anything but the latest? I''d go with that: 1.3.2. > > Cheers, > DavidHi David, I updated the rspec-rails with 1.3.2 and it update rspec with 1.3.0 Also i read the doc which stated that spec server is no longer used.Instead they are using spork. -- Posted via http://www.ruby-forum.com/.
Amit Kulkarni wrote:> David Chelimsky wrote: >> On Mon, Mar 8, 2010 at 1:13 AM, Amit Kulkarni <lists at ruby-forum.com> >> wrote: >>> As per the list there are 3 versions of rspec released in Jan 2010 i.e. >>> 1.3.0,1.3.1 and 1.3.2 >>> Also there are various versions starting from 2. >>> So from all above version which one is a stable one so that i can >>> install it. >> >> Why would you want anything but the latest? I''d go with that: 1.3.2. >> >> Cheers, >> David > > Hi David, > I updated the rspec-rails with 1.3.2 and it update rspec with 1.3.0 > Also i read the doc which stated that spec server is no longer > used.Instead they are using spork.Since when i try to run with spec command it gives me above error Now when i run with "spec --drb" then that spec is properly executed. Also i want to know that when i run "spork" command from the project root then it says "Spork is ready and listening on 8989!" but when i try to run this port in browser then nothing is displayed. Can you please tell me the difference between running spork command and running spec locally using spec -drb -- Posted via http://www.ruby-forum.com/.
Hello, I am having some problem with the controllers after i updated my specs. Following are the details: I am trying to call create action as post :create :user => {:name => "abc", :login => "abcd", :phone => 11111} After this i am searching this for confirmation i.e. user = User.find_by_name("abc") user.name.should == "abc" Now when i run this i am getting an error as You have a nil object when you didn''t expect it!The error occurred while evaluating nil.title Similarly for update.I am getting that particular user from the fixtures and just updating the name and searching as above.But i am getting same error I am using fixtures as fixtures :users So my guess is whatever params i am passing it may be getting updated but again fixtures are getting uploaded. Please suggest -- Posted via http://www.ruby-forum.com/.