Sha256: e54926815bd776c7dcd8a95c34a96745935ad483e02faacfcbdd26c63305c51f

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'
require 'git_handler/public_key'

describe GitHandler::PublicKey do
  it 'required content' do
    proc { GitHandler::PublicKey.new }.
      should raise_error ArgumentError, 'Key content is empty!'
  end

  it 'should be valid' do
    proc { GitHandler::PublicKey.new('some data') }.
      should raise_error ArgumentError, 'Is not a valid public key!'

    k = SSHKey.generate

    proc { GitHandler::PublicKey.new(k.ssh_public_key) }.
      should_not raise_error ArgumentError, 'Is not a valid public key!'
  end

  context '.to_system_key' do
    it 'returns a customized key content' do
      k = SSHKey.generate
      key = GitHandler::PublicKey.new(k.ssh_public_key)
      custom = key.to_system_key('foobar')
      custom.should eq('command="foobar",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ' + k.ssh_public_key)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git_handler-0.2.2 spec/public_key_spec.rb
git_handler-0.2.1 spec/public_key_spec.rb
git_handler-0.2.0 spec/public_key_spec.rb