123456789_123456789_123456789_123456789_123456789_

Class: Rspec::Generators::ModelGenerator Private

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Base, Rails::Generators::NamedBase
Instance Chain:
self, Base, ::RSpec::Rails::FeatureCheck, Rails::Generators::NamedBase
Inherits: Rspec::Generators::Base
Defined in: rspec-rails/lib/generators/rspec/model/model_generator.rb

Class Method Summary

Base - Inherited

.configuration

Load configuration from ::RSpec to ensure –default-path is set.

.source_root

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#missing_fixture_replacement?Boolean (readonly, private)

[ GitHub ]

  
# File 'rspec-rails/lib/generators/rspec/model/model_generator.rb', line 32

def missing_fixture_replacement?
  options[:fixture] && options[:fixture_replacement].nil?
end

Instance Method Details

#create_fixture_file

[ GitHub ]

  
# File 'rspec-rails/lib/generators/rspec/model/model_generator.rb', line 24

def create_fixture_file
  return unless missing_fixture_replacement?

  template 'fixtures.yml', target_path('fixtures', class_path, "#{(pluralize_table_names? ? plural_file_name : file_name)}.yml")
end

#create_model_spec

[ GitHub ]

  
# File 'rspec-rails/lib/generators/rspec/model/model_generator.rb', line 13

def create_model_spec
  template_file = target_path(
    'models',
    class_path,
    "#{file_name}_spec.rb"
  )
  template 'model_spec.rb', template_file
end