Search code examples
ruby-on-railsruby-on-rails-3rspeccode-generationrails-generate

How to turn off generators for RSpec 2 in Rails 3?


I installed the current RSpec 2 Beta under Rails 3 RC as mentioned on the GitHub page (and several blogs). Everything works fine, but I am not able to turn off specific generators like advised on some blogs.

Here is what I do in ./config/application.rb:

config.generators do |g|
  g.test_framework :rspec, :fixtures => false, :views => false
end

But when doing a "rails g scaffold Model name:string" those view specs are still generated. What's wrong with my setup?


Solution

  • You'll want to pass the :view_specs => false option too. I don't know why this is different between the controller generator (where :views => false has effect) and scaffold. I'll ask David.