summaryrefslogtreecommitdiff
path: root/spec/views
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 21:12:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-06 21:12:16 +0000
commit87598f1576cc7b3e1071a83d70778a51009b853b (patch)
tree42a1e678a3f9abf870d1cc88ecf536375f889b12 /spec/views
parent30e5ae4c2b9c1674dc222e4bde0daa3f9795782e (diff)
downloadgitlab-ce-87598f1576cc7b3e1071a83d70778a51009b853b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/projects/branches/index.html.haml_spec.rb43
1 files changed, 43 insertions, 0 deletions
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