class Terraspace::CLI::Test
Public Class Methods
new(options={})
click to toggle source
# File lib/terraspace/cli/test.rb, line 3 def initialize(options={}) @options = options end
Public Instance Methods
adjust_command(command)
click to toggle source
# File lib/terraspace/cli/test.rb, line 19 def adjust_command(command) if cd_into_test? command = "bundle exec #{command}" unless command.include?("bundle exec") command = "cd test && #{command}" else command end end
cd_into_test?()
click to toggle source
Automatically cd into the test folder in case running within the root of a module. Detect/guess that we're in a module folder vs the terraspace project
# File lib/terraspace/cli/test.rb, line 30 def cd_into_test? !File.exist?("app") && File.exist?("test") && (File.exist?("main.tf") || File.exist?("main.rb")) end
execute(command)
click to toggle source
# File lib/terraspace/cli/test.rb, line 13 def execute(command) command = adjust_command(command) puts "=> #{command}" Kernel.exec(command) end
run()
click to toggle source
# File lib/terraspace/cli/test.rb, line 7 def run config = Terraspace.config test_command = config.test_framework_command || config.test_framework execute(test_command) end