Commit 78383c41 authored by Matija Čupić's avatar Matija Čupić

Use build for testing HasRef

parent 6cd09652
...@@ -4,13 +4,13 @@ require 'spec_helper' ...@@ -4,13 +4,13 @@ require 'spec_helper'
describe HasRef do describe HasRef do
describe '#branch?' do describe '#branch?' do
let(:pipeline) { create(:ci_pipeline) } let(:build) { create(:ci_build) }
subject { pipeline.branch? } subject { build.branch? }
context 'is not a tag' do context 'is not a tag' do
before do before do
pipeline.tag = false build.tag = false
end end
it 'return true when tag is set to false' do it 'return true when tag is set to false' do
...@@ -20,7 +20,7 @@ describe HasRef do ...@@ -20,7 +20,7 @@ describe HasRef do
context 'is not a tag' do context 'is not a tag' do
before do before do
pipeline.tag = true build.tag = true
end end
it 'return false when tag is set to true' do it 'return false when tag is set to true' do
...@@ -30,10 +30,10 @@ describe HasRef do ...@@ -30,10 +30,10 @@ describe HasRef do
end end
describe '#git_ref' do describe '#git_ref' do
subject { pipeline.git_ref } subject { build.git_ref }
context 'when tag is true' do context 'when tag is true' do
let(:pipeline) { create(:ci_pipeline, tag: true) } let(:build) { create(:ci_build, tag: true) }
it 'returns a tag ref' do it 'returns a tag ref' do
is_expected.to start_with(Gitlab::Git::TAG_REF_PREFIX) is_expected.to start_with(Gitlab::Git::TAG_REF_PREFIX)
...@@ -41,7 +41,7 @@ describe HasRef do ...@@ -41,7 +41,7 @@ describe HasRef do
end end
context 'when tag is false' do context 'when tag is false' do
let(:pipeline) { create(:ci_pipeline, tag: false) } let(:build) { create(:ci_build, tag: false) }
it 'returns a branch ref' do it 'returns a branch ref' do
is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX) is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX)
...@@ -49,7 +49,7 @@ describe HasRef do ...@@ -49,7 +49,7 @@ describe HasRef do
end end
context 'when tag is nil' do context 'when tag is nil' do
let(:pipeline) { create(:ci_pipeline, tag: nil) } let(:build) { create(:ci_build, tag: nil) }
it 'returns a branch ref' do it 'returns a branch ref' do
is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX) is_expected.to start_with(Gitlab::Git::BRANCH_REF_PREFIX)
......
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