Sha256: 20e0c1ec66c2ba3e330cae83edb8b0c2f5ac6611700ec8c35f90fccba310d5ae

Contents?: true

Size: 967 Bytes

Versions: 2

Compression:

Stored size: 967 Bytes

Contents

# Generates the class and view for a controller in a plugin's test application
class PluginTestControllerGenerator < PluginTestHelper::Generator
  def manifest #:nodoc:
    record do |m|
      # Check for class naming collisions
      m.class_collisions class_path, "#{class_name}Controller", "#{class_name}Helper"
      
      # Controller and views directories
      m.directory File.join(plugin_app_root, 'app/controllers', class_path)
      m.directory File.join(plugin_app_root, 'app/views', class_path, file_name)
      
      # Controller class
      m.template 'controller.rb', File.join(plugin_app_root, 'app/controllers', class_path, "#{file_name}_controller.rb")
      
      # View template for each action
      actions.each do |action|
        path = File.join(plugin_app_root, 'app/views', class_path, file_name, "#{action}.html.erb")
        m.template 'view.html.erb', path, :assigns => {:action => action, :path => path}
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
plugin_test_helper-0.2.0 generators/plugin_test_controller/plugin_test_controller_generator.rb
plugin_test_helper-0.2.1 generators/plugin_test_controller/plugin_test_controller_generator.rb