Class: Tuberack::Generators::InstallGenerator

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

Instance Method Summary collapse

Instance Method Details

#capybara_test_helpObject



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/generators/tuberack/install_generator.rb', line 63

def capybara_test_help
  append_file 'test/test_helper.rb' do
    "\nrequire 'capybara/rails' # Capybara must be required directly          \n\nclass ActionDispatch::IntegrationTest\n  include Capybara::DSL\nend\n    EOH\n  end\nend\n"

#codeclimate_test_helpObject



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
    "\n# Don't forget set token\nCodeClimate::TestReporter.start\n    EOH\n  end\nend\n"

#copy_simplecovObject



57
58
59
# File 'lib/generators/tuberack/install_generator.rb', line 57

def copy_simplecov
  template ".simplecov", ".simplecov"
end

#coverage_requirementsObject



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
    "# Keep it on top, don't change positions\nrequire 'simplecov'\nrequire 'coveralls'\nrequire 'codeclimate-test-reporter'\n    EOH\n  end\nend\n"

#coveralls_test_helpObject



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
    "\nCoveralls.wear! if Coveralls.should_run?\n# Coveralls.wear!('rails') if Coveralls.should_run? # For RailsApp\n\n    EOH\n  end\nend\n"

#generate_cucumberObject



42
43
44
# File 'lib/generators/tuberack/install_generator.rb', line 42

def generate_cucumber
  generate 'cucumber:install'
end

#simplecov_cucumberObject



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 
    "require 'simplecov'\n\n    EOH\n  end\nend\n"

#tuberack_test_helpObject



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
    "include Tuberack::Helpers\n    EOH\n  end\n  \n  append_file 'test/test_helper.rb' do\n    <<-EOH\n\nclass ActiveSupport::TestCase\n  # Uncomment if are you using Rails engine\n  # include MyEngine::Engine.routes.url_helpers\nend\n    EOH\n  end\nend\n"

#webmock_test_helpObject



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
    "WebMock.disable_net_connect! allow: %w(coveralls.io)\n    EOH\n  end\nend\n"