Commit 253e23d7 authored by Patrick Steinhardt's avatar Patrick Steinhardt

gitaly_client: Fix intermixed tests for UserSquash and UserCommitFiles

Tests for the UserCommitFiles RPC are currently part of the tests for
UserSquash. This seems to be unintentional and doesn't make a whole lot
of sense.

Move out tests for UserCommitFiles into its own standalone context.
parent b14e50a9
...@@ -436,41 +436,41 @@ RSpec.describe Gitlab::GitalyClient::OperationService do ...@@ -436,41 +436,41 @@ RSpec.describe Gitlab::GitalyClient::OperationService do
Gitlab::Git::Repository::GitError, "something failed") Gitlab::Git::Repository::GitError, "something failed")
end end
end end
end
describe '#user_commit_files' do describe '#user_commit_files' do
subject do subject do
client.user_commit_files( client.user_commit_files(
gitaly_user, 'my-branch', 'Commit files message', [], 'janedoe@example.com', 'Jane Doe', gitaly_user, 'my-branch', 'Commit files message', [], 'janedoe@example.com', 'Jane Doe',
'master', repository) 'master', repository)
end end
before do before do
expect_any_instance_of(Gitaly::OperationService::Stub) expect_any_instance_of(Gitaly::OperationService::Stub)
.to receive(:user_commit_files).with(kind_of(Enumerator), kind_of(Hash)) .to receive(:user_commit_files).with(kind_of(Enumerator), kind_of(Hash))
.and_return(response) .and_return(response)
end end
context 'when a pre_receive_error is present' do context 'when a pre_receive_error is present' do
let(:response) { Gitaly::UserCommitFilesResponse.new(pre_receive_error: "GitLab: something failed") } let(:response) { Gitaly::UserCommitFilesResponse.new(pre_receive_error: "GitLab: something failed") }
it 'raises a PreReceiveError' do it 'raises a PreReceiveError' do
expect { subject }.to raise_error(Gitlab::Git::PreReceiveError, "something failed") expect { subject }.to raise_error(Gitlab::Git::PreReceiveError, "something failed")
end
end end
end
context 'when an index_error is present' do context 'when an index_error is present' do
let(:response) { Gitaly::UserCommitFilesResponse.new(index_error: "something failed") } let(:response) { Gitaly::UserCommitFilesResponse.new(index_error: "something failed") }
it 'raises a PreReceiveError' do it 'raises a PreReceiveError' do
expect { subject }.to raise_error(Gitlab::Git::Index::IndexError, "something failed") expect { subject }.to raise_error(Gitlab::Git::Index::IndexError, "something failed")
end
end end
end
context 'when branch_update is nil' do context 'when branch_update is nil' do
let(:response) { Gitaly::UserCommitFilesResponse.new } let(:response) { Gitaly::UserCommitFilesResponse.new }
it { expect(subject).to be_nil } it { expect(subject).to be_nil }
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment