spec/spec_helper.rb in sonic-screwdriver-1.4.0 vs spec/spec_helper.rb in sonic-screwdriver-2.0.0
- old
+ new
@@ -1,24 +1,32 @@
-ENV['TEST'] = '1'
+ENV["TEST"] = "1"
# Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
-ENV['HOME'] = "spec/fixtures/home"
+ENV["HOME"] = "spec/fixtures/home"
+ENV["SONIC_ROOT"] = "spec/fixtures/project"
-# Ensures aws api never called. Fixture home folder does not contain ~/.aws/credentails
-ENV['HOME'] = "spec/fixtures/home"
+# CodeClimate test coverage: https://docs.codeclimate.com/docs/configuring-test-coverage
+# require 'simplecov'
+# SimpleCov.start
require "pp"
-
-root = File.expand_path('../../', __FILE__)
+require "byebug"
+root = File.expand_path("../", File.dirname(__FILE__))
require "#{root}/lib/sonic"
-module Helpers
+module Helper
def execute(cmd)
- puts "Running: #{cmd}" if ENV['DEBUG']
+ puts "Running: #{cmd}" if show_command?
out = `#{cmd}`
- puts out if ENV['DEBUG']
+ puts out if show_command?
out
end
+
+ # Added SHOW_COMMAND because DEBUG is also used by other libraries like
+ # bundler and it shows its internal debugging logging also.
+ def show_command?
+ ENV['DEBUG'] || ENV['SHOW_COMMAND']
+ end
end
RSpec.configure do |c|
- c.include Helpers
+ c.include Helper
end