[rspec-users] Undefined method 'post'

David Chelimsky dchelimsky at gmail.com
Fri Mar 5 08:48:17 EST 2010


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 suggest

Take 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


More information about the rspec-users mailing list