I''ve got a love-hate relationship with script/generate rspec_scaffold If you are using non-nested controllers/resources it''s great. I love the spec skeletons it generates. But I find myself doing this, where Y is and existing set of model/controller ... representing a resource: 1) script/generate rspec_scaffold x .... At this point rake spec passes. 2) edit config/routes.rb and change it from: map.resources :ys map.resources :xs to: map.resources :ys do | y | y.resources :xs end At this point rake spec fails on the routes and controller specs for x, no big surprise. The controller needs to change as well. This is followed by a manual editing session of BOTH the controller and the specs, with lots of fairly tedious changes. Of course most of this might be laid to the rails scaffold generator not being able to generate nested resource controllers directly as a prerequisite to rspec_scaffold, unless there''s something y''all know that I don''t. (Well I''m sure that y''all know lots that I don''t but I don''t know if it''s relevant to this). But the changes to the controller are much easier than the changes to the specs. I was starting to think about writing a plugin/tool to address this, but I was wondering if anyone had any insight or had already started down this path. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/
On Dec 18, 2007 4:58 PM, Rick DeNatale <rick.denatale at gmail.com> wrote:> I was starting to think about writing a plugin/tool to address this, > but I was wondering if anyone had any insight or had already started > down this path.This is definitely something I''d like to see addressed, so if you come up w/something that works I''ll commit it. I don''t know if anyone is already working on it.
Someone has been working on it: http://deaddeadgood.com/2008/10/8/scaffolding-nested-resources-in-rails http://github.com/phorsfall/rspec_on_rails_nested_scaffold/tree/master This works for me on rails 2.2.2 and the latest rspec-rails (1.1.11.1) On Wed, Dec 19, 2007 at 12:04 PM, David Chelimsky <dchelimsky at gmail.com>wrote:> On Dec 18, 2007 4:58 PM, Rick DeNatale <rick.denatale at gmail.com> wrote: > > I was starting to think about writing a plugin/tool to address this, > > but I was wondering if anyone had any insight or had already started > > down this path. > > This is definitely something I''d like to see addressed, so if you come > up w/something that works I''ll commit it. > > I don''t know if anyone is already working on it. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081126/74a886f6/attachment.html>
Maybe Matching Threads
- I thought the RSPec community might be interested
- RSpec and resource_controller plugin
- Anyone using the rspec textmate bundle with Ruby 1.9.1
- Which rspec for rails 2.1RC1?
- Any pioneers who've configured passenger to support some apps running in 1.8.x others in 1.9?