Created
May 8, 2014 14:15
-
-
Save jhaals/d6ff66be0a1b692cfcfd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pathname' | |
require 'serverspec' | |
require 'net/ssh' | |
def fixture_path | |
Pathname.new(File.expand_path(File.join(__FILE__, '..', 'fixtures'))) | |
end | |
include SpecInfra::Helper::Ssh | |
include SpecInfra::Helper::DetectOS | |
RSpec.configure do |c| | |
c.before :all do | |
host = ENV['TARGET_HOST'] | |
if c.host != host | |
c.ssh.close if c.ssh | |
c.host = host | |
c.color_enabled = true | |
c.tty = true | |
c.sudo_password = '' | |
options = Net::SSH::Config.for(c.host) | |
# Suppress warning from zlib if compression is enabled in ssh conf | |
options[:compression] = 'none' | |
options[:forward_agent] = true | |
user = ENV['TARGET_USER'] || Etc.getlogin | |
c.ssh = Net::SSH.start(host, user, options) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment