Class: Rails::ServiceGenerator

Inherits:
Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/service/service_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_service_fileObject



7
8
9
10
# File 'lib/generators/service/service_generator.rb', line 7

def copy_service_file
  @module_name = class_path.join('/').classify
  template 'service.rb', "app/services/#{file_path}.rb"
end

#copy_service_test_fileObject



12
13
14
15
16
17
18
# File 'lib/generators/service/service_generator.rb', line 12

def copy_service_test_file
  if options.test_suite == 'rspec'
    template 'service_spec.rb', "spec/services/#{file_path}_spec.rb"
  elsif options.test_suite == 'minitest'
    template 'service_test.rb', "test/services/#{file_path}_test.rb"
  end
end