[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
Pixel
thecatwasnot at gmail.com
Thu Mar 10 09:36:26 EST 2011
On Thu, Mar 10, 2011 at 7:49 AM, Mohnish J. <lists at ruby-forum.com> wrote:
> I am unable to use the old rspec generator ( rspec_scaffold ) with rspec
> 2.5 and rspec-rails 2.5 gem. As expected I get the following error as
> given below.
>
> mohnish at mohnish-desktop:~/rails_testing/10Mar11/rspec_demo3$ rails g
> rspec_scaffold post title:string body:text
> Could not find generator rspec_scaffold.
> mohnish at mohnish-desktop:~/rails_testing/10Mar11/rspec_demo3$
>
> Could you please tell me how should I give to accordingly for it to work
> for me using the above RoR configuration.
>
Hi Mohnish,
The rails generator script will produce a list of it's generators if
you simply type 'rails g' you can get further assistance by typing
'rails g generator --help' such as 'rails g scaffold --help' I
suspect that you are wanting to generate a scaffold with all of the
rspec tests as well, because rails 3 went modular you no longer need a
special command to get rspec tests, simply by installing the gem and
including it in both :development and :test environments in your
Gemfile, your scaffold generator will automatically produce rspec
tests for you. First check to make sure the rspec:install generator
is listed under 'rails g' and that you have run that generator first,
then you can 'rails g scaffold' and the model/controller/views and
necessary specs will be generated.
Rspec 2 docs are a bit of a work in progress at the moment as I
understand it but there is much to be gleaned from referencing
http://relishapp.com/rspec before you email the list. Specifically
the rspec-rails section.
Hope that helps,
Cole
More information about the rspec-users
mailing list