Mohnish J.
2011-Mar-10 13:49 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
Hi, I am a newbie to Rails 3 and Rspec. Kindly excuse my being a novice. I am trying to use RSpec with Rails 3. I am using rails 3.0.3 and ruby 1.9.2 on ubuntu 10.04 os. I am currently referring to the tutorial on :- http://www.railsfire.com/article/rspec-behaviour-driven-development-testing-framework. This tutorial not only uses old plugins , but old Rails version of 2.x also. 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. Thanks -- Posted via http://www.ruby-forum.com/.
Pixel
2011-Mar-10 14:36 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
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
David Chelimsky
2011-Mar-10 14:58 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
On Mar 10, 2011, at 7:49 AM, Mohnish J. wrote:> Hi, > > I am a newbie to Rails 3 and Rspec. Kindly excuse my being a novice. > > I am trying to use RSpec with Rails 3. I am using rails 3.0.3 and ruby > 1.9.2 on ubuntu 10.04 os. > > I am currently referring to the tutorial on :- > http://www.railsfire.com/article/rspec-behaviour-driven-development-testing-framework. > This tutorial not only uses old plugins , but old Rails version of 2.x > also. > > 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.rails generate rspec:install rails generate scaffold In Rails 3, once you run the rspec:install generator, the Rails generators delegate out to rspec-rails to generate the spec files. You might also want to check out http://ruby.railstutorial.org/. Cheers, David
Mohnish J.
2011-Mar-11 01:14 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
David Chelimsky wrote in post #986732:> On Mar 10, 2011, at 7:49 AM, Mohnish J. wrote: > >> also. >> Could you please tell me how should I give to accordingly for it to work >> for me using the above RoR configuration. > > rails generate rspec:install > rails generate scaffold > > In Rails 3, once you run the rspec:install generator, the Rails > generators delegate out to rspec-rails to generate the spec files. > > You might also want to check out http://ruby.railstutorial.org/. > > Cheers, > DavidHi David, Thank you very much for you reply, I now understand that this isn''t needed anymore with Rails 3. I had in another post on the same forum mentioned about one of your blogs:- http://blog.davidchelimsky.net/2007/05/14/an-introduction-to-rspec-part-i/. I am unable to find Part 2 of your tutorial. Could you please tell me where could I find the same. Thanks again..:) -- Posted via http://www.ruby-forum.com/.
Mohnish J.
2011-Mar-11 05:52 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
Hi Cole, Thanks for the link and yorr reply. Yep , I did want to generate a scaffold with all rspec tests. Pixel wrote in post #986740:> On Thu, Mar 10, 2011 at 7:49 AM, Mohnish J. <lists at ruby-forum.com> > wrote: > >> 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-- Posted via http://www.ruby-forum.com/.
Mohnish J.
2011-Apr-16 12:26 UTC
[rspec-users] How to use rspec_scaffold generator with latest rspec gem.
David Chelimsky wrote in post #986732:> On Mar 10, 2011, at 7:49 AM, Mohnish J. wrote: > >> also. >> Could you please tell me how should I give to accordingly for it to work >> for me using the above RoR configuration. > > rails generate rspec:install > rails generate scaffold > > In Rails 3, once you run the rspec:install generator, the Rails > generators delegate out to rspec-rails to generate the spec files. > > You might also want to check out http://ruby.railstutorial.org/. > > Cheers, > DavidHi David, I have posted the same question stackoverflow.com( http://stackoverflow.com/questions/5260173/how-to-use-rspec-scaffold-generator-with-latest-rspec-gem ). It being posted around the same time that you had given your solution on this forum. Kindly post your answer in stackoverflow.com so that you could get your rightful credit for the answer to the question. I shall accept the answer once you have posted the same. Thanks again for your support. -- Posted via http://www.ruby-forum.com/.