Sha256: 9b21a83366db8b623d759706c6c6b907eb217a325b56b94b3d273ffc44a3ae60

Contents?: true

Size: 784 Bytes

Versions: 46

Compression:

Stored size: 784 Bytes

Contents

shared_context 'mock ssh' do
  let(:ssh_mock_outfile) { Tempfile.new('tunnel_spec') }

  after do
    ssh_mock_outfile.close
    ssh_mock_outfile.unlink
  end

  around do |example|
    mocks_path = File.expand_path('../../mock', __FILE__)
    env = {
      PATH: "#{mocks_path}#{File::PATH_SEPARATOR}#{ENV['PATH']}",
      SSH_MOCK_OUTFILE: ssh_mock_outfile.path
    }

    ClimateControl.modify(env) { example.run }
  end

  def read_mock_pid
    File.open(ssh_mock_outfile) do |f|
      return JSON.load(f.read).fetch('pid')
    end
  end

  def read_mock_argv
    File.open(ssh_mock_outfile) do |f|
      return JSON.load(f.read).fetch('argv')
    end
  end

  def read_mock_env
    File.open(ssh_mock_outfile) do |f|
      return JSON.load(f.read).fetch('env')
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
aptible-cli-0.24.2 spec/shared/mock_ssh_context.rb
aptible-cli-0.24.1 spec/shared/mock_ssh_context.rb
aptible-cli-0.24.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.23.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.22.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.21.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.20.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.9 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.7 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.6 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.4 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.3 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.2 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.1 spec/shared/mock_ssh_context.rb
aptible-cli-0.19.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.18.3 spec/shared/mock_ssh_context.rb
aptible-cli-0.18.2 spec/shared/mock_ssh_context.rb
aptible-cli-0.18.1 spec/shared/mock_ssh_context.rb
aptible-cli-0.18.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.17.2 spec/shared/mock_ssh_context.rb