class Mecha::Generators::TestsGenerator
Public Instance Methods
add_development_test_gems()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 19 def add_development_test_gems gem_group :development, :test do gem 'factory_bot_rails' gem 'faker' gem 'rspec-rails' if rspec? gem 'shoulda-matchers' if rspec? end end
add_test_gems()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 9 def add_test_gems gem_group :test do gem 'database_rewinder' gem 'ruby-prof' gem 'timecop' gem 'vcr' gem 'webmock' end end
rspec_files()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 34 def rspec_files return unless rspec? bundle_command('install') run('spring stop') generate('rspec:install') empty_directory('spec/support') copy_file('spec/support/factory_bot.rb', 'spec/support/factory_bot.rb', force: true) copy_file('spec/rails_helper.rb', 'spec/rails_helper.rb', force: true) copy_file('spec/spec_helper.rb', 'spec/spec_helper.rb', force: true) remove_file('test') end
say_warking()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 46 def say_warking message = <<-MESSAGE.strip_heredoc Please install Chrome driver `brew install chromedriver`. MESSAGE say message end
test_files()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 28 def test_files return if rspec? empty_directory_with_keep_file('test/support') copy_file('test/test_helper.rb', 'test/test_helper.rb', force: true) end
Private Instance Methods
rspec?()
click to toggle source
# File lib/mecha/generators/tests/tests_generator.rb, line 58 def rspec? options[:rspec].present? end