Sha256: 209bd74341ee2d1ab8d48d66edea302c7b08ae6234fed425712ba2df86c34f0e

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 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}:#{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

3 entries across 3 versions & 1 rubygems

Version Path
aptible-cli-0.7.4 spec/shared/mock_ssh_context.rb
aptible-cli-0.7.3 spec/shared/mock_ssh_context.rb
aptible-cli-0.7.2 spec/shared/mock_ssh_context.rb