class Tuberack::Generators::InstallGenerator
Public Instance Methods
capybara_test_help()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 58 def capybara_test_help append_file 'test/test_helper.rb' do <<-EOH # Capybara must be required directly if TUBERACK.include?(:capybara) begin require 'capybara/rails' rescue LoadError puts "You must put `gem 'capybara'` into your Gemfile and `bundle install` to use Capybara" end class ActionDispatch::IntegrationTest include Capybara::DSL end end EOH end end
codeclimate_test_help()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 19 def codeclimate_test_help prepend_file 'test/test_helper.rb' do <<-EOH # Don't forget set token CodeClimate::TestReporter.start if TUBERACK.include?(:codeclimate) EOH end end
copy_simplecov()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 52 def copy_simplecov template ".simplecov", ".simplecov" end
coverage_requirements()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 30 def coverage_requirements prepend_file 'test/test_helper.rb' do <<-EOH # Keep it on top, don't change positions require 'tuberack/codeclimate' require 'tuberack/simplecov' require 'tuberack/coveralls' EOH end end
coveralls_test_help()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 7 def coveralls_test_help prepend_file 'test/test_helper.rb' do <<-EOH Coveralls.wear! if Coveralls.should_run? if TUBERACK.include?(:coveralls) # Coveralls.wear!('rails') # For RailsApp EOH end end
enabled_services()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 42 def enabled_services prepend_file 'test/test_helper.rb' do <<-EOH TUBERACK = [ :minitest, :shoulda, :mocha, :cell, :factory_girl, :webmock, :capybara, :simplecov, :codeclimate, :coveralls ] EOH end end
tuberack_test_help()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 78 def tuberack_test_help file = File.read('test/test_helper.rb').sub(/require ("|')rails\/test_help("|')\n/, "require 'rails\/test_help'\nrequire 'tuberack/test_help'\n") File.write('test/test_helper.rb', file) append_file 'test/test_helper.rb' do <<-EOH include Tuberack::Helpers EOH end append_file 'test/test_helper.rb' do <<-EOH class ActiveSupport::TestCase # Uncomment if are you using Rails engine # include MyEngine::Engine.routes.url_helpers end EOH end end
webmock_test_help()
click to toggle source
# File lib/generators/tuberack/install_generator.rb, line 100 def webmock_test_help append_file 'test/test_helper.rb' do <<-EOH WebMock.disable_net_connect! allow: %w(coveralls.io) if TUBERACK.include?(:webmock) EOH end end