Class: Regressor::ControllerGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/regressor/controller_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_regression_filesObject



7
8
9
10
11
12
13
# File 'lib/generators/regressor/controller_generator.rb', line 7

def create_regression_files
  Rails.application.eager_load!
  ApplicationController.descendants.map(&:name).reject { |x| Regressor.configuration.excluded_controllers.include? x }.each do |controller|
    @controller = Regressor::Controller::Regression.new(controller)
    create_file "#{Regressor.configuration.regression_controller_path}/#{controller.underscore}_spec.rb", ERB.new(File.new(File.expand_path('../../templates/controller/controller_spec_template.erb', File.dirname(__FILE__))).read).result(binding)
  end
end