summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/git/push_spec.rb
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-02 13:01:55 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-10-02 13:01:55 +0200
commit1c4187e38e09c8dfc4d0cdbd4c702aff5d695acb (patch)
treea9de030f4c6ecbfb75cdd4f70b802db4f2d2611a /spec/lib/gitlab/git/push_spec.rb
parent9bad9b0a68074d4b0fe5de7f3c5cefd4a808c726 (diff)
downloadgitlab-ce-1c4187e38e09c8dfc4d0cdbd4c702aff5d695acb.tar.gz
Treat nil git push revisons as a blank Git SHA value
Diffstat (limited to 'spec/lib/gitlab/git/push_spec.rb')
-rw-r--r--spec/lib/gitlab/git/push_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/lib/gitlab/git/push_spec.rb b/spec/lib/gitlab/git/push_spec.rb
index 2a7a357f384..566c8209504 100644
--- a/spec/lib/gitlab/git/push_spec.rb
+++ b/spec/lib/gitlab/git/push_spec.rb
@@ -63,6 +63,12 @@ describe Gitlab::Git::Push do
it { is_expected.not_to be_branch_updated }
end
+
+ context 'when oldrev is nil' do
+ let(:oldrev) { nil }
+
+ it { is_expected.not_to be_branch_updated }
+ end
end
describe '#force_push?' do
@@ -125,4 +131,36 @@ describe Gitlab::Git::Push do
end
end
end
+
+ describe '#oldrev' do
+ context 'when a valid oldrev is provided' do
+ it 'returns oldrev' do
+ expect(subject.oldrev).to eq oldrev
+ end
+ end
+
+ context 'when a nil valud is provided' do
+ let(:oldrev) { nil }
+
+ it 'returns blank SHA' do
+ expect(subject.oldrev).to eq Gitlab::Git::BLANK_SHA
+ end
+ end
+ end
+
+ describe '#newrev' do
+ context 'when valid newrev is provided' do
+ it 'returns newrev' do
+ expect(subject.newrev).to eq newrev
+ end
+ end
+
+ context 'when a nil valud is provided' do
+ let(:newrev) { nil }
+
+ it 'returns blank SHA' do
+ expect(subject.newrev).to eq Gitlab::Git::BLANK_SHA
+ end
+ end
+ end
end