lib/serverspec/setup.rb in serverspec-0.0.12 vs lib/serverspec/setup.rb in serverspec-0.0.13

- old
+ new

@@ -55,13 +55,21 @@ def self.safe_create_spec_helper content = <<-EOF require 'serverspec' require 'pathname' +require 'net/ssh' RSpec.configure do |c| c.before do - c.host = File.basename(Pathname.new(example.metadata[:location]).dirname) + host = File.basename(Pathname.new(example.metadata[:location]).dirname) + if c.host != host + c.ssh.close if c.ssh + c.host = host + options = Net::SSH::Config.for(c.host) + user = options[:user] || Etc.getlogin + c.ssh = Net::SSH.start(c.host, user, options) + end end end EOF if File.exists? 'spec/spec_helper.rb' old_content = File.read('spec/spec_helper.rb')