Sha256: 9ff7330546f61e7e1cd91a1e6c3557da2a2c99ef25e5f1812e3e8025b6d9bbf8
Contents?: true
Size: 1 KB
Versions: 4
Compression:
Stored size: 1 KB
Contents
require 'generators/my_scaffold_generator' module MySpec module Generators class ControllerGenerator < ::Rails::Generators::NamedBase include MyScaffoldGenerator argument :actions, :type => :array, :default => [], :banner => "action action" def generate_controller_spec return unless options[:controller_specs] template 'controller_spec.rb', File.join('spec/controllers', class_path, "#{file_name}_controller_spec.rb") end def generate_view_specs return if actions.empty? return unless options[:view_specs] empty_directory File.join("spec", "views", file_path) actions.each do |action| @action = action template 'view_spec.rb', File.join("spec", "views", file_path, "#{@action}.html.#{options[:template_engine]}_spec.rb") end end def self.source_root @source_root ||= File.expand_path("templates", File.dirname(__FILE__)) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems