Class: Tuberack::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Tuberack::Generators::InstallGenerator
- Defined in:
- lib/generators/tuberack/install_generator.rb
Instance Method Summary collapse
- #capybara_test_help ⇒ Object
- #codeclimate_test_help ⇒ Object
- #copy_simplecov ⇒ Object
- #coverage_requirements ⇒ Object
- #coveralls_test_help ⇒ Object
- #generate_cucumber ⇒ Object
- #simplecov_cucumber ⇒ Object
- #tuberack_test_help ⇒ Object
- #webmock_test_help ⇒ Object
Instance Method Details
#capybara_test_help ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/generators/tuberack/install_generator.rb', line 63 def append_file 'test/test_helper.rb' do <<-EOH require 'capybara/rails' # Capybara must be required directly class ActionDispatch::IntegrationTest include Capybara::DSL end EOH end end |
#codeclimate_test_help ⇒ Object
19 20 21 22 23 24 25 26 27 |
# 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 EOH end end |
#copy_simplecov ⇒ Object
57 58 59 |
# File 'lib/generators/tuberack/install_generator.rb', line 57 def copy_simplecov template ".simplecov", ".simplecov" end |
#coverage_requirements ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# 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 'simplecov' require 'coveralls' require 'codeclimate-test-reporter' EOH end end |
#coveralls_test_help ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# 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? # Coveralls.wear!('rails') if Coveralls.should_run? # For RailsApp EOH end end |
#generate_cucumber ⇒ Object
42 43 44 |
# File 'lib/generators/tuberack/install_generator.rb', line 42 def generate_cucumber generate 'cucumber:install' end |
#simplecov_cucumber ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/generators/tuberack/install_generator.rb', line 47 def simplecov_cucumber prepend_file 'features/support/env.rb' do <<-EOH require 'simplecov' EOH end end |
#tuberack_test_help ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/generators/tuberack/install_generator.rb', line 77 def tuberack_test_help file = File.read('test/test_helper.rb').sub(/require ("|')rails\/test_help("|')\n/, "require 'rails\/test_help'\nrequire 'tuberack'\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 ⇒ Object
99 100 101 102 103 104 105 |
# File 'lib/generators/tuberack/install_generator.rb', line 99 def webmock_test_help append_file 'test/test_helper.rb' do <<-EOH WebMock.disable_net_connect! allow: %w(coveralls.io) EOH end end |