class HarnessSpecHelperGenerator

Public Instance Methods

generate_spec_helper() click to toggle source
# File lib/generators/harness_spec_helper/harness_spec_helper_generator.rb, line 7
def generate_spec_helper
  copy_file 'base_spec_helper.rb', 'spec/base_spec_helper.rb'
  copy_file 'dotrspec', '.rspec'
  create_file 'spec/support_common/.keep'
end
generate_spec_helpers() click to toggle source
# File lib/generators/harness_spec_helper/harness_spec_helper_generator.rb, line 13
def generate_spec_helpers
  return if spec_type == 'base'
  template template_file, "spec/#{spec_type.underscore.pluralize}_spec_helper.rb"
  create_file "spec/support_#{spec_type.underscore.pluralize}/.keep"
  create_file "spec/#{spec_type.underscore.pluralize}/.keep"
  create_file "app/#{spec_type.underscore.pluralize}/.keep" unless spec_type.underscore.pluralize == 'features'
end

Private Instance Methods

template_file() click to toggle source
# File lib/generators/harness_spec_helper/harness_spec_helper_generator.rb, line 31
def template_file
  template_map.fetch(spec_type.underscore.pluralize) { 'light_spec_helper.rb' }
end
template_map() click to toggle source
# File lib/generators/harness_spec_helper/harness_spec_helper_generator.rb, line 22
def template_map
  {
    'decorators' => 'decorators_spec_helper.rb',
    'features' => 'features_spec_helper.rb',
    'forms' => 'forms_spec_helper.rb',
    'models' => 'models_spec_helper.rb'
  }
end