Simplify view specs for commit status badge partial
This commit is contained in:
parent
79a37423a3
commit
8d23b9647e
1 changed files with 34 additions and 29 deletions
|
@ -10,7 +10,7 @@ describe 'ci/status/_badge', :view do
|
|||
create(:ci_build, :success, pipeline: pipeline)
|
||||
end
|
||||
|
||||
context 'when status has details' do
|
||||
context 'when user has ability to see details' do
|
||||
before do
|
||||
project.add_developer(user)
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ describe 'ci/status/_badge', :view do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when status does not have details' do
|
||||
context 'when user do not have ability to see build details' do
|
||||
before do
|
||||
render_status(build)
|
||||
end
|
||||
|
@ -41,17 +41,19 @@ describe 'ci/status/_badge', :view do
|
|||
end
|
||||
|
||||
context 'when rendering status for external job' do
|
||||
context 'when user has ability to see commit status details' do
|
||||
before do
|
||||
project.add_developer(use)
|
||||
|
||||
render_status(external_job)
|
||||
project.add_developer(user)
|
||||
end
|
||||
|
||||
context 'status has external target url' do
|
||||
let(:external_job) do
|
||||
create(:generic_commit_status, status: :running,
|
||||
before do
|
||||
external_job = create(:generic_commit_status,
|
||||
status: :running,
|
||||
pipeline: pipeline,
|
||||
target_url: 'http://gitlab.com')
|
||||
|
||||
render_status(external_job)
|
||||
end
|
||||
|
||||
it 'contains valid commit status text' do
|
||||
|
@ -64,8 +66,10 @@ describe 'ci/status/_badge', :view do
|
|||
end
|
||||
|
||||
context 'status do not have external target url' do
|
||||
let(:external_job) do
|
||||
create(:generic_commit_status, status: :canceled)
|
||||
before do
|
||||
external_job = create(:generic_commit_status, status: :canceled)
|
||||
|
||||
render_status(external_job)
|
||||
end
|
||||
|
||||
it 'contains valid commit status text' do
|
||||
|
@ -77,6 +81,7 @@ describe 'ci/status/_badge', :view do
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def render_status(resource)
|
||||
render 'ci/status/badge', status: resource.detailed_status(user)
|
||||
|
|
Loading…
Reference in a new issue