summaryrefslogtreecommitdiff
path: root/spec/views/projects/_home_panel.html.haml_spec.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /spec/views/projects/_home_panel.html.haml_spec.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-15.7.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'spec/views/projects/_home_panel.html.haml_spec.rb')
-rw-r--r--spec/views/projects/_home_panel.html.haml_spec.rb36
1 files changed, 32 insertions, 4 deletions
diff --git a/spec/views/projects/_home_panel.html.haml_spec.rb b/spec/views/projects/_home_panel.html.haml_spec.rb
index 78131937d3c..6f6a2d9a04d 100644
--- a/spec/views/projects/_home_panel.html.haml_spec.rb
+++ b/spec/views/projects/_home_panel.html.haml_spec.rb
@@ -190,22 +190,50 @@ RSpec.describe 'projects/_home_panel' do
end
context 'user can read fork source' do
- it 'shows the forked-from project' do
+ before do
allow(view).to receive(:can?).with(user, :read_project, source_project).and_return(true)
+ end
+ it 'does not show the forked-from project' do
render
- expect(rendered).to have_content("Forked from #{source_project.full_name}")
+ expect(rendered).not_to have_content("Forked from #{source_project.full_name}")
+ end
+
+ context 'when fork_divergence_counts is disabled' do
+ before do
+ stub_feature_flags(fork_divergence_counts: false)
+ end
+
+ it 'shows the forked-from project' do
+ render
+
+ expect(rendered).to have_content("Forked from #{source_project.full_name}")
+ end
end
end
context 'user cannot read fork source' do
- it 'does not show the forked-from project' do
+ before do
allow(view).to receive(:can?).with(user, :read_project, source_project).and_return(false)
+ end
+ it 'shows the message that forked project is inaccessible' do
render
- expect(rendered).to have_content("Forked from an inaccessible project")
+ expect(rendered).not_to have_content("Forked from an inaccessible project")
+ end
+
+ context 'when fork_divergence_counts is disabled' do
+ before do
+ stub_feature_flags(fork_divergence_counts: false)
+ end
+
+ it 'shows the message that forked project is inaccessible' do
+ render
+
+ expect(rendered).to have_content("Forked from an inaccessible project")
+ end
end
end
end