Class: HandsomeFencerTest::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#configure_test_with_specObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/generators/installer/install_generator.rb', line 22

def configure_test_with_spec

  if destination_root == Rails.root.to_s
    file = 'config/application.rb'
  else
    file = 'test/dummy/config/application.rb'
  end
  inject_into_file file, after: "class Application < Rails::Application\n" do
    <<-'RUBY'
      # Force new test files to be generated in the minitest-spec style
      config.generators do |g|
        g.test_framework :minitest, spec: true
        g.scaffold_stylesheet false
      end
    RUBY
  end
end

#copy_guardfile_fileObject



6
7
8
# File 'lib/generators/installer/install_generator.rb', line 6

def copy_guardfile_file
  copy_file "Guardfile.tt", "Guardfile"
end

#copy_test_helper_fileObject



10
11
12
13
14
15
16
# File 'lib/generators/installer/install_generator.rb', line 10

def copy_test_helper_file
  if destination_root == Rails.root.to_s
    copy_file "test_helper.rb.tt", "test/test_helper.rb"
  else
    copy_file "engine_test_helper.rb.tt", "test/test_helper.rb"
  end
end

#copy_test_support_filesObject



18
19
20
# File 'lib/generators/installer/install_generator.rb', line 18

def copy_test_support_files
  directory "support", "test/support"
end