BigW Consortium Gitlab

shell_spec.rb 966 Bytes
Newer Older
1 2
require 'spec_helper'

Douwe Maan committed
3
describe Gitlab::Shell, lib: true do
Dmitriy Zaporozhets committed
4
  let(:project) { double('Project', id: 7, path: 'diaspora') }
5
  let(:gitlab_shell) { Gitlab::Shell.new }
6 7

  before do
8
    allow(Project).to receive(:find).and_return(project)
9 10
  end

11 12 13 14 15
  it { is_expected.to respond_to :add_key }
  it { is_expected.to respond_to :remove_key }
  it { is_expected.to respond_to :add_repository }
  it { is_expected.to respond_to :remove_repository }
  it { is_expected.to respond_to :fork_repository }
16

17
  it { expect(gitlab_shell.url_to_repo('diaspora')).to eq(Gitlab.config.gitlab_shell.ssh_path_prefix + "diaspora.git") }
18

Douwe Maan committed
19
  describe Gitlab::Shell::KeyAdder, lib: true do
20 21 22 23 24 25 26 27 28 29 30
    describe '#add_key' do
      it 'normalizes space characters in the key' do
        io = spy
        adder = described_class.new(io)

        adder.add_key('key-42', "sha-rsa foo\tbar\tbaz")

        expect(io).to have_received(:puts).with("key-42\tsha-rsa foo bar baz")
      end
    end
  end
31
end