Another Japan in the World

Jun Aruga's blog, who lived in Japan, Singapore, live in Czech Republic. Mainly about IT and travel.

RSpec on Railsのコントローラー自動生成がうまくいかない

各バージョンは以下の通り。
Rspec on Railsのバージョンは plugin のバージョン表示の仕方がわからなかったので、History.rdocファイルをみた。

$ ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-solaris2]

$ rails -v
Rails 2.3.2

$ head vendor/plugins/rspec-rails/History.rdoc 
=== Version 1.2.8 (in git)
...

うまくいかない。

$ ruby script/generate rspec_controller realestates show
undefined local variable or method `controller_class_path' for #<RspecControllerGenerator:0x99ab600>

うまくいかない。

$ ruby script/generate rspec_controller 'realestates/image' index show
undefined local variable or method `controller_class_path' for #<RspecControllerGenerator:0x9966938>

この辺、読んだけど不明。バグ?

$ vi vendor/plugins/rspec-rails/generators/rspec_controller/rspec_controller_generator.rb
$ cd xxx
$ vi rails-2.3.2/lib/rails_generator/generators/components/controller/controller_generator.rb

controllerの自動生成はうまくいく。

$ ruby script/generate controller 'realestates/image' index show
      create  app/controllers/realestates
      create  app/helpers/realestates
      create  app/views/realestates/image
      create  test/functional/realestates
      create  test/unit/helpers/realestates
      create  app/controllers/realestates/image_controller.rb
      create  test/functional/realestates/image_controller_test.rb
      create  app/helpers/realestates/image_helper.rb
      create  test/unit/helpers/realestates/image_helper_test.rb
      create  app/views/realestates/image/index.html.erb
      create  app/views/realestates/image/show.html.erb

今度、もう少し調べてみよう。

Remove all ads