Class: EffectiveTestBot::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#copy_initializer ⇒ Object



34
35
36
# File 'lib/generators/effective_test_bot/install_generator.rb', line 34

def copy_initializer
  template "effective_test_bot.rb", "config/initializers/effective_test_bot.rb"
end

#explain_overwrite ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/generators/effective_test_bot/install_generator.rb', line 16

def explain_overwrite
  puts '[effective_test_bot] Successfully installed/detected: minitest'
  puts ""
  puts 'Starting effective_test_bot specific installation tasks:'
  puts ""
  puts "You will be prompted to overwrite the default minitest configuration"
  puts "files with those packaged inside the effective_test_bot gem."
  puts ""
  puts "If you have very specific existing minitest configuration,"
  puts "you may want to skip (press 'n') to the following overwrites"
  puts "and refer to the GitHub documentation for this gem:"
  puts "https://github.com/code-and-effect/effective_test_bot"
  puts ""
  puts "Otherwise, press 'Y' to all the following prompts to automatically configure"
  puts "minitest-rails and capybara-webkit based effective_test_bot test coverage"
  puts ""
end

#install_minitest ⇒ Object



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

def install_minitest
  return if File.exists?('test/test_helper.rb')
  puts '[effective_test_bot] installing minitest'
  run 'bundle exec rails generate minitest:install'
end

#overwrite_minitest ⇒ Object



38
39
40
# File 'lib/generators/effective_test_bot/install_generator.rb', line 38

def overwrite_minitest
  template 'test_helper.rb', 'test/test_helper.rb'
end

#thank_you ⇒ Object



42
43
44
45
46
# File 'lib/generators/effective_test_bot/install_generator.rb', line 42

def thank_you
  puts "Thanks for using EffectiveTestBot"
  puts "First make sure your test environment is correctly configured by running 'rake test:bot:environment'"
  puts "Run tests with 'rake test:bot'"
end