Ruby on Rails
Monday, February 18, 2013
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.
-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9g4jyEeF5REJ.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment