Forum: Ruby on Rails Custom Generators ignored

Posted by Iazel (Guest)
on 2013-02-19 13:01
(Received via mailing list)
I want to add a spec for _form template, and then created a generators 
the
inherit from Rspec::Generators::ScaffoldGenerator. What I have:

# lib/generators/rspec_modded/scaffold/scaffold_generator.rb
require 'generators/rspec/scaffold/scaffold_generator.rb'
module RspecModded
  module Generators
    class ScaffoldGenerator < Rspec::Generators::ScaffoldGenerator
      def generate_view_specs
        super
        copy_view :_form
      end
    end
  end
end

# config/application.rb
# ...
module TestApp
  class Application < Rails::Application
    # ...
    config.generators do |g|
      g.stylesheets      false
      g.assets           false
      g.helper           false
      g.integration_tool false

      g.test_framework :rspec_modded, fixture: false, 
fixture_replacement:
nil
      g.fallbacks[:rspec_modded] = :rspec
    end
  end
end


If I run `rails g` the generator is there and works as expected when
manually run `rails g rspec_modded:scaffold`. However, during scaffold 
the
test_framework is set to test_unit and I can't figure out why!
With `g.test_framework :rspec #...` it works. I've tried to add
lib/generators in the autoload, to delete the passed options... Nothing
seems to work.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.