Class: MySpec::Generators::ViewGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Includes:
MyGenerators::Generators::MyScaffoldGenerator
Defined in:
lib/generators/my_spec/view/view_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MyGenerators::Generators::MyScaffoldGenerator

#method_missing

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class MyGenerators::Generators::MyScaffoldGenerator

Class Method Details

.source_rootObject



18
19
20
# File 'lib/generators/my_spec/view/view_generator.rb', line 18

def self.source_root
  @source_root ||= File.expand_path("templates", File.dirname(__FILE__))
end

Instance Method Details

#create_view_specsObject



8
9
10
11
12
13
14
15
16
# File 'lib/generators/my_spec/view/view_generator.rb', line 8

def create_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