Sha256: ffb5ced2f0fe54d593427feb414ede6c7c62d4cc30c497eed4d561078a170fcd
Contents?: true
Size: 1.56 KB
Versions: 10
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe Gisha::Commands::Receive do let(:key_id) { "key-#{rand(100) + 100}" } subject do Gisha::Commands::Receive.new(key_id).tap do |receive| allow(receive).to receive_messages(exec_cmd: :exec_called) end end describe :initialize do before { ssh_cmd 'git-receive-pack' } it { expect(subject.key_id).to be_eql(key_id) } end describe :parse_cmd do context 'w/o namespace' do before do ssh_cmd 'git-upload-pack gisha.git' subject.send :parse_cmd end it { expect(subject.repo_name).to be_eql('gisha.git') } it { expect(subject.git_cmd).to be_eql('git-upload-pack') } end context 'namespace' do before do ssh_cmd 'git-upload-pack algonauti/gisha.git' subject.send :parse_cmd end it { expect(subject.repo_name).to be_eql('algonauti/gisha.git') } it { expect(subject.git_cmd).to be_eql('git-upload-pack') } end context 'with an invalid number of arguments' do before { ssh_cmd 'foobar' } it "should raise an DisallowedCommandError" do expect { subject.send :parse_cmd }.to raise_error(Gisha::Commands::Receive::DisallowedCommandError) end end end describe :exec do context 'git-upload-pack' do before { ssh_cmd 'git-upload-pack gitlab-ci.git' } after { subject.exec } it "should process the command" do allow(subject).to receive_messages(process_cmd: :process_cmd_called) end end end def ssh_cmd(cmd) ENV['SSH_ORIGINAL_COMMAND'] = cmd end end
Version data entries
10 entries across 10 versions & 1 rubygems