debian-mirror-gitlab/spec/views/projects/pipelines/show.html.haml_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.8 KiB
Ruby
Raw Normal View History

2020-10-24 23:57:45 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-05-27 22:25:52 +05:30
RSpec.describe 'projects/pipelines/show', feature_category: :pipeline_composition do
2020-10-24 23:57:45 +05:30
include Devise::Test::ControllerHelpers
let_it_be(:project) { create(:project, :repository) }
let_it_be(:user) { create(:user) }
2021-09-30 23:02:18 +05:30
2020-10-24 23:57:45 +05:30
let(:pipeline) { create(:ci_pipeline, project: project) }
let(:presented_pipeline) { pipeline.present(current_user: user) }
before do
assign(:project, project)
assign(:pipeline, presented_pipeline)
2023-05-27 22:25:52 +05:30
allow(view).to receive(:current_user) { user }
2020-10-24 23:57:45 +05:30
end
context 'when pipeline has errors' do
before do
allow(pipeline).to receive(:yaml_errors).and_return('some errors')
end
it 'shows errors' do
render
2023-03-04 22:38:38 +05:30
expect(rendered).to have_content('Unable to create pipeline')
2020-10-24 23:57:45 +05:30
expect(rendered).to have_content('some errors')
end
it 'does not render the pipeline tabs' do
render
2023-03-04 22:38:38 +05:30
expect(rendered).not_to have_selector('#js-pipeline-tabs')
2020-10-24 23:57:45 +05:30
end
2023-05-27 22:25:52 +05:30
it 'renders the pipeline editor button with correct link for users who can view' do
project.add_developer(user)
render
expect(rendered).to have_link s_('Go to the pipeline editor'),
href: project_ci_pipeline_editor_path(project)
end
it 'renders the pipeline editor button with correct link for users who can not view' do
render
expect(rendered).not_to have_link s_('Go to the pipeline editor'),
href: project_ci_pipeline_editor_path(project)
end
2020-10-24 23:57:45 +05:30
end
context 'when pipeline is valid' do
it 'does not show errors' do
render
2023-03-04 22:38:38 +05:30
expect(rendered).not_to have_content('Unable to create pipeline')
2020-10-24 23:57:45 +05:30
end
it 'renders the pipeline tabs' do
render
2023-03-04 22:38:38 +05:30
expect(rendered).to have_selector('#js-pipeline-tabs')
2020-10-24 23:57:45 +05:30
end
end
end