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>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/views
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/views')
-rw-r--r--spec/views/admin/application_settings/_repository_check.html.haml_spec.rb75
-rw-r--r--spec/views/admin/application_settings/general.html.haml_spec.rb29
-rw-r--r--spec/views/layouts/application.html.haml_spec.rb29
-rw-r--r--spec/views/projects/issues/_service_desk_info_content.html.haml_spec.rb2
-rw-r--r--spec/views/projects/settings/integrations/edit.html.haml_spec.rb (renamed from spec/views/projects/services/edit.html.haml_spec.rb)2
-rw-r--r--spec/views/projects/tags/index.html.haml_spec.rb33
-rw-r--r--spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb54
7 files changed, 218 insertions, 6 deletions
diff --git a/spec/views/admin/application_settings/_repository_check.html.haml_spec.rb b/spec/views/admin/application_settings/_repository_check.html.haml_spec.rb
new file mode 100644
index 00000000000..fbabc890a8b
--- /dev/null
+++ b/spec/views/admin/application_settings/_repository_check.html.haml_spec.rb
@@ -0,0 +1,75 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'admin/application_settings/_repository_check.html.haml' do
+ let_it_be(:user) { create(:admin) }
+ let_it_be(:application_setting) { build(:application_setting) }
+
+ before do
+ assign(:application_setting, application_setting)
+ allow(view).to receive(:current_user).and_return(user)
+ end
+
+ describe 'repository checks' do
+ it 'has the setting subsection' do
+ render
+
+ expect(rendered).to have_content('Repository checks')
+ end
+
+ it 'renders the correct setting subsection content' do
+ render
+
+ expect(rendered).to have_field('Enable repository checks')
+ expect(rendered).to have_link(
+ 'Clear all repository checks',
+ href: clear_repository_check_states_admin_application_settings_path
+ )
+ end
+ end
+
+ describe 'housekeeping' do
+ it 'has the setting subsection' do
+ render
+
+ expect(rendered).to have_content('Housekeeping')
+ end
+
+ it 'renders the correct setting subsection content' do
+ render
+
+ expect(rendered).to have_field('Enable automatic repository housekeeping')
+ expect(rendered).to have_field('Incremental repack period')
+ expect(rendered).to have_field('Full repack period')
+ expect(rendered).to have_field('Git GC period')
+ end
+ end
+
+ describe 'inactive project deletion' do
+ let_it_be(:application_setting) do
+ build(:application_setting,
+ delete_inactive_projects: true,
+ inactive_projects_delete_after_months: 2,
+ inactive_projects_min_size_mb: 250,
+ inactive_projects_send_warning_email_after_months: 1
+ )
+ end
+
+ it 'has the setting subsection' do
+ render
+
+ expect(rendered).to have_content('Inactive project deletion')
+ end
+
+ it 'renders the correct setting subsection content' do
+ render
+
+ expect(rendered).to have_selector('.js-inactive-project-deletion-form')
+ expect(rendered).to have_selector('[data-delete-inactive-projects="true"]')
+ expect(rendered).to have_selector('[data-inactive-projects-delete-after-months="2"]')
+ expect(rendered).to have_selector('[data-inactive-projects-min-size-mb="250"]')
+ expect(rendered).to have_selector('[data-inactive-projects-send-warning-email-after-months="1"]')
+ end
+ end
+end
diff --git a/spec/views/admin/application_settings/general.html.haml_spec.rb b/spec/views/admin/application_settings/general.html.haml_spec.rb
index 503e41eabc9..3614090d3cb 100644
--- a/spec/views/admin/application_settings/general.html.haml_spec.rb
+++ b/spec/views/admin/application_settings/general.html.haml_spec.rb
@@ -68,4 +68,33 @@ RSpec.describe 'admin/application_settings/general.html.haml' do
expect(rendered).not_to have_css('#js-add-license-toggle')
end
end
+
+ describe 'jira connect application key' do
+ it 'shows the jira connect application key section' do
+ render
+
+ expect(rendered).to have_css('#js-jira_connect-settings')
+ end
+
+ context 'when the jira_connect_oauth feature flag is disabled' do
+ before do
+ stub_feature_flags(jira_connect_oauth: false)
+ end
+
+ it 'does not show the jira connect application key section' do
+ render
+
+ expect(rendered).not_to have_css('#js-jira_connect-settings')
+ end
+ end
+ end
+
+ describe 'sign-up restrictions' do
+ it 'renders js-signup-form tag' do
+ render
+
+ expect(rendered).to match 'id="js-signup-form"'
+ expect(rendered).to match ' data-minimum-password-length='
+ end
+ end
end
diff --git a/spec/views/layouts/application.html.haml_spec.rb b/spec/views/layouts/application.html.haml_spec.rb
index 679d0b1ff60..0f359219718 100644
--- a/spec/views/layouts/application.html.haml_spec.rb
+++ b/spec/views/layouts/application.html.haml_spec.rb
@@ -14,6 +14,35 @@ RSpec.describe 'layouts/application' do
allow(view).to receive(:current_user_mode).and_return(Gitlab::Auth::CurrentUserMode.new(user))
end
+ describe "visual review toolbar" do
+ context "ENV['REVIEW_APPS_ENABLED'] is set to true" do
+ before do
+ stub_env(
+ 'REVIEW_APPS_ENABLED' => true,
+ 'REVIEW_APPS_MERGE_REQUEST_IID' => '123'
+ )
+ end
+
+ it 'renders the visual review toolbar' do
+ render
+
+ expect(rendered).to include('review-app-toolbar-script')
+ end
+ end
+
+ context "ENV['REVIEW_APPS_ENABLED'] is set to false" do
+ before do
+ stub_env('REVIEW_APPS_ENABLED', false)
+ end
+
+ it 'does not render the visual review toolbar' do
+ render
+
+ expect(rendered).not_to include('review-app-toolbar-script')
+ end
+ end
+ end
+
context 'body data elements for pageview context' do
let(:body_data) do
{
diff --git a/spec/views/projects/issues/_service_desk_info_content.html.haml_spec.rb b/spec/views/projects/issues/_service_desk_info_content.html.haml_spec.rb
index 1c6d729ddce..92ca0bb52d6 100644
--- a/spec/views/projects/issues/_service_desk_info_content.html.haml_spec.rb
+++ b/spec/views/projects/issues/_service_desk_info_content.html.haml_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'projects/issues/_service_desk_info_content' do
+RSpec.describe 'projects/issues/service_desk/_service_desk_info_content' do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let_it_be(:service_desk_address) { 'address@example.com' }
diff --git a/spec/views/projects/services/edit.html.haml_spec.rb b/spec/views/projects/settings/integrations/edit.html.haml_spec.rb
index 372ccf82a68..5f3c45166ef 100644
--- a/spec/views/projects/services/edit.html.haml_spec.rb
+++ b/spec/views/projects/settings/integrations/edit.html.haml_spec.rb
@@ -2,7 +2,7 @@
require 'spec_helper'
-RSpec.describe 'projects/services/edit' do
+RSpec.describe 'projects/settings/integrations/edit' do
let(:integration) { create(:drone_ci_integration, project: project) }
let(:project) { create(:project) }
diff --git a/spec/views/projects/tags/index.html.haml_spec.rb b/spec/views/projects/tags/index.html.haml_spec.rb
index ae59c1aa4b2..aff233b697f 100644
--- a/spec/views/projects/tags/index.html.haml_spec.rb
+++ b/spec/views/projects/tags/index.html.haml_spec.rb
@@ -4,7 +4,6 @@ require 'spec_helper'
RSpec.describe 'projects/tags/index.html.haml' do
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) do
create(:release, project: project,
@@ -25,9 +24,31 @@ RSpec.describe 'projects/tags/index.html.haml' do
allow(view).to receive(:current_user).and_return(project.namespace.owner)
end
- it 'renders links to the Releases page for tags associated with a release' do
- render
- expect(rendered).to have_link(release.name, href: project_releases_path(project, anchor: release.tag))
+ context 'when tag is associated with a release' do
+ context 'when name does not contain a backslash' do
+ it 'renders a link to the release page' do
+ render
+ expect(rendered).to have_link(release.name, href: project_release_path(project, release))
+ end
+ end
+
+ context 'when name contains backslash' do
+ let_it_be(:release) { create(:release, project: project, tag: 'test/v1') }
+
+ before_all do
+ project.repository.add_tag(project.owner, 'test/v1', project.default_branch_or_main)
+ project.repository.expire_tags_cache
+
+ project.releases.reload
+
+ assign(:tags, Kaminari.paginate_array(tags).page(0))
+ end
+
+ it 'renders a link to the release page with backslash escaped' do
+ render
+ expect(rendered).to have_link(release.name, href: project_release_path(project, release))
+ end
+ end
end
context 'when the most recent build for a tag has artifacts' do
@@ -104,4 +125,8 @@ RSpec.describe 'projects/tags/index.html.haml' do
)
end
end
+
+ def tags
+ project.repository.tags
+ end
end
diff --git a/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb b/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb
new file mode 100644
index 00000000000..117771d5f30
--- /dev/null
+++ b/spec/views/shared/projects/_inactive_project_deletion_alert.html.haml_spec.rb
@@ -0,0 +1,54 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'shared/projects/_inactive_project_deletion_alert' do
+ let_it_be(:project) { create(:project) }
+
+ let(:text) { 'Due to inactivity, this project is scheduled to be deleted on 2022-04-01. Why is this scheduled?' }
+
+ shared_examples 'does not render' do
+ before do
+ render
+ end
+
+ it { expect(rendered).not_to have_content(text) }
+ end
+
+ before do
+ allow(view).to receive(:inactive_project_deletion_date).with(project).and_return('2022-04-01')
+ end
+
+ context 'without a project' do
+ before do
+ assign(:project, nil)
+ end
+
+ it_behaves_like 'does not render'
+ end
+
+ context 'with a project' do
+ before do
+ assign(:project, project)
+ allow(view).to receive(:show_inactive_project_deletion_banner?).and_return(inactive)
+ end
+
+ context 'when the project is active' do
+ let(:inactive) { false }
+
+ it_behaves_like 'does not render'
+ end
+
+ context 'when the project is inactive' do
+ let(:inactive) { true }
+
+ before do
+ render
+ end
+
+ it 'does render the alert' do
+ expect(rendered).to have_content(text)
+ end
+ end
+ end
+end