Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-20 11:43:02 +0300
commitd9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch)
tree2341ef426af70ad1e289c38036737e04b0aa5007 /spec/views
parentd6e514dd13db8947884cd58fe2a9c2a063400a9b (diff)
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb9
-rw-r--r--spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb17
-rw-r--r--spec/views/projects/branches/index.html.haml_spec.rb43
-rw-r--r--spec/views/projects/commits/_commit.html.haml_spec.rb18
-rw-r--r--spec/views/projects/services/edit.html.haml_spec.rb4
-rw-r--r--spec/views/projects/tags/index.html.haml_spec.rb22
6 files changed, 107 insertions, 6 deletions
diff --git a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb
index 2c37565328a..d4e97d96dfd 100644
--- a/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb
+++ b/spec/views/layouts/nav/sidebar/_admin.html.haml_spec.rb
@@ -58,6 +58,15 @@ RSpec.describe 'layouts/nav/sidebar/_admin' do
it_behaves_like 'page has active sub tab', 'Users'
end
+ context 'on topics' do
+ before do
+ allow(controller).to receive(:controller_name).and_return('admin/topics')
+ end
+
+ it_behaves_like 'page has active tab', 'Overview'
+ it_behaves_like 'page has active sub tab', 'Topics'
+ end
+
context 'on messages' do
before do
allow(controller).to receive(:controller_name).and_return('broadcast_messages')
diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
index adfe1cee6d6..20c5d9992be 100644
--- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
@@ -580,6 +580,23 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
end
+
+ describe 'Google Cloud' do
+ it 'has a link to the google cloud page' do
+ render
+ expect(rendered).to have_link('Google Cloud', href: project_google_cloud_index_path(project))
+ end
+
+ describe 'when the user does not have access' do
+ let(:user) { nil }
+
+ it 'does not have a link to the google cloud page' do
+ render
+
+ expect(rendered).not_to have_link('Google Cloud')
+ end
+ end
+ end
end
describe 'Packages and Registries' do
diff --git a/spec/views/projects/branches/index.html.haml_spec.rb b/spec/views/projects/branches/index.html.haml_spec.rb
new file mode 100644
index 00000000000..9954d9ecaec
--- /dev/null
+++ b/spec/views/projects/branches/index.html.haml_spec.rb
@@ -0,0 +1,43 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'projects/branches/index.html.haml' do
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:repository) { project.repository }
+
+ let(:branches) { repository.branches }
+ let(:active_branch) { branches.find { |b| b.name == 'master' } }
+ let(:stale_branch) { branches.find { |b| b.name == 'feature' } }
+
+ before do
+ assign(:project, project)
+ assign(:repository, repository)
+ assign(:mode, 'overview')
+ assign(:active_branches, [active_branch])
+ assign(:stale_branches, [stale_branch])
+ assign(:overview_max_branches, 5)
+ assign(:branch_pipeline_statuses, {})
+ assign(:refs_pipelines, {})
+ end
+
+ it 'renders list of active and stale branches' do
+ content = render
+
+ expect(content).to include(active_branch.name)
+ expect(content).to include(stale_branch.name)
+ end
+
+ context 'when Gitaly is unavailable' do
+ it 'renders an error' do
+ assign(:gitaly_unavailable, true)
+
+ content = render
+
+ expect(content).to include('Unable to load branches')
+ expect(content).to include(
+ 'The git server, Gitaly, is not available at this time. Please contact your administrator.'
+ )
+ end
+ end
+end
diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb
index abbb3a168c3..ed93240abc1 100644
--- a/spec/views/projects/commits/_commit.html.haml_spec.rb
+++ b/spec/views/projects/commits/_commit.html.haml_spec.rb
@@ -11,6 +11,24 @@ RSpec.describe 'projects/commits/_commit.html.haml' do
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
end
+ context 'with different committer' do
+ let(:ref) { 'master' }
+ let(:committer) { create(:user) }
+
+ it 'renders committed by user' do
+ allow(commit).to receive(:different_committer?).and_return(true)
+ allow(commit).to receive(:committer).and_return(committer)
+
+ render partial: template, locals: {
+ project: project,
+ ref: ref,
+ commit: commit
+ }
+
+ expect(rendered).to have_text("#{committer.name} committed")
+ end
+ end
+
context 'with a signed commit' do
let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA }
diff --git a/spec/views/projects/services/edit.html.haml_spec.rb b/spec/views/projects/services/edit.html.haml_spec.rb
index a5460adbd2c..372ccf82a68 100644
--- a/spec/views/projects/services/edit.html.haml_spec.rb
+++ b/spec/views/projects/services/edit.html.haml_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe 'projects/services/edit' do
it do
render
- expect(rendered).not_to have_text('Recent Deliveries')
+ expect(rendered).not_to have_text('Recent events')
end
context 'integration using WebHooks' do
@@ -25,7 +25,7 @@ RSpec.describe 'projects/services/edit' do
it do
render
- expect(rendered).to have_text('Recent Deliveries')
+ expect(rendered).to have_text('Recent events')
end
end
end
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb
index 2702ab9e2a9..ebd526284d1 100644
--- a/spec/views/projects/tags/index.html.haml_spec.rb
+++ b/spec/views/projects/tags/index.html.haml_spec.rb
@@ -3,10 +3,11 @@
require 'spec_helper'
RSpec.describe 'projects/tags/index.html.haml' do
- let(:project) { create(:project, :repository) }
- let(:tags) { TagsFinder.new(project.repository, {}).execute }
- let(:git_tag) { project.repository.tags.last }
- let(:release) { create(:release, project: project, sha: git_tag.target_commit.sha) }
+ let_it_be(:project) { create(:project, :repository) }
+ let_it_be(:tags) { project.repository.tags }
+ let_it_be(:git_tag) { project.repository.tags.last }
+ let_it_be(:release) { create(:release, project: project, sha: git_tag.target_commit.sha) }
+
let(:pipeline) { create(:ci_pipeline, :success, project: project, ref: git_tag.name, sha: release.sha) }
before do
@@ -86,4 +87,17 @@ RSpec.describe 'projects/tags/index.html.haml' do
expect(page.all('.tags .content-list li')).not_to have_css 'svg.s24'
end
end
+
+ context 'when Gitaly is unavailable' do
+ it 'renders an error' do
+ assign(:tags_loading_error, GRPC::Unavailable.new)
+
+ content = render
+
+ expect(content).to include("Unable to load tags")
+ expect(content).to include(
+ "The git server, Gitaly, is not available at this time. Please contact your administrator."
+ )
+ end
+ end
end