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


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

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


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

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


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

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