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

Instance Method Details

#generate_controller_specObject



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

def generate_controller_spec
  return unless options[:controller_specs]

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

#generate_routing_specObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/rspec/scaffold/scaffold_generator.rb', line 32

def generate_routing_spec
  return unless options[:routing_specs]

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