Class: Boring::Webmock::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Boring::Webmock::InstallGenerator
show all
- Includes:
- BoringGenerators::GeneratorHelper
- Defined in:
- lib/generators/boring/webmock/install/install_generator.rb
Constant Summary
collapse
- SUPPORTED_TEST_FRAMEWORKS =
%w[rspec minitest]
Instance Method Summary
collapse
#app_ruby_version, #bundle_install, #check_and_install_gem, #gem_installed?, #inject_into_file_if_new
Instance Method Details
#add_webmock_gem ⇒ Object
34
35
36
37
38
|
# File 'lib/generators/boring/webmock/install/install_generator.rb', line 34
def add_webmock_gem
say "Adding webmock gem", :green
check_and_install_gem "webmock", group: :test
end
|
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/generators/boring/webmock/install/install_generator.rb', line 40
def configure_webmock
app_test_framework = options[:app_test_framework]
say "Configuring webmock", :green
if app_test_framework == "minitest"
configure_minitest
else
configure_rspec
end
end
|
#verify_test_framework_configurations ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/generators/boring/webmock/install/install_generator.rb', line 20
def verify_test_framework_configurations
app_test_framework = options[:app_test_framework]
if app_test_framework.blank?
say <<~WARNING, :red
ERROR: Unsupported test framework: #{app_test_framework}
WARNING
abort
else
verify_presence_of_test_framework
end
end
|