Class: Rspec::Generators::ScaffoldGenerator

Inherits:
Base
  • Object
show all
Includes:
Rails::Generators::ResourceHelpers
Defined in:
lib/generators/rspec/scaffold/scaffold_generator.rb

Instance Method Summary collapse

Methods inherited from Base

source_root

Instance Method Details

#generate_controller_specObject



22
23
24
25
26
27
# File 'lib/generators/rspec/scaffold/scaffold_generator.rb', line 22

def generate_controller_spec
  return unless options[:controller_specs]

  template 'controller_spec.rb',
           File.join('spec/controllers', controller_class_path, "#{controller_file_name}_controller_spec.rb")
end

#generate_routing_specObject



43
44
45
46
47
48
# File 'lib/generators/rspec/scaffold/scaffold_generator.rb', line 43

def generate_routing_spec
  return unless options[:routing_specs]

  template 'routing_spec.rb',
    File.join('spec/routing', controller_class_path, "#{controller_file_name}_routing_spec.rb")
end

#generate_view_specsObject



29
30
31
32
33
34
35
36
# File 'lib/generators/rspec/scaffold/scaffold_generator.rb', line 29

def generate_view_specs
  return unless options[:view_specs]

  copy_view :edit
  copy_view :index unless options[:singleton]
  copy_view :new
  copy_view :show
end