Sha256: 99000d13a6287d914221abe5f36f9c0fb89926b686b1c804644303970b41b638

Contents?: true

Size: 666 Bytes

Versions: 6

Compression:

Stored size: 666 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_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

6 entries across 6 versions & 1 rubygems

Version Path
aptible-cli-0.8.4 spec/shared/mock_ssh_context.rb
aptible-cli-0.8.3 spec/shared/mock_ssh_context.rb
aptible-cli-0.8.2 spec/shared/mock_ssh_context.rb
aptible-cli-0.8.1 spec/shared/mock_ssh_context.rb
aptible-cli-0.8.0 spec/shared/mock_ssh_context.rb
aptible-cli-0.7.5 spec/shared/mock_ssh_context.rb