[rspec-devel] [ rspec-Bugs-11891 ] script/generate rspec_controller fails to create appropriate views (from templates) on edge rails

noreply at rubyforge.org noreply at rubyforge.org
Thu Jun 28 12:48:35 EDT 2007

Bugs item #11891, was opened at 2007-06-27 19:45
You can respond by visiting: 

Category: rails plugin
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: George Anderson (caton)
>Assigned to: David Chelimsky (dchelimsky)
Summary: script/generate rspec_controller fails to create appropriate views (from templates) on edge rails

Initial Comment:
Mac OSX 10.4.9
edge rails: r7126
rspec (plugin): r2082
rspec_on_rails: r2081

Views couldn't be generated by script/generate rspec_controller ...

 $ script/generate rspec_controller patient_base index face_sheet patient_messages rx chart_timeline archive chart_note flow_sheet hist
ory hospital lab_results radiology x_ray
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/patient_base
      exists  spec/controllers/
      exists  spec/helpers/
      create  spec/views/patient_base
      create  spec/controllers/patient_base_controller_spec.rb
      create  spec/helpers/patient_base_helper_spec.rb
      create  app/controllers/patient_base_controller.rb
      create  app/helpers/patient_base_helper.rb
      create  spec/views/patient_base/index_view_spec.rb
      create  app/views/patient_base/index.rhtml
No such file or directory - /Users/george/work/one_box/vendor/rails/railties/lib/rails_generator/generators/components/controller/templates/view.rhtml

railties/lib/rails_generator/generators/components/controller/templates/view.html changed to view.html.erb as of r6690 (roughly 2 months ago).  
See:  http://dev.rubyonrails.org/browser/trunk/railties/lib/rails_generator/generators/components/controller/templates

Rails 1.2 STABLE should use view.rhtml (See: http://dev.rubyonrails.org/browser/branches/1-2-stable/railties/lib/rails_generator/generators/components/controller/templates)

So perhaps this ticket is premature.  Consider, however, the *.html.erb style will eventually be in the STABLE release.  At that time, RSpec may have to deal with the *old* and *new* style templates.

For those of you reading this far, and not feeling you have suffient RSpec-fu to create a patch for this (myself included among you), consider this workaround:

$ script/generate rspec_controller patient_base index

this will throw the error herein described, but just lop off the "rspec_" bit and run:

$ script/generate controller patient_base index

Most of the files will be identical, but the *.html.erb-style templates will generate as expected.

For bonus points, clean up the test::unit cruft thusly:

$ rm test/functional/patient_base_controller_test.rb



>Comment By: David Chelimsky (dchelimsky)
Date: 2007-06-28 16:48

No need to justify this - it's missing functionality that we'll add. The rspec_resource generator already does the right thing based on the rails environment and we can get the rspec_controller generator to do the same.


Comment By: George Anderson (caton)
Date: 2007-06-28 16:45

.rhtml won't be fully deprecated until Rails 3.0

See: http://dev.rubyonrails.org/changeset/6178


You can respond by visiting: 

More information about the rspec-devel mailing list