Commit 2b4883e0 authored by Matija Čupić's avatar Matija Čupić

Check for Tag/Branch corectness

parent b6c8d3ac
...@@ -2805,7 +2805,7 @@ describe Project do ...@@ -2805,7 +2805,7 @@ describe Project do
context 'when ref exists' do context 'when ref exists' do
let(:ref) { 'refs/heads/master' } let(:ref) { 'refs/heads/master' }
it 'returns the ref' do it 'returns a ref' do
is_expected.to be_a(Gitlab::Git::Ref) is_expected.to be_a(Gitlab::Git::Ref)
end end
end end
...@@ -2838,9 +2838,13 @@ describe Project do ...@@ -2838,9 +2838,13 @@ describe Project do
project.repository.add_tag(project.creator, ref, 'master') project.repository.add_tag(project.creator, ref, 'master')
end end
it 'returns full tag ref path' do it 'returns a tag' do
is_expected.to be_a(Gitlab::Git::Tag) is_expected.to be_a(Gitlab::Git::Tag)
end end
it 'returns the correct tag' do
expect(subject.name).to eq(ref)
end
end end
context 'when ref is branch name' do context 'when ref is branch name' do
...@@ -2848,9 +2852,13 @@ describe Project do ...@@ -2848,9 +2852,13 @@ describe Project do
project.repository.add_branch(project.creator, ref, 'master') project.repository.add_branch(project.creator, ref, 'master')
end end
it 'returns full branch ref path' do it 'returns a branch' do
is_expected.to be_a(Gitlab::Git::Branch) is_expected.to be_a(Gitlab::Git::Branch)
end end
it 'returns the correct branch' do
expect(subject.name).to eq(ref)
end
end end
end end
end end
......
...@@ -1705,17 +1705,25 @@ describe Repository do ...@@ -1705,17 +1705,25 @@ describe Repository do
context 'when ref is a tag' do context 'when ref is a tag' do
let(:ref) { 'refs/tags/v1.0.0' } let(:ref) { 'refs/tags/v1.0.0' }
it 'returns the tag' do it 'returns a tag' do
is_expected.to be_a(Gitlab::Git::Tag) is_expected.to be_a(Gitlab::Git::Tag)
end end
it 'returns the correct tag' do
expect(subject.name).to eq('v1.0.0')
end
end end
context 'when ref is a branch' do context 'when ref is a branch' do
let(:ref) { 'refs/heads/master' } let(:ref) { 'refs/heads/master' }
it 'returns the branch' do it 'returns a branch' do
is_expected.to be_a(Gitlab::Git::Branch) is_expected.to be_a(Gitlab::Git::Branch)
end end
it 'returns the correct branch' do
expect(subject.name).to eq('master')
end
end end
context 'when ref is invalid' do context 'when ref is invalid' do
......
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