Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Merge branch 'dev' into epic/49688-custom-set-of-project-attributes-grouped-in-sections

Dombi Attila89ce735d23c7
diff --cc app/components/open_project/common/attribute_component.rb
index 12d1584a7b6,e77a2f9892b..1182707b70a
--- a/app/components/open_project/common/attribute_component.rb
+++ b/app/components/open_project/common/attribute_component.rb
@@@ -25,7 -25,7 +25,7 @@@
#
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'nokogiri'
++require "nokogiri"
module OpenProject
module Common
@@@ -34,7 -34,7 +34,7 @@@
:name,
:description
-- PARAGRAPH_CSS_CLASS = 'op-uc-p'.freeze
++ PARAGRAPH_CSS_CLASS = "op-uc-p".freeze
def initialize(id, name, description, **args)
super
@@@ -67,20 -67,28 +67,28 @@@
private
def first_paragraph
- @first_paragraph ||= text_ast
- .xpath('html/body')
- .children
- .first
- .inner_html
- .html_safe # rubocop:disable Rails/OutputSafety
+ @first_paragraph ||= if body_children.any?
+ body_children
+ .first
+ .inner_html
+ .html_safe # rubocop:disable Rails/OutputSafety
+ else
- ''
++ ""
+ end
end
def text_ast
@text_ast ||= Nokogiri::HTML(full_text)
end
+ def body_children
+ text_ast
- .xpath('html/body')
++ .xpath("html/body")
+ .children
+ end
+
def multi_type?
-- first_paragraph.include?('figure') || first_paragraph.include?('macro')
++ first_paragraph.include?("figure") || first_paragraph.include?("macro")
end
end
end
diff --cc config/initializers/menus.rb
index ca8688768be,ec7662bd482..2e1af183876
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@@ -330,42 -330,24 +330,42 @@@ Redmine::MenuManager.map :admin_menu d
caption: Proc.new { Workflow.model_name.human },
parent: :admin_work_packages
+ menu.push :admin_projects_settings,
+ { controller: '/admin/settings/project_custom_fields', action: :index },
+ if: Proc.new { User.current.admin? },
+ caption: :label_project_plural,
+ icon: 'projects'
+
+ menu.push :project_custom_fields_settings,
+ { controller: '/admin/settings/project_custom_fields', action: :index },
+ if: Proc.new { User.current.admin? },
+ caption: :label_project_attributes_plural,
+ parent: :admin_projects_settings
+
+ menu.push :projects_settings,
+ { controller: '/admin/settings/projects_settings', action: :show },
+ if: Proc.new { User.current.admin? },
+ caption: :label_setting_plural,
+ parent: :admin_projects_settings
+
menu.push :custom_fields,
- { controller: '/custom_fields' },
+ { controller: "/custom_fields" },
if: Proc.new { User.current.admin? },
caption: :label_custom_field_plural,
- icon: 'custom-fields',
- html: { class: 'custom_fields' }
+ icon: "custom-fields",
+ html: { class: "custom_fields" }
menu.push :custom_actions,
- { controller: '/custom_actions' },
+ { controller: "/custom_actions" },
if: Proc.new { User.current.admin? },
- caption: :'custom_actions.plural',
+ caption: :"custom_actions.plural",
parent: :admin_work_packages,
- enterprise_feature: 'custom_actions'
+ enterprise_feature: "custom_actions"
menu.push :attribute_help_texts,
- { controller: '/attribute_help_texts' },
- caption: :'attribute_help_texts.label_plural',
- icon: 'help2',
+ { controller: "/attribute_help_texts" },
+ caption: :"attribute_help_texts.label_plural",
+ icon: "help2",
if: Proc.new { User.current.allowed_globally?(:edit_attribute_help_texts) }
menu.push :attachments,
@@@ -636,15 -618,14 +636,15 @@@ Redmine::MenuManager.map :project_menu
caption: :label_member_plural
menu.push :settings,
- { controller: '/projects/settings/general', action: :show },
+ { controller: "/projects/settings/general", action: :show },
caption: :label_project_settings,
last: true,
- icon: 'settings2',
+ icon: "settings2",
allow_deeplink: true
- {
+ project_menu_items = {
general: :label_information_plural,
+ project_custom_fields: :label_project_attributes_plural,
modules: :label_module_plural,
types: :label_work_package_types,
custom_fields: :label_custom_field_plural,
@@@ -653,11 -634,9 +653,11 @@@
repository: :label_repository,
time_entry_activities: :enumeration_activities,
storage: :label_required_disk_storage
- }.each do |key, caption|
+ }
+
+ project_menu_items.each do |key, caption|
menu.push :"settings_#{key}",
- { controller: "/projects/settings/#{key}", action: 'show' },
+ { controller: "/projects/settings/#{key}", action: "show" },
caption:,
parent: :settings
end
diff --cc config/routes.rb
index 15bf02d6dc8,89c4963a26d..bdf07d65f68
--- a/config/routes.rb
+++ b/config/routes.rb
@@@ -185,30 -185,21 +185,30 @@@ Rails.application.routes.draw d
end
resources :projects, except: %i[show edit create update] do
- scope module: 'projects' do
- namespace 'settings' do
- resource :general, only: %i[show], controller: 'general'
+ scope module: "projects" do
+ namespace "settings" do
+ resource :general, only: %i[show], controller: "general"
resource :modules, only: %i[show update]
resource :types, only: %i[show update]
+ resource :project_custom_fields, only: %i[show] do
+ member do
+ post :toggle
+ end
+ collection do
+ put :enable_all_of_section
+ put :disable_all_of_section
+ end
+ end
resource :custom_fields, only: %i[show update]
- resource :repository, only: %i[show], controller: 'repository'
+ resource :repository, only: %i[show], controller: "repository"
resource :versions, only: %i[show]
resource :categories, only: %i[show update]
- resource :storage, only: %i[show], controller: 'storage'
+ resource :storage, only: %i[show], controller: "storage"
end
- resource :templated, only: %i[create destroy], controller: 'templated'
- resource :archive, only: %i[create destroy], controller: 'archive'
- resource :identifier, only: %i[show update], controller: 'identifier'
+ resource :templated, only: %i[create destroy], controller: "templated"
+ resource :archive, only: %i[create destroy], controller: "archive"
+ resource :identifier, only: %i[show update], controller: "identifier"
end
member do
@@@ -439,38 -430,22 +439,38 @@@
end
end
- resource :incoming_mails, controller: '/admin/settings/incoming_mails_settings', only: %i[show update]
- resource :aggregation, controller: '/admin/settings/aggregation_settings', only: %i[show update]
- resource :mail_notifications, controller: '/admin/settings/mail_notifications_settings', only: %i[show update]
- resource :api, controller: '/admin/settings/api_settings', only: %i[show update]
- resource :work_packages, controller: '/admin/settings/work_packages_settings', only: %i[show update]
- resource :projects, controller: '/admin/settings/projects_settings', only: %i[show update]
- resources :project_custom_fields, controller: '/admin/settings/project_custom_fields' do
+ resource :incoming_mails, controller: "/admin/settings/incoming_mails_settings", only: %i[show update]
+ resource :aggregation, controller: "/admin/settings/aggregation_settings", only: %i[show update]
+ resource :mail_notifications, controller: "/admin/settings/mail_notifications_settings", only: %i[show update]
+ resource :api, controller: "/admin/settings/api_settings", only: %i[show update]
+ resource :work_packages, controller: "/admin/settings/work_packages_settings", only: %i[show update]
++ resource :projects, controller: "/admin/settings/projects_settings", only: %i[show update]
++ resources :project_custom_fields, controller: "/admin/settings/project_custom_fields" do
+ member do
+ delete "options/:option_id", action: "delete_option", as: :delete_option_of
+ post :reorder_alphabetical
+ put :move
+ put :drop
+ end
+ end
- resources :project_custom_field_sections, controller: '/admin/settings/project_custom_field_sections',
++ resources :project_custom_field_sections, controller: "/admin/settings/project_custom_field_sections",
+ only: %i[create update destroy] do
+ member do
+ put :move
+ put :drop
+ end
+ end
- resource :working_days, controller: '/admin/settings/working_days_settings', only: %i[show update]
- resource :users, controller: '/admin/settings/users_settings', only: %i[show update]
- resource :date_format, controller: '/admin/settings/date_format_settings', only: %i[show update]
- resource :icalendar, controller: '/admin/settings/icalendar_settings', only: %i[show update]
+ resource :working_days, controller: "/admin/settings/working_days_settings", only: %i[show update]
+ resource :users, controller: "/admin/settings/users_settings", only: %i[show update]
+ resource :date_format, controller: "/admin/settings/date_format_settings", only: %i[show update]
+ resource :icalendar, controller: "/admin/settings/icalendar_settings", only: %i[show update]
# Redirect /settings to general settings
- get '/', to: redirect('/admin/settings/general')
+ get "/", to: redirect("/admin/settings/general")
# Plugin settings
- get 'plugin/:id', action: :show_plugin
- post 'plugin/:id', action: :update_plugin
+ get "plugin/:id", action: :show_plugin
+ post "plugin/:id", action: :update_plugin
end
resources :quarantined_attachments,
diff --cc frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
index b13944a0f9b,316fdfe8c6e..2ed8f9ab325
--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts
@@@ -33,11 -33,11 +33,13 @@@ export class OPContextMenuService
// Allow temporarily disabling the close handler
private isOpening = false;
-- constructor(private componentFactoryResolver:ComponentFactoryResolver,
++ constructor(
++ private componentFactoryResolver:ComponentFactoryResolver,
readonly FocusHelper:FocusHelperService,
private appRef:ApplicationRef,
private $transitions:TransitionService,
-- private injector:Injector) {
++ private injector:Injector,
++ ) {
const hostElement = this.portalHostElement = document.createElement('div');
hostElement.classList.add('op-context-menu--overlay');
document.body.appendChild(hostElement);
diff --cc lib/api/v3/render/render_api.rb
index 1e7f8a7835e,e295fb3ed1c..07a8d337100
--- a/lib/api/v3/render/render_api.rb
+++ b/lib/api/v3/render/render_api.rb
@@@ -35,8 -35,8 +35,8 @@@ module AP
resources :render do
helpers do
- SUPPORTED_CONTEXT_NAMESPACES ||= %w(work_packages projects news posts wiki_pages).freeze
- SUPPORTED_MEDIA_TYPE ||= 'text/plain'.freeze
+ SUPPORTED_CONTEXT_NAMESPACES ||= %w(work_packages projects news posts wiki_pages meeting_contents).freeze
- SUPPORTED_MEDIA_TYPE ||= 'text/plain'.freeze
++ SUPPORTED_MEDIA_TYPE ||= "text/plain".freeze
def allowed_content_types
[SUPPORTED_MEDIA_TYPE]
@@@ -46,8 -46,8 +46,8 @@@
actual = request.content_type
unless actual&.starts_with?(SUPPORTED_MEDIA_TYPE)
-- bad_type = actual || I18n.t('api_v3.errors.missing_content_type')
-- message = I18n.t('api_v3.errors.invalid_content_type',
++ bad_type = actual || I18n.t("api_v3.errors.missing_content_type")
++ message = I18n.t("api_v3.errors.invalid_content_type",
content_type: SUPPORTED_MEDIA_TYPE,
actual: bad_type)
@@@ -57,24 -57,24 +57,24 @@@
def check_format(format)
unless ::OpenProject::TextFormatting::Formats.supported?(format)
-- fail ::API::Errors::NotFound, I18n.t('api_v3.errors.code_404')
++ fail ::API::Errors::NotFound, I18n.t("api_v3.errors.code_404")
end
end
def setup_response
status 200
-- content_type 'text/html'
++ content_type "text/html"
end
def request_body
-- env['api.request.body']
++ env["api.request.body"]
end
def context_object
try_context_object
rescue ::ActiveRecord::RecordNotFound
fail ::API::Errors::InvalidRenderContext.new(
-- I18n.t('api_v3.errors.render.context_object_not_found')
++ I18n.t("api_v3.errors.render.context_object_not_found")
)
end
@@@ -83,9 -83,9 +83,9 @@@
context = parse_context
namespace = context[:namespace]
-- klass = if namespace == 'posts'
++ klass = if namespace == "posts"
Message
-- elsif SUPPORTED_CONTEXT_NAMESPACES.without('posts').include?(namespace)
++ elsif SUPPORTED_CONTEXT_NAMESPACES.without("posts").include?(namespace)
namespace.camelcase.singularize.constantize
end
@@@ -100,12 -100,12 +100,12 @@@
if context.nil?
fail ::API::Errors::InvalidRenderContext.new(
-- I18n.t('api_v3.errors.render.context_not_parsable')
++ I18n.t("api_v3.errors.render.context_not_parsable")
)
-- elsif !SUPPORTED_CONTEXT_NAMESPACES.include?(context[:namespace]) ||
-- context[:version] != '3'
++ elsif SUPPORTED_CONTEXT_NAMESPACES.exclude?(context[:namespace]) ||
++ context[:version] != "3"
fail ::API::Errors::InvalidRenderContext.new(
-- I18n.t('api_v3.errors.render.unsupported_context')
++ I18n.t("api_v3.errors.render.unsupported_context")
)
else
context
diff --cc lib/open_project/static/links.rb
index 60101679213,c89d47ff0ec..50d40a70cd4
--- a/lib/open_project/static/links.rb
+++ b/lib/open_project/static/links.rb
@@@ -54,7 -58,7 +58,7 @@@ module OpenProjec
dynamic = {
help: {
href: help_link,
-- label: 'top_menu.help_and_support'
++ label: "top_menu.help_and_support"
}
}
@@@ -71,212 -75,215 +75,215 @@@
def static_links
{
upsale: {
-- href: 'https://www.openproject.org/enterprise-edition',
-- label: 'homescreen.links.upgrade_enterprise_edition'
++ href: "https://www.openproject.org/enterprise-edition",
++ label: "homescreen.links.upgrade_enterprise_edition"
},
upsale_benefits_features: {
-- href: 'https://www.openproject.org/enterprise-edition/#premium-features',
-- label: 'noscript_learn_more'
++ href: "https://www.openproject.org/enterprise-edition/#premium-features",
++ label: "noscript_learn_more"
},
upsale_benefits_installation: {
-- href: 'https://www.openproject.org/enterprise-edition/#installation',
-- label: 'noscript_learn_more'
++ href: "https://www.openproject.org/enterprise-edition/#installation",
++ label: "noscript_learn_more"
},
upsale_benefits_security: {
-- href: 'https://www.openproject.org/enterprise-edition/#security-features',
-- label: 'noscript_learn_more'
++ href: "https://www.openproject.org/enterprise-edition/#security-features",
++ label: "noscript_learn_more"
},
upsale_benefits_support: {
-- href: 'https://www.openproject.org/enterprise-edition/#professional-support',
-- label: 'noscript_learn_more'
++ href: "https://www.openproject.org/enterprise-edition/#professional-support",
++ label: "noscript_learn_more"
},
upsale_get_quote: {
-- href: 'https://www.openproject.org/request-quote/',
-- label: 'admin.enterprise.get_quote'
++ href: "https://www.openproject.org/request-quote/",
++ label: "admin.enterprise.get_quote"
},
user_guides: {
-- href: 'https://www.openproject.org/docs/user-guide/',
-- label: 'homescreen.links.user_guides'
++ href: "https://www.openproject.org/docs/user-guide/",
++ label: "homescreen.links.user_guides"
},
installation_guides: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/installation/',
++ href: "https://www.openproject.org/docs/installation-and-operations/installation/",
label: :label_installation_guides
},
packager_installation: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/installation/packaged/',
-- label: 'Packaged installation'
++ href: "https://www.openproject.org/docs/installation-and-operations/installation/packaged/",
++ label: "Packaged installation"
},
docker_installation: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/installation/docker/',
-- label: 'Docker installation'
++ href: "https://www.openproject.org/docs/installation-and-operations/installation/docker/",
++ label: "Docker installation"
},
manual_installation: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/installation/manual/',
-- label: 'Manual installation'
++ href: "https://www.openproject.org/docs/installation-and-operations/installation/manual/",
++ label: "Manual installation"
},
upgrade_guides: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/operation/upgrading/',
++ href: "https://www.openproject.org/docs/installation-and-operations/operation/upgrading/",
label: :label_upgrade_guides
},
postgres_migration: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/misc/packaged-postgresql-migration/',
-- label: :'homescreen.links.postgres_migration'
++ href: "https://www.openproject.org/docs/installation-and-operations/misc/packaged-postgresql-migration/",
++ label: :"homescreen.links.postgres_migration"
},
postgres_13_upgrade: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/misc/migration-to-postgresql13/'
++ href: "https://www.openproject.org/docs/installation-and-operations/misc/migration-to-postgresql13/"
},
configuration_guide: {
-- href: 'https://www.openproject.org/docs/installation-and-operations/configuration/',
-- label: 'links.configuration_guide'
++ href: "https://www.openproject.org/docs/installation-and-operations/configuration/",
++ label: "links.configuration_guide"
},
contact: {
-- href: 'https://www.openproject.org/contact/',
-- label: 'links.get_in_touch'
++ href: "https://www.openproject.org/contact/",
++ label: "links.get_in_touch"
},
glossary: {
-- href: 'https://www.openproject.org/docs/glossary/',
-- label: 'homescreen.links.glossary'
++ href: "https://www.openproject.org/docs/glossary/",
++ label: "homescreen.links.glossary"
},
shortcuts: {
-- href: 'https://www.openproject.org/docs/user-guide/keyboard-shortcuts-access-keys/',
-- label: 'homescreen.links.shortcuts'
++ href: "https://www.openproject.org/docs/user-guide/keyboard-shortcuts-access-keys/",
++ label: "homescreen.links.shortcuts"
},
forums: {
-- href: 'https://community.openproject.org/projects/openproject/forums',
-- label: 'homescreen.links.forums'
++ href: "https://community.openproject.org/projects/openproject/forums",
++ label: "homescreen.links.forums"
},
enterprise_support_as_community: {
-- href: 'https://www.openproject.org/pricing/#support',
++ href: "https://www.openproject.org/pricing/#support",
label: :label_enterprise_support
},
enterprise_support: {
-- href: 'https://www.openproject.org/docs/enterprise-guide/support/',
++ href: "https://www.openproject.org/docs/enterprise-guide/support/",
label: :label_enterprise_support
},
website: {
-- href: 'https://www.openproject.org',
-- label: 'label_openproject_website'
++ href: "https://www.openproject.org",
++ label: "label_openproject_website"
},
newsletter: {
-- href: 'https://www.openproject.org/newsletter',
-- label: 'homescreen.links.newsletter'
++ href: "https://www.openproject.org/newsletter",
++ label: "homescreen.links.newsletter"
},
blog: {
-- href: 'https://www.openproject.org/blog',
-- label: 'homescreen.links.blog'
++ href: "https://www.openproject.org/blog",
++ label: "homescreen.links.blog"
},
release_notes: {
-- href: 'https://www.openproject.org/docs/release-notes/',
++ href: "https://www.openproject.org/docs/release-notes/",
label: :label_release_notes
},
data_privacy: {
-- href: 'https://www.openproject.org/legal/privacy/',
++ href: "https://www.openproject.org/legal/privacy/",
label: :label_privacy_policy
},
digital_accessibility: {
-- href: 'https://www.openproject.org/de/rechtliches/erklaerung-zur-digitalen-barrierefreiheit/',
++ href: "https://www.openproject.org/de/rechtliches/erklaerung-zur-digitalen-barrierefreiheit/",
label: :label_digital_accessibility
},
report_bug: {
-- href: 'https://www.openproject.org/docs/development/report-a-bug/',
++ href: "https://www.openproject.org/docs/development/report-a-bug/",
label: :label_report_bug
},
roadmap: {
-- href: 'https://community.openproject.org/projects/openproject/roadmap',
++ href: "https://community.openproject.org/projects/openproject/roadmap",
label: :label_development_roadmap
},
crowdin: {
-- href: 'https://www.openproject.org/docs/development/translate-openproject/',
++ href: "https://www.openproject.org/docs/development/translate-openproject/",
label: :label_add_edit_translations
},
api_docs: {
-- href: 'https://www.openproject.org/docs/api/',
++ href: "https://www.openproject.org/docs/api/",
label: :label_api_doc
},
text_formatting: {
-- href: 'https://www.openproject.org/docs/user-guide/wysiwyg/',
++ href: "https://www.openproject.org/docs/user-guide/wysiwyg/",
label: :setting_text_formatting
},
oauth_authorization_code_flow: {
-- href: 'https://oauth.net/2/grant-types/authorization-code/',
-- label: 'oauth.flows.authorization_code'
++ href: "https://oauth.net/2/grant-types/authorization-code/",
++ label: "oauth.flows.authorization_code"
},
client_credentials_code_flow: {
-- href: 'https://oauth.net/2/grant-types/client-credentials/',
-- label: 'oauth.flows.client_credentials'
++ href: "https://oauth.net/2/grant-types/client-credentials/",
++ label: "oauth.flows.client_credentials"
},
ldap_encryption_documentation: {
-- href: 'https://www.rubydoc.info/gems/net-ldap/Net/LDAP#constructor_details'
++ href: "https://www.rubydoc.info/gems/net-ldap/Net/LDAP#constructor_details"
},
origin_mdn_documentation: {
-- href: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin'
++ href: "https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin"
},
security_badge_documentation: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/information/#security-badge'
++ href: "https://www.openproject.org/docs/system-admin-guide/information/#security-badge"
},
date_format_settings_documentation: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/calendars-and-dates/#date-format'
++ href: "https://www.openproject.org/docs/system-admin-guide/calendars-and-dates/#date-format"
},
chargebee: {
-- href: 'https://js.chargebee.com/v2/chargebee.js'
++ href: "https://js.chargebee.com/v2/chargebee.js"
},
webinar_videos: {
-- href: 'https://www.youtube.com/watch?v=un6zCm8_FT4'
++ href: "https://www.youtube.com/watch?v=un6zCm8_FT4"
},
get_started_videos: {
-- href: 'https://www.youtube.com/playlist?list=PLGzJ4gG7hPb8WWOWmeXqlfMfhdXReu-RJ'
++ href: "https://www.youtube.com/playlist?list=PLGzJ4gG7hPb8WWOWmeXqlfMfhdXReu-RJ"
},
openproject_docs: {
-- href: 'https://www.openproject.org/docs/'
++ href: "https://www.openproject.org/docs/"
},
contact_us: {
-- href: 'https://www.openproject.org/contact/'
++ href: "https://www.openproject.org/contact/"
},
pricing: {
-- href: 'https://www.openproject.org/pricing/'
++ href: "https://www.openproject.org/pricing/"
},
enterprise_docs: {
form_configuration: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/manage-work-packages/work-package-types/#work-package-form-configuration-enterprise-add-on'
++ href: "https://www.openproject.org/docs/system-admin-guide/manage-work-packages/work-package-types/#work-package-form-configuration-enterprise-add-on"
},
attribute_highlighting: {
-- href: 'https://www.openproject.org/docs/user-guide/work-packages/work-package-table-configuration/#attribute-highlighting-enterprise-add-on'
++ href: "https://www.openproject.org/docs/user-guide/work-packages/work-package-table-configuration/#attribute-highlighting-enterprise-add-on"
},
boards: {
-- href: 'https://www.openproject.org/docs/user-guide/agile-boards/#action-boards-enterprise-add-on'
++ href: "https://www.openproject.org/docs/user-guide/agile-boards/#action-boards-enterprise-add-on"
},
custom_field_projects: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/custom-fields/custom-fields-projects/'
++ href: "https://www.openproject.org/docs/system-admin-guide/custom-fields/custom-fields-projects/"
},
custom_field_multiselect: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/custom-fields/#create-a-multi-select-custom-field'
++ href: "https://www.openproject.org/docs/system-admin-guide/custom-fields/#create-a-multi-select-custom-field"
},
status_read_only: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/manage-work-packages/work-package-status/#create-a-new-work-package-status'
++ href: "https://www.openproject.org/docs/system-admin-guide/manage-work-packages/work-package-status/#create-a-new-work-package-status"
}
},
storage_docs: {
setup: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/integrations/storage/'
++ href: "https://www.openproject.org/docs/system-admin-guide/integrations/storage/"
},
nextcloud_setup: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/integrations/nextcloud/'
++ href: "https://www.openproject.org/docs/system-admin-guide/integrations/nextcloud/"
},
one_drive_setup: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/'
++ href: "https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/"
},
one_drive_drive_id_guide: {
-- href: 'https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/drive-guide/'
++ href: "https://www.openproject.org/docs/system-admin-guide/integrations/one-drive/drive-guide/"
},
nextcloud_oauth_application: {
-- href: 'https://apps.nextcloud.com/apps/integration_openproject'
++ href: "https://apps.nextcloud.com/apps/integration_openproject"
},
one_drive_oauth_application: {
-- href: 'https://portal.azure.com/'
++ href: "https://portal.azure.com/"
}
},
ical_docs: {
-- href: 'https://www.openproject.org/docs/user-guide/calendar/#subscribe-to-a-calendar'
++ href: "https://www.openproject.org/docs/user-guide/calendar/#subscribe-to-a-calendar"
+ },
+ integrations: {
- href: 'https://www.openproject.org/docs/system-admin-guide/integrations/'
++ href: "https://www.openproject.org/docs/system-admin-guide/integrations/"
}
}
end
diff --cc modules/meeting/spec/features/meetings_attachments_spec.rb
index e1ed93526f3,e628b662d8e..629b5198470
--- a/modules/meeting/spec/features/meetings_attachments_spec.rb
+++ b/modules/meeting/spec/features/meetings_attachments_spec.rb
@@@ -1,7 -1,7 +1,7 @@@
--require 'spec_helper'
--require 'features/page_objects/notification'
++require "spec_helper"
++require "features/page_objects/notification"
--RSpec.describe 'Add an attachment to a meeting (agenda)', :js, with_cuprite: false do
++RSpec.describe "Add an attachment to a meeting (agenda)", :js, with_cuprite: false do
let(:role) do
create(:project_role, permissions: %i[view_meetings edit_meetings create_meeting_agendas])
end
@@@ -22,7 -22,7 +22,7 @@@
end
let(:attachments) { Components::Attachments.new }
-- let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }
++ let(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") }
let(:editor) { Components::WysiwygEditor.new }
let(:attachments_list) { Components::AttachmentsList.new }
@@@ -36,27 -36,27 +36,27 @@@
end
end
-- describe 'wysiwyg editor' do
-- context 'if on an existing page' do
-- it 'can upload an image via drag & drop' do
-- find('.ck-content')
++ describe "wysiwyg editor" do
++ context "if on an existing page" do
++ it "can upload an image via drag & drop" do
++ find(".ck-content")
- editor.expect_button 'Insert image'
- editor.expect_button 'Upload image from computer'
++ editor.expect_button "Upload image from computer"
-- editor.drag_attachment image_fixture.path, 'Some image caption'
++ editor.drag_attachment image_fixture.path, "Some image caption"
click_on "Save"
-- content = find_test_selector('op-meeting--meeting_agenda')
++ content = find_test_selector("op-meeting--meeting_agenda")
-- expect(content).to have_css('img')
-- expect(content).to have_content('Some image caption')
++ expect(content).to have_css("img")
++ expect(content).to have_content("Some image caption")
end
end
end
-- describe 'attachment dropzone' do
-- it 'can upload an image via attaching and drag & drop' do
++ describe "attachment dropzone" do
++ it "can upload an image via attaching and drag & drop" do
editor.wait_until_loaded
attachments_list.wait_until_visible
@@@ -65,14 -65,14 +65,14 @@@
editor.attachments_list.expect_empty
attachments.attach_file_on_input(image_fixture.path)
editor.wait_until_upload_progress_toaster_cleared
-- editor.attachments_list.expect_attached('image.png')
++ editor.attachments_list.expect_attached("image.png")
##
# and via drag & drop
editor.attachments_list.drag_enter
editor.attachments_list.drop(image_fixture)
editor.wait_until_upload_progress_toaster_cleared
-- editor.attachments_list.expect_attached('image.png', count: 2)
++ editor.attachments_list.expect_attached("image.png", count: 2)
end
end
end
diff --cc modules/storages/spec/factories/storage_factory.rb
index 7aab75d834b,963a91a3e14..bcce415cdc6
--- a/modules/storages/spec/factories/storage_factory.rb
+++ b/modules/storages/spec/factories/storage_factory.rb
@@@ -29,7 -29,7 +29,7 @@@
#++
FactoryBot.define do
-- factory :storage, class: 'Storages::Storage' do
++ factory :storage, class: "Storages::Storage" do
sequence(:name) { |n| "Storage #{n}" }
creator factory: :user
@@@ -38,24 -38,11 +38,11 @@@
end
trait :as_generic do
-- provider_type { 'Storages::Storage' }
++ provider_type { "Storages::Storage" }
end
trait :as_generic do
-- provider_type { 'Storages::Storage' }
- end
- end
-
- factory :nextcloud_storage,
- parent: :storage,
- class: '::Storages::NextcloudStorage' do
- provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
- sequence(:host) { |n| "https://host#{n}.example.com" }
-
- trait :as_automatically_managed do
- automatically_managed { true }
- username { 'OpenProject' }
- password { 'Password123' }
++ provider_type { "Storages::Storage" }
end
trait :as_not_automatically_managed do
@@@ -63,34 -50,47 +50,47 @@@
end
trait :as_healthy do
-- health_status { 'healthy' }
++ health_status { "healthy" }
health_reason { nil }
health_changed_at { Time.now.utc }
health_checked_at { Time.now.utc }
end
trait :as_unhealthy do
-- health_status { 'unhealthy' }
-- health_reason { 'error_code | description' }
++ health_status { "unhealthy" }
++ health_reason { "error_code | description" }
health_changed_at { Time.now.utc }
health_checked_at { Time.now.utc }
end
trait :as_unhealthy_long_reason do
-- health_status { 'unhealthy' }
-- health_reason { 'unauthorized | Outbound request not authorized | #<Storages::StorageErrorData:0x0000ffff646ac570>' }
++ health_status { "unhealthy" }
++ health_reason { "unauthorized | Outbound request not authorized | #<Storages::StorageErrorData:0x0000ffff646ac570>" }
health_changed_at { Time.now.utc }
health_checked_at { Time.now.utc }
end
trait :as_pending do
-- health_status { 'pending' }
++ health_status { "pending" }
health_reason { nil }
health_changed_at { Time.now.utc }
health_checked_at { Time.now.utc }
end
end
+ factory :nextcloud_storage,
+ parent: :storage,
- class: '::Storages::NextcloudStorage' do
++ class: "::Storages::NextcloudStorage" do
+ provider_type { Storages::Storage::PROVIDER_TYPE_NEXTCLOUD }
+ sequence(:host) { |n| "https://host#{n}.example.com" }
+
+ trait :as_automatically_managed do
+ automatically_managed { true }
- username { 'OpenProject' }
- password { 'Password123' }
++ username { "OpenProject" }
++ password { "Password123" }
+ end
+ end
+
factory :nextcloud_storage_configured, parent: :nextcloud_storage do
after(:create) do |storage, _evaluator|
create(:oauth_client, integration: storage)
@@@ -105,8 -105,8 +105,8 @@@
oauth_client_token_user { association :user }
end
-- name { 'Nextcloud Local' }
-- host { 'https://nextcloud.local' }
++ name { "Nextcloud Local" }
++ host { "https://nextcloud.local" }
initialize_with do
Storages::NextcloudStorage.create_or_find_by(attributes.except(:oauth_client, :oauth_application))
@@@ -114,27 -114,27 +114,27 @@@
after(:create) do |storage, evaluator|
create(:oauth_client,
-- client_id: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID', 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID'),
-- client_secret: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET', 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET'),
++ client_id: ENV.fetch("NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID", "MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ID"),
++ client_secret: ENV.fetch("NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET", "MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_SECRET"),
integration: storage)
create(:oauth_application,
-- uid: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_UID', 'MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_UID'),
-- secret: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_SECRET', 'MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_SECRET'),
-- redirect_uri: ENV.fetch('NEXTCLOUD_LOCAL_OPENPROJECT_REDIRECT_URI',
++ uid: ENV.fetch("NEXTCLOUD_LOCAL_OPENPROJECT_UID", "MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_UID"),
++ secret: ENV.fetch("NEXTCLOUD_LOCAL_OPENPROJECT_SECRET", "MISSING_NEXTCLOUD_LOCAL_OPENPROJECT_SECRET"),
++ redirect_uri: ENV.fetch("NEXTCLOUD_LOCAL_OPENPROJECT_REDIRECT_URI",
"https://nextcloud.local/index.php/apps/integration_openproject/oauth-redirect"),
-- scopes: 'api_v3',
++ scopes: "api_v3",
integration: storage)
create(:oauth_client_token,
oauth_client: storage.oauth_client,
user: evaluator.oauth_client_token_user,
-- access_token: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN',
-- 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN'),
-- refresh_token: ENV.fetch('NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN',
-- 'MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN'),
-- token_type: 'bearer',
-- origin_user_id: 'admin')
++ access_token: ENV.fetch("NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN",
++ "MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_ACCESS_TOKEN"),
++ refresh_token: ENV.fetch("NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN",
++ "MISSING_NEXTCLOUD_LOCAL_OAUTH_CLIENT_REFRESH_TOKEN"),
++ token_type: "bearer",
++ origin_user_id: "admin")
end
end
@@@ -151,7 -151,7 +151,7 @@@
factory :one_drive_storage,
parent: :storage,
-- class: '::Storages::OneDriveStorage' do
++ class: "::Storages::OneDriveStorage" do
host { nil }
tenant_id { SecureRandom.uuid }
drive_id { SecureRandom.uuid }
@@@ -163,26 -167,26 +167,26 @@@
oauth_client_token_user { association :user }
end
-- name { 'Sharepoint VCR drive' }
-- tenant_id { ENV.fetch('ONE_DRIVE_TEST_TENANT_ID', '4d44bf36-9b56-45c0-8807-bbf386dd047f') }
-- drive_id { ENV.fetch('ONE_DRIVE_TEST_DRIVE_ID', 'b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs') }
++ name { "Sharepoint VCR drive" }
++ tenant_id { ENV.fetch("ONE_DRIVE_TEST_TENANT_ID", "4d44bf36-9b56-45c0-8807-bbf386dd047f") }
++ drive_id { ENV.fetch("ONE_DRIVE_TEST_DRIVE_ID", "b!dmVLG22QlE2PSW0AqVB7UOhZ8n7tjkVGkgqLNnuw2OBb-brzKzZAR4DYT1k9KPXs") }
after(:create) do |storage, evaluator|
create(:oauth_client,
-- client_id: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_ID', 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ID'),
-- client_secret: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET',
-- 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET'),
++ client_id: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_ID", "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ID"),
++ client_secret: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET",
++ "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_SECRET"),
integration: storage)
create(:oauth_client_token,
oauth_client: storage.oauth_client,
user: evaluator.oauth_client_token_user,
-- access_token: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN',
-- 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN'),
-- refresh_token: ENV.fetch('ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN',
-- 'MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN'),
-- token_type: 'bearer',
-- origin_user_id: '33db2c84-275d-46af-afb0-c26eb786b194')
++ access_token: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN",
++ "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_ACCESS_TOKEN"),
++ refresh_token: ENV.fetch("ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN",
++ "MISSING_ONE_DRIVE_TEST_OAUTH_CLIENT_REFRESH_TOKEN"),
++ token_type: "bearer",
++ origin_user_id: "33db2c84-275d-46af-afb0-c26eb786b194")
end
end
end
diff --cc modules/storages/spec/features/storages/admin/edit_storage_spec.rb
index cc1a7de8142,bd50ffc4765..bbe471e671a
--- a/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
+++ b/modules/storages/spec/features/storages/admin/edit_storage_spec.rb
@@@ -28,43 -28,43 +28,43 @@@
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'spec_helper'
++require "spec_helper"
require_module_spec_helper
--RSpec.describe 'Admin Edit File storage',
++RSpec.describe "Admin Edit File storage",
:js,
:storage_server_helpers do
-- shared_let(:admin) { create(:admin, preferences: { time_zone: 'Etc/UTC' }) }
++ shared_let(:admin) { create(:admin, preferences: { time_zone: "Etc/UTC" }) }
current_user { admin }
-- it 'renders a danger zone for deletion' do
++ it "renders a danger zone for deletion" do
storage = create(:nextcloud_storage, name: "Foo Nextcloud")
visit edit_admin_settings_storage_path(storage)
-- within_test_selector('page-header-actions') do
-- click_on 'Delete'
++ within_test_selector("page-header-actions") do
++ click_on "Delete"
end
expect(page).to have_text("DELETE FILE STORAGE")
expect(page).to have_current_path("#{confirm_destroy_admin_settings_storage_path(storage)}?utf8=%E2%9C%93")
-- storage_delete_button = page.find_button('Delete', disabled: true)
++ storage_delete_button = page.find_button("Delete", disabled: true)
-- fill_in('delete_confirmation', with: 'Foo Nextcloud')
++ fill_in("delete_confirmation", with: "Foo Nextcloud")
expect(storage_delete_button).not_to be_disabled
storage_delete_button.click
expect(page).to have_no_text("Foo Nextcloud")
-- expect(page).to have_text('Successful deletion.')
++ expect(page).to have_text("Successful deletion.")
expect(page).to have_current_path(admin_settings_storages_path)
end
-- context 'with Nextcloud Storage' do
-- let(:storage) { create(:nextcloud_storage, :as_automatically_managed, name: 'Cloud Storage') }
++ context "with Nextcloud Storage" do
++ let(:storage) { create(:nextcloud_storage, :as_automatically_managed, name: "Cloud Storage") }
let(:oauth_application) { create(:oauth_application, integration: storage) }
let(:oauth_client) { create(:oauth_client, integration: storage) }
-- let(:secret) { 'awesome_secret' }
++ let(:secret) { "awesome_secret" }
before do
allow(Doorkeeper::OAuth::Helpers::UniqueToken).to receive(:generate).and_return(secret)
@@@ -72,127 -72,127 +72,127 @@@
oauth_client
end
-- it 'renders an edit view', :webmock do
++ it "renders an edit view", :webmock do
visit edit_admin_settings_storage_path(storage)
expect(page).to be_axe_clean
-- .within('#content')
++ .within("#content")
# NB: Heading order is pending app wide update. See https://community.openproject.org/projects/openproject/work_packages/48513
-- .skipping('heading-order')
++ .skipping("heading-order")
-- expect(page).to have_test_selector('storage-new-page-header--title', text: "Cloud Storage (Nextcloud)")
++ expect(page).to have_test_selector("storage-new-page-header--title", text: "Cloud Storage (Nextcloud)")
-- aggregate_failures 'Storage edit view' do
++ aggregate_failures "Storage edit view" do
# General information
-- expect(page).to have_test_selector('storage-provider-label', text: 'Storage provider')
-- expect(page).to have_test_selector('label-host_name_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-description', text: "Nextcloud - #{storage.name} - #{storage.host}")
++ expect(page).to have_test_selector("storage-provider-label", text: "Storage provider")
++ expect(page).to have_test_selector("label-host_name_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-description", text: "Nextcloud - #{storage.name} - #{storage.host}")
# OAuth application
-- expect(page).to have_test_selector('storage-openproject-oauth-label', text: 'OpenProject OAuth')
-- expect(page).to have_test_selector('label-openproject_oauth_application_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-openproject-oauth-application-description',
++ expect(page).to have_test_selector("storage-openproject-oauth-label", text: "OpenProject OAuth")
++ expect(page).to have_test_selector("label-openproject_oauth_application_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-openproject-oauth-application-description",
text: "OAuth Client ID: #{oauth_application.uid}")
# OAuth client
-- expect(page).to have_test_selector('storage-oauth-client-label', text: 'Nextcloud OAuth')
-- expect(page).to have_test_selector('label-storage_oauth_client_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-oauth-client-id-description',
++ expect(page).to have_test_selector("storage-oauth-client-label", text: "Nextcloud OAuth")
++ expect(page).to have_test_selector("label-storage_oauth_client_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-oauth-client-id-description",
text: "OAuth Client ID: #{oauth_client.client_id}")
# Automatically managed project folders
-- expect(page).to have_test_selector('storage-managed-project-folders-label',
-- text: 'Automatically managed folders')
++ expect(page).to have_test_selector("storage-managed-project-folders-label",
++ text: "Automatically managed folders")
-- expect(page).to have_test_selector('label-managed-project-folders-status', text: 'Active')
-- expect(page).to have_test_selector('storage-automatically-managed-project-folders-description',
-- text: 'Let OpenProject create folders per project automatically.')
++ expect(page).to have_test_selector("label-managed-project-folders-status", text: "Active")
++ expect(page).to have_test_selector("storage-automatically-managed-project-folders-description",
++ text: "Let OpenProject create folders per project automatically.")
end
-- aggregate_failures 'General information' do
++ aggregate_failures "General information" do
# Update a storage - happy path
-- find_test_selector('storage-edit-host-button').click
-- within_test_selector('storage-general-info-form') do
-- fill_in 'Name', with: 'My Nextcloud'
-- click_on 'Save and continue'
++ find_test_selector("storage-edit-host-button").click
++ within_test_selector("storage-general-info-form") do
++ fill_in "Name", with: "My Nextcloud"
++ click_on "Save and continue"
end
-- expect(page).to have_test_selector('storage-new-page-header--title', text: 'My Nextcloud (Nextcloud)')
-- expect(page).to have_test_selector('storage-description', text: "Nextcloud - My Nextcloud - #{storage.host}")
++ expect(page).to have_test_selector("storage-new-page-header--title", text: "My Nextcloud (Nextcloud)")
++ expect(page).to have_test_selector("storage-description", text: "Nextcloud - My Nextcloud - #{storage.host}")
# Update a storage - unhappy path
-- find_test_selector('storage-edit-host-button').click
-- within_test_selector('storage-general-info-form') do
-- fill_in 'Name', with: nil
-- fill_in 'Host', with: nil
-- click_on 'Save and continue'
++ find_test_selector("storage-edit-host-button").click
++ within_test_selector("storage-general-info-form") do
++ fill_in "Name", with: nil
++ fill_in "Host", with: nil
++ click_on "Save and continue"
expect(page).to have_text("Name can't be blank.")
expect(page).to have_text("Host is not a valid URL.")
-- click_on 'Cancel'
++ click_on "Cancel"
end
end
-- aggregate_failures 'OAuth application' do
++ aggregate_failures "OAuth application" do
accept_confirm do
-- find_test_selector('storage-replace-openproject-oauth-application-button').click
++ find_test_selector("storage-replace-openproject-oauth-application-button").click
end
-- within_test_selector('storage-openproject-oauth-application-form') do
-- warning_section = find_test_selector('storage-openproject_oauth_application_warning')
-- expect(warning_section).to have_text('The client secret value will not be accessible again after you close ' \
-- 'this window. Please copy these values into the Nextcloud ' \
-- 'OpenProject Integration settings.')
-- expect(warning_section).to have_link('Nextcloud OpenProject Integration settings',
++ within_test_selector("storage-openproject-oauth-application-form") do
++ warning_section = find_test_selector("storage-openproject_oauth_application_warning")
++ expect(warning_section).to have_text("The client secret value will not be accessible again after you close " \
++ "this window. Please copy these values into the Nextcloud " \
++ "OpenProject Integration settings.")
++ expect(warning_section).to have_link("Nextcloud OpenProject Integration settings",
href: "#{storage.host}/settings/admin/openproject")
-- expect(page).to have_css('#openproject_oauth_application_uid',
++ expect(page).to have_css("#openproject_oauth_application_uid",
value: storage.reload.oauth_application.uid)
-- expect(page).to have_css('#openproject_oauth_application_secret',
++ expect(page).to have_css("#openproject_oauth_application_secret",
value: secret)
-- click_on 'Done, continue'
++ click_on "Done, continue"
end
end
-- aggregate_failures 'OAuth Client' do
++ aggregate_failures "OAuth Client" do
accept_confirm do
-- find_test_selector('storage-edit-oauth-client-button').click
++ find_test_selector("storage-edit-oauth-client-button").click
end
-- within_test_selector('storage-oauth-client-form') do
++ within_test_selector("storage-oauth-client-form") do
# With null values, form should render inline errors
-- expect(page).to have_css('#oauth_client_client_id', value: '')
-- expect(page).to have_css('#oauth_client_client_secret', value: '')
-- click_on 'Save and continue'
++ expect(page).to have_css("#oauth_client_client_id", value: "")
++ expect(page).to have_css("#oauth_client_client_secret", value: "")
++ click_on "Save and continue"
expect(page).to have_text("Client ID can't be blank.")
expect(page).to have_text("Client secret can't be blank.")
# Happy path - Submit valid values
-- fill_in 'Nextcloud OAuth Client ID', with: '1234567890'
-- fill_in 'Nextcloud OAuth Client Secret', with: '0987654321'
-- expect(find_test_selector('storage-oauth-client-submit-button')).not_to be_disabled
-- click_on 'Save and continue'
++ fill_in "Nextcloud OAuth Client ID", with: "1234567890"
++ fill_in "Nextcloud OAuth Client Secret", with: "0987654321"
++ expect(find_test_selector("storage-oauth-client-submit-button")).not_to be_disabled
++ click_on "Save and continue"
end
-- expect(page).to have_test_selector('label-storage_oauth_client_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-oauth-client-id-description', text: "OAuth Client ID: 1234567890")
++ expect(page).to have_test_selector("label-storage_oauth_client_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-oauth-client-id-description", text: "OAuth Client ID: 1234567890")
expect(OAuthClient.where(integration: storage).count).to eq(1)
end
-- aggregate_failures 'Automatically managed project folders' do
-- find_test_selector('storage-edit-automatically-managed-project-folders-button').click
++ aggregate_failures "Automatically managed project folders" do
++ find_test_selector("storage-edit-automatically-managed-project-folders-button").click
-- within_test_selector('storage-automatically-managed-project-folders-form') do
++ within_test_selector("storage-automatically-managed-project-folders-form") do
automatically_managed_switch = page.find('[name="storages_nextcloud_storage[automatic_management_enabled]"]')
-- application_password_input = page.find_by_id('storages_nextcloud_storage_password')
++ application_password_input = page.find_by_id("storages_nextcloud_storage_password")
expect(automatically_managed_switch).to be_checked
expect(application_password_input.value).to be_empty
# Clicking submit with application password empty should show an error
-- click_on('Done, complete setup')
++ click_on("Done, complete setup")
expect(page).to have_text("Password can't be blank.")
# Test the error path for an invalid storage password.
@@@ -201,9 -201,9 +201,9 @@@
response_code: 401)
automatically_managed_switch = page.find('[name="storages_nextcloud_storage[automatic_management_enabled]"]')
expect(automatically_managed_switch).to be_checked
-- fill_in 'Application password', with: "1234567890"
++ fill_in "Application password", with: "1234567890"
# Clicking submit with application password empty should show an error
-- click_on('Done, complete setup')
++ click_on("Done, complete setup")
expect(page).to have_text("Password is not valid.")
# Test the happy path for a valid storage password.
@@@ -212,107 -212,135 +212,135 @@@
mock_nextcloud_application_credentials_validation(storage.host, password: "1234567890")
automatically_managed_switch = page.find('[name="storages_nextcloud_storage[automatic_management_enabled]"]')
expect(automatically_managed_switch).to be_checked
-- fill_in 'Application password', with: "1234567890"
-- click_on('Done, complete setup')
++ fill_in "Application password", with: "1234567890"
++ click_on("Done, complete setup")
end
-- expect(page).to have_test_selector('label-managed-project-folders-status', text: 'Active')
++ expect(page).to have_test_selector("label-managed-project-folders-status", text: "Active")
end
end
-- it 'renders health status information' do
++ it "renders health status information" do
visit edit_admin_settings_storage_path(storage)
-- expect(page).to have_test_selector('storage-health-label-pending', text: 'Pending')
++ expect(page).to have_test_selector("storage-health-label-pending", text: "Pending")
end
end
- context 'with OneDrive Storage' do
- let(:storage) { create(:one_drive_storage, name: 'Test Drive') }
- context 'with Nextcloud Storage and not automatically managed' do
- let(:storage) { create(:nextcloud_storage, :as_not_automatically_managed, name: 'Cloud Storage') }
++ context "with Nextcloud Storage and not automatically managed" do
++ let(:storage) { create(:nextcloud_storage, :as_not_automatically_managed, name: "Cloud Storage") }
+
- it 'does not render health status information' do
++ it "does not render health status information" do
+ visit edit_admin_settings_storage_path(storage)
+
- expect(page).not_to have_test_selector('storage-health-label-pending', text: 'Pending')
++ expect(page).not_to have_test_selector("storage-health-label-pending", text: "Pending")
+ end
+ end
+
- context 'with OneDrive/SharePoint Storage' do
- let(:storage) { create(:one_drive_storage, :as_automatically_managed, name: 'Test Drive') }
++ context "with OneDrive/SharePoint Storage" do
++ let(:storage) { create(:one_drive_storage, :as_automatically_managed, name: "Test Drive") }
let(:oauth_client) { create(:oauth_client, integration: storage) }
before { oauth_client }
-- it 'renders an edit view', :webmock do
++ it "renders an edit view", :webmock do
visit edit_admin_settings_storage_path(storage)
- expect(page).to be_axe_clean.within '#content'
+ expect(page).to be_axe_clean
- .within('#content')
- .skipping('heading-order')
++ .within("#content")
++ .skipping("heading-order")
-- expect(page).to have_test_selector('storage-new-page-header--title', text: 'Test Drive (OneDrive/SharePoint)')
++ expect(page).to have_test_selector("storage-new-page-header--title", text: "Test Drive (OneDrive/SharePoint)")
-- aggregate_failures 'Storage edit view' do
++ aggregate_failures "Storage edit view" do
# General information
-- expect(page).to have_test_selector('storage-provider-label', text: 'Storage provider')
-- expect(page).to have_test_selector('label-host_name_configured-storage_tenant_drive_configured-status',
-- text: 'Completed')
-- expect(page).to have_test_selector('storage-description', text: 'OneDrive/SharePoint - Test Drive')
++ expect(page).to have_test_selector("storage-provider-label", text: "Storage provider")
++ expect(page).to have_test_selector("label-host_name_configured-storage_tenant_drive_configured-status",
++ text: "Completed")
++ expect(page).to have_test_selector("storage-description", text: "OneDrive/SharePoint - Test Drive")
# OAuth client
-- expect(page).to have_test_selector('storage-oauth-client-label', text: 'Azure OAuth')
-- expect(page).to have_test_selector('label-storage_oauth_client_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-oauth-client-id-description',
++ expect(page).to have_test_selector("storage-oauth-client-label", text: "Azure OAuth")
++ expect(page).to have_test_selector("label-storage_oauth_client_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-oauth-client-id-description",
text: "OAuth Client ID: #{oauth_client.client_id}")
end
-- aggregate_failures 'General information' do
++ aggregate_failures "General information" do
# Update a storage - happy path
-- find_test_selector('storage-edit-host-button').click
-- within_test_selector('storage-general-info-form') do
-- fill_in 'Name', with: 'My OneDrive'
-- click_on 'Save and continue'
++ find_test_selector("storage-edit-host-button").click
++ within_test_selector("storage-general-info-form") do
++ fill_in "Name", with: "My OneDrive"
++ click_on "Save and continue"
end
-- expect(page).to have_test_selector('storage-new-page-header--title', text: 'My OneDrive (OneDrive/SharePoint)')
-- expect(page).to have_test_selector('storage-description', text: 'OneDrive/SharePoint - My OneDrive')
++ expect(page).to have_test_selector("storage-new-page-header--title", text: "My OneDrive (OneDrive/SharePoint)")
++ expect(page).to have_test_selector("storage-description", text: "OneDrive/SharePoint - My OneDrive")
# Update a storage - unhappy path
-- find_test_selector('storage-edit-host-button').click
-- within_test_selector('storage-general-info-form') do
-- fill_in 'Name', with: nil
-- fill_in 'Drive ID', with: nil
-- click_on 'Save and continue'
++ find_test_selector("storage-edit-host-button").click
++ within_test_selector("storage-general-info-form") do
++ fill_in "Name", with: nil
++ fill_in "Drive ID", with: nil
++ click_on "Save and continue"
expect(page).to have_text("Name can't be blank.")
expect(page).to have_text("Drive ID can't be blank.")
-- click_on 'Cancel'
++ click_on "Cancel"
end
end
-- aggregate_failures 'OAuth Client' do
++ aggregate_failures "OAuth Client" do
accept_confirm do
-- find_test_selector('storage-edit-oauth-client-button').click
++ find_test_selector("storage-edit-oauth-client-button").click
end
-- within_test_selector('storage-oauth-client-form') do
++ within_test_selector("storage-oauth-client-form") do
# With null values, form should render inline errors
-- expect(page).to have_css('#oauth_client_client_id', value: '')
-- expect(page).to have_css('#oauth_client_client_secret', value: '')
-- click_on 'Save and continue'
++ expect(page).to have_css("#oauth_client_client_id", value: "")
++ expect(page).to have_css("#oauth_client_client_secret", value: "")
++ click_on "Save and continue"
expect(page).to have_text("Client ID can't be blank.")
expect(page).to have_text("Client secret can't be blank.")
# Happy path - Submit valid values
-- fill_in 'Azure OAuth Application (client) ID', with: '1234567890'
-- fill_in 'Azure OAuth Client Secret Value', with: '0987654321'
-- click_on 'Save and continue'
++ fill_in "Azure OAuth Application (client) ID", with: "1234567890"
++ fill_in "Azure OAuth Client Secret Value", with: "0987654321"
++ click_on "Save and continue"
end
-- aggregate_failures 'Redirect URI' do
-- expect(page).to have_test_selector('storage-redirect-uri-label')
-- expect(page).to have_test_selector('storage-show-redirect-uri-button')
-- expect(page).not_to have_test_selector('storage-oauth-client-redirect-uri')
++ aggregate_failures "Redirect URI" do
++ expect(page).to have_test_selector("storage-redirect-uri-label")
++ expect(page).to have_test_selector("storage-show-redirect-uri-button")
++ expect(page).not_to have_test_selector("storage-oauth-client-redirect-uri")
find('a[data-test-selector="storage-show-redirect-uri-button"]').click
-- expect(page).to have_test_selector('storage-oauth-client-redirect-uri')
-- expect(find_test_selector('storage-oauth-client-submit-button')).to be_disabled
++ expect(page).to have_test_selector("storage-oauth-client-redirect-uri")
++ expect(find_test_selector("storage-oauth-client-submit-button")).to be_disabled
end
-- expect(page).to have_test_selector('label-storage_oauth_client_configured-status', text: 'Completed')
-- expect(page).to have_test_selector('storage-oauth-client-id-description', text: "OAuth Client ID: 1234567890")
++ expect(page).to have_test_selector("label-storage_oauth_client_configured-status", text: "Completed")
++ expect(page).to have_test_selector("storage-oauth-client-id-description", text: "OAuth Client ID: 1234567890")
end
end
+
- it 'renders health status information' do
++ it "renders health status information" do
+ visit edit_admin_settings_storage_path(storage)
+
- expect(page).to have_test_selector('storage-health-label-pending', text: 'Pending')
++ expect(page).to have_test_selector("storage-health-label-pending", text: "Pending")
+ end
+ end
+
- context 'with OneDrive/SharePoint Storage and not automatically managed' do
- let(:storage) { create(:one_drive_storage, :as_not_automatically_managed, name: 'Cloud Storage') }
++ context "with OneDrive/SharePoint Storage and not automatically managed" do
++ let(:storage) { create(:one_drive_storage, :as_not_automatically_managed, name: "Cloud Storage") }
+
- it 'does not render health status information' do
++ it "does not render health status information" do
+ visit edit_admin_settings_storage_path(storage)
+
- expect(page).not_to have_test_selector('storage-health-label-pending', text: 'Pending')
++ expect(page).not_to have_test_selector("storage-health-label-pending", text: "Pending")
+ end
end
end
diff --cc modules/storages/spec/features/storages_menu_links_spec.rb
index 969b12c2ad7,63d4347af01..74eb1d6589e
--- a/modules/storages/spec/features/storages_menu_links_spec.rb
+++ b/modules/storages/spec/features/storages_menu_links_spec.rb
@@@ -28,26 -28,28 +28,28 @@@
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'spec_helper'
++require "spec_helper"
require_module_spec_helper
- RSpec.describe 'Storage links in project menu', :js, :with_cuprite do
-RSpec.describe 'Storage links in project menu' do
++RSpec.describe "Storage links in project menu" do
include EnsureConnectionPathHelper
- let!(:storage_configured_linked1) { create(:nextcloud_storage_configured, :as_automatically_managed, name: "Storage 1") }
- let!(:project_storage1) { create(:project_storage, :as_automatically_managed, project:, storage: storage_configured_linked1) }
- let!(:storage_configured_linked2) { create(:nextcloud_storage_configured, name: "Storage 2") }
- let!(:project_storage2) do
- create(:project_storage, project_folder_mode: 'inactive', project:, storage: storage_configured_linked2)
+ shared_let(:project) { create(:project, enabled_module_names: %i[storages]) }
+ shared_let(:storage_configured_linked1) { create(:nextcloud_storage_configured, :as_automatically_managed, name: "Storage 1") }
+ shared_let(:project_storage1) do
+ create(:project_storage, :as_automatically_managed, project:, storage: storage_configured_linked1)
end
- let!(:storage_configured_linked3) { create(:nextcloud_storage_configured, name: "Storage 3") }
- let!(:project_storage3) do
- create(:project_storage, project_folder_mode: 'manual', project:, storage: storage_configured_linked3)
+ shared_let(:storage_configured_linked2) { create(:nextcloud_storage_configured, name: "Storage 2") }
+ shared_let(:project_storage2) do
- create(:project_storage, project_folder_mode: 'inactive', project:, storage: storage_configured_linked2)
++ create(:project_storage, project_folder_mode: "inactive", project:, storage: storage_configured_linked2)
end
- let!(:storage_configured_unlinked) { create(:nextcloud_storage_configured, name: "Storage 4") }
- let!(:storage_unconfigured_linked) { create(:nextcloud_storage, name: "Storage 5") }
- let!(:project_storage4) { create(:project_storage, project:, storage: storage_unconfigured_linked) }
- let!(:project) { create(:project, enabled_module_names: %i[storages]) }
+ shared_let(:storage_configured_linked3) { create(:nextcloud_storage_configured, name: "Storage 3") }
+ shared_let(:project_storage3) do
- create(:project_storage, project_folder_mode: 'manual', project:, storage: storage_configured_linked3)
++ create(:project_storage, project_folder_mode: "manual", project:, storage: storage_configured_linked3)
+ end
+ shared_let(:storage_configured_unlinked) { create(:nextcloud_storage_configured, name: "Storage 4") }
+ shared_let(:storage_unconfigured_linked) { create(:nextcloud_storage, name: "Storage 5") }
+ shared_let(:project_storage4) { create(:project_storage, project:, storage: storage_unconfigured_linked) }
let(:user) { create(:user, member_with_permissions: { project => permissions }) }
before do
@@@ -55,10 -57,10 +57,10 @@@
visit(project_path(project))
end
-- context 'if user is an admin but not a member of the project' do
++ context "if user is an admin but not a member of the project" do
let(:user) { create(:admin) }
-- it 'has no links to enabled storage' do
++ it "has no links to enabled storage" do
visit(project_path(id: project.id))
expect(page).to have_no_link(storage_configured_linked1.name)
@@@ -69,11 -71,11 +71,11 @@@
end
end
-- context 'if user has permission to' do
-- context 'read_files and view_file_links' do
++ context "if user has permission" do
++ context "to read_files and view_file_links" do
let(:permissions) { %i[view_file_links read_files] }
-- it 'has links to all enabled storages' do
++ it "has links to all enabled storages" do
visit(project_path(id: project.id))
expect(page).to have_link(storage_configured_linked1.name, href: ensure_connection_path(project_storage1))
@@@ -82,12 -84,28 +84,28 @@@
expect(page).to have_no_link(storage_configured_unlinked.name)
expect(page).to have_no_link(storage_unconfigured_linked.name)
end
+
- context 'when OP has been installed behind prefix' do
- let(:prefix) { '/qwerty' }
++ context "when OP has been installed behind prefix" do
++ let(:prefix) { "/qwerty" }
+
+ before { allow(OpenProject::Configuration).to receive(:rails_relative_url_root).and_return(prefix) }
+
- it 'has all links prefixed' do
++ it "has all links prefixed" do
+ visit(project_path(id: project.id))
+
+ expect(page).to have_link(storage_configured_linked1.name, href: ensure_connection_path(project_storage1))
+ expect(page).to have_link(storage_configured_linked2.name, href: ensure_connection_path(project_storage2))
+ expect(page).to have_link(storage_configured_linked3.name, href: ensure_connection_path(project_storage3))
+ expect(page).to have_no_link(storage_configured_unlinked.name)
+ expect(page).to have_no_link(storage_unconfigured_linked.name)
+ end
+ end
end
-- context 'read_files' do
++ context "to read_files" do
let(:permissions) { %i[read_files] }
-- it 'has no links to enabled storages' do
++ it "has no links to enabled storages" do
visit(project_path(id: project.id))
expect(page).to have_no_link(storage_configured_linked1.name)
@@@ -98,10 -116,10 +116,10 @@@
end
end
-- context 'view_file_links' do
++ context "to view_file_links" do
let(:permissions) { %i[view_file_links] }
-- it 'has links to enabled storages apart from automatically managed' do
++ it "has links to enabled storages apart from automatically managed" do
visit(project_path(id: project.id))
expect(page).to have_no_link(storage_configured_linked1.name, href: ensure_connection_path(project_storage1))
@@@ -113,10 -131,10 +131,10 @@@
end
end
-- context 'if user has no permission to see storage links' do
++ context "if user has no permission to see storage links" do
let(:permissions) { %i[] }
-- it 'has no links to enabled storages' do
++ it "has no links to enabled storages" do
visit(project_path(id: project.id))
expect(page).to have_no_link(storage_configured_linked1.name)
diff --cc spec/contracts/settings/working_days_params_contract_spec.rb
index f67f074e0a2,31f2e46ec8b..ddd60516a28
--- a/spec/contracts/settings/working_days_params_contract_spec.rb
+++ b/spec/contracts/settings/working_days_params_contract_spec.rb
@@@ -26,33 -26,38 +26,38 @@@
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'spec_helper'
--require 'contracts/shared/model_contract_shared_context'
++require "spec_helper"
++require "contracts/shared/model_contract_shared_context"
RSpec.describe Settings::WorkingDaysParamsContract do
-- include_context 'ModelContract shared context'
++ include_context "ModelContract shared context"
+ shared_let(:current_user) { create(:admin) }
let(:setting) { Setting }
- let(:current_user) { build_stubbed(:admin) }
let(:params) { { working_days: [1] } }
let(:contract) do
described_class.new(setting, current_user, params:)
end
-- it_behaves_like 'contract is valid for active admins and invalid for regular users'
++ it_behaves_like "contract is valid for active admins and invalid for regular users"
-- context 'without working days' do
++ context "without working days" do
let(:params) { { working_days: [] } }
-- include_examples 'contract is invalid', base: :working_days_are_missing
++ include_examples "contract is invalid", base: :working_days_are_missing
end
- context 'with an ApplyWorkingDaysChangeJob already existing' do
- context 'with an ApplyWorkingDaysChangeJob already existing',
++ context "with an ApplyWorkingDaysChangeJob already existing",
+ with_good_job: WorkPackages::ApplyWorkingDaysChangeJob do
let(:params) { { working_days: [1, 2, 3] } }
+
before do
- ActiveJob::Base.disable_test_adapter
- WorkPackages::ApplyWorkingDaysChangeJob.perform_later
+ WorkPackages::ApplyWorkingDaysChangeJob
+ .set(wait: 10.minutes) # GoodJob executes inline job without wait immediately
+ .perform_later(user_id: current_user.id,
+ previous_non_working_days: [],
+ previous_working_days: [1, 2, 3, 4])
end
-- include_examples 'contract is invalid', base: :previous_working_day_changes_unprocessed
++ include_examples "contract is invalid", base: :previous_working_day_changes_unprocessed
end
end
diff --cc spec/features/work_packages/attachments/attachment_upload_spec.rb
index 479a0ddbfb4,274ba35ff1e..d4e6516473d
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@@ -26,26 -26,26 +26,26 @@@
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'spec_helper'
--require 'features/page_objects/notification'
++require "spec_helper"
++require "features/page_objects/notification"
--RSpec.describe 'Upload attachment to work package', :js, :with_cuprite do
++RSpec.describe "Upload attachment to work package", :js, :with_cuprite do
let(:role) do
create(:project_role,
permissions: %i[view_work_packages add_work_packages edit_work_packages add_work_package_notes])
end
let(:dev) do
create(:user,
-- firstname: 'Dev',
-- lastname: 'Guy',
++ firstname: "Dev",
++ lastname: "Guy",
member_with_roles: { project => role })
end
let(:project) { create(:project) }
-- let(:work_package) { create(:work_package, project:, description: 'Initial description') }
++ let(:work_package) { create(:work_package, project:, description: "Initial description") }
let(:wp_page) { Pages::FullWorkPackage.new(work_package, project) }
let(:attachments) { Components::Attachments.new }
-- let(:field) { TextEditorField.new wp_page, 'description' }
-- let(:image_fixture) { UploadedFile.load_from('spec/fixtures/files/image.png') }
++ let(:field) { TextEditorField.new wp_page, "description" }
++ let(:image_fixture) { UploadedFile.load_from("spec/fixtures/files/image.png") }
let(:editor) { Components::WysiwygEditor.new }
before do
@@@ -54,78 -54,78 +54,78 @@@
wp_page.ensure_page_loaded
end
-- describe 'wysiwyg editor' do
-- context 'when on an existing page' do
++ describe "wysiwyg editor" do
++ context "when on an existing page" do
before do
wp_page.visit!
wp_page.ensure_page_loaded
end
-- it 'can upload an image via drag & drop' do
++ it "can upload an image via drag & drop" do
# Activate the edit field
field.activate!
- editor.expect_button 'Insert image'
- editor.expect_button 'Upload image from computer'
++ editor.expect_button "Upload image from computer"
-- editor.drag_attachment image_fixture.path, 'Some image caption'
++ editor.drag_attachment image_fixture.path, "Some image caption"
field.submit_by_click
-- expect(field.display_element).to have_css('img')
-- expect(field.display_element).to have_content('Some image caption')
++ expect(field.display_element).to have_css("img")
++ expect(field.display_element).to have_content("Some image caption")
end
-- context 'when editing comment' do
-- let(:selector) { '.work-packages--activity--add-comment' }
++ context "when editing comment" do
++ let(:selector) { ".work-packages--activity--add-comment" }
let(:comment_field) do
TextEditorField.new wp_page,
-- 'comment',
++ "comment",
selector:
end
-- let(:editor) { Components::WysiwygEditor.new '.work-packages--activity--add-comment' }
++ let(:editor) { Components::WysiwygEditor.new ".work-packages--activity--add-comment" }
-- context 'with a user that is not allowed to add images (Regression #28541)' do
++ context "with a user that is not allowed to add images (Regression #28541)" do
let(:role) do
create(:project_role,
permissions: %i[view_work_packages add_work_packages add_work_package_notes])
end
-- it 'can open the editor to add an image, but image upload is not shown' do
++ it "can open the editor to add an image, but image upload is not shown" do
# Add comment
comment_field.activate!
# Button should be hidden
- editor.expect_no_button 'Insert image'
- editor.expect_no_button 'Upload image from computer'
++ editor.expect_no_button "Upload image from computer"
-- editor.click_and_type_slowly 'this is a comment!1'
++ editor.click_and_type_slowly "this is a comment!1"
comment_field.submit_by_click
-- wp_page.expect_comment text: 'this is a comment!1'
++ wp_page.expect_comment text: "this is a comment!1"
end
end
-- context 'with a user that is allowed add attachments but not edit WP (#29203)' do
++ context "with a user that is allowed add attachments but not edit WP (#29203)" do
let(:role) do
create(:project_role,
permissions: %i[view_work_packages add_work_package_attachments add_work_package_notes])
end
-- it 'can open the editor and image upload is shown' do
++ it "can open the editor and image upload is shown" do
comment_field.activate!
- editor.expect_button 'Insert image'
- editor.expect_button 'Upload image from computer'
++ editor.expect_button "Upload image from computer"
-- editor.click_and_type_slowly 'this is a comment!2'
-- editor.drag_attachment image_fixture.path, 'Some image caption'
++ editor.click_and_type_slowly "this is a comment!2"
++ editor.drag_attachment image_fixture.path, "Some image caption"
comment_field.submit_by_click
-- wp_page.expect_comment text: 'this is a comment!2'
++ wp_page.expect_comment text: "this is a comment!2"
end
end
end
end
-- context 'when on a split page' do
++ context "when on a split page" do
let!(:type) { create(:type_task) }
let!(:status) { create(:status, is_default: true) }
let!(:priority) { create(:priority, is_default: true) }
@@@ -134,13 -134,13 +134,13 @@@
end
let!(:table) { Pages::WorkPackagesTable.new project }
-- it 'can add two work packages in a row when uploading (Regression #42933)' do |example|
++ it "can add two work packages in a row when uploading (Regression #42933)" do |example|
table.visit!
new_page = table.create_wp_by_button type
subject = new_page.edit_field :subject
-- subject.set_value 'My subject'
++ subject.set_value "My subject"
-- target = find('.ck-content')
++ target = find(".ck-content")
attachments.drag_and_drop_file(target, image_fixture.path)
sleep 2 unless example.metadata[:with_cuprite]
@@@ -148,39 -148,39 +148,39 @@@
editor.in_editor do |_container, editable|
expect(editable).to have_css('img[src*="/api/v3/attachments/"]', wait: 20)
-- expect(editable).to have_no_css('.ck-upload-placeholder-loader')
++ expect(editable).to have_no_css(".ck-upload-placeholder-loader")
end
sleep 2 unless example.metadata[:with_cuprite]
-- scroll_to_and_click find_by_id('work-packages--edit-actions-save')
++ scroll_to_and_click find_by_id("work-packages--edit-actions-save")
new_page.expect_and_dismiss_toaster(
-- message: 'Successful creation.'
++ message: "Successful creation."
)
split_view = Pages::SplitWorkPackage.new(WorkPackage.last)
field = split_view.edit_field :description
-- expect(field.display_element).to have_css('img')
++ expect(field.display_element).to have_css("img")
wp = WorkPackage.last
-- expect(wp.subject).to eq('My subject')
++ expect(wp.subject).to eq("My subject")
expect(wp.attachments.count).to eq(1)
# create another one
new_page = table.create_wp_by_button type
subject = new_page.edit_field :subject
-- subject.set_value 'A second task'
++ subject.set_value "A second task"
-- scroll_to_and_click find_by_id('work-packages--edit-actions-save')
++ scroll_to_and_click find_by_id("work-packages--edit-actions-save")
new_page.expect_toast(
-- message: 'Successful creation.'
++ message: "Successful creation."
)
last = WorkPackage.last
-- expect(last.subject).to eq('A second task')
++ expect(last.subject).to eq("A second task")
expect(last.attachments.count).to eq(0)
wp.reload
@@@ -188,8 -188,8 +188,8 @@@
end
end
-- context 'when on a new page' do
-- shared_examples 'it supports image uploads via drag & drop' do
++ context "when on a new page" do
++ shared_examples "it supports image uploads via drag & drop" do
let!(:new_page) { Pages::FullWorkPackageCreate.new }
let!(:type) { create(:type_task) }
let!(:status) { create(:status, is_default: true) }
@@@ -204,11 -204,11 +204,11 @@@
visit new_project_work_packages_path(project.identifier, type: type.id)
end
-- it 'can upload an image via drag & drop (Regression #28189)' do |example|
++ it "can upload an image via drag & drop (Regression #28189)" do |example|
subject = new_page.edit_field :subject
-- subject.set_value 'My subject'
++ subject.set_value "My subject"
-- target = find('.ck-content')
++ target = find(".ck-content")
attachments.drag_and_drop_file(target, image_fixture.path)
sleep 2 unless example.metadata[:with_cuprite]
@@@ -216,29 -216,29 +216,29 @@@
editor.in_editor do |_container, editable|
expect(editable).to have_css('img[src*="/api/v3/attachments/"]', wait: 20)
-- expect(editable).to have_no_css('.ck-upload-placeholder-loader')
++ expect(editable).to have_no_css(".ck-upload-placeholder-loader")
end
sleep 2 unless example.metadata[:with_cuprite]
-- scroll_to_and_click find_by_id('work-packages--edit-actions-save')
++ scroll_to_and_click find_by_id("work-packages--edit-actions-save")
wp_page.expect_toast(
-- message: 'Successful creation.'
++ message: "Successful creation."
)
field = wp_page.edit_field :description
-- expect(field.display_element).to have_css('img')
++ expect(field.display_element).to have_css("img")
wp = WorkPackage.last
-- expect(wp.subject).to eq('My subject')
++ expect(wp.subject).to eq("My subject")
expect(wp.attachments.count).to eq(1)
post_conditions
end
end
-- it_behaves_like 'it supports image uploads via drag & drop'
++ it_behaves_like "it supports image uploads via drag & drop"
# We do a complete integration test for direct uploads on this example.
# If this works all parts in the backend and frontend work properly together.
@@@ -247,12 -247,12 +247,12 @@@
# everywhere so if this works it should work everywhere else too.
# TODO: Add better_cuprite_billy. I'm not sure what needs to be set up so the request to AWS passes.
# Need help
-- context 'with direct uploads', :with_direct_uploads, with_cuprite: false do
++ context "with direct uploads", :with_direct_uploads, with_cuprite: false do
before do
allow_any_instance_of(Attachment).to receive(:diskfile).and_return Struct.new(:path).new(image_fixture.path.to_s)
end
-- it_behaves_like 'it supports image uploads via drag & drop' do
++ it_behaves_like "it supports image uploads via drag & drop" do
let(:post_conditions) do
# check the attachment was created successfully
expect(Attachment.count).to eq 1
@@@ -267,58 -267,58 +267,58 @@@
end
end
-- describe 'attachment dropzone' do
-- shared_examples 'attachment dropzone common' do
-- it 'can drag something to the files tab and have it open' do
-- wp_page.expect_tab 'Activity'
-- attachments.drag_and_drop_file test_selector('op-attachments--drop-box'),
++ describe "attachment dropzone" do
++ shared_examples "attachment dropzone common" do
++ it "can drag something to the files tab and have it open" do
++ wp_page.expect_tab "Activity"
++ attachments.drag_and_drop_file test_selector("op-attachments--drop-box"),
image_fixture.path,
:center,
page.find('[data-qa-tab-id="files"]'),
delay_dragleave: true
-- expect(page).to have_test_selector('op-files-tab--file-list-item-title', text: 'image.png', wait: 10)
++ expect(page).to have_test_selector("op-files-tab--file-list-item-title", text: "image.png", wait: 10)
editor.wait_until_upload_progress_toaster_cleared
-- wp_page.expect_tab 'Files'
++ wp_page.expect_tab "Files"
end
-- it 'can drag something from the files tab and create a comment with it' do
-- wp_page.switch_to_tab(tab: 'files')
++ it "can drag something from the files tab and create a comment with it" do
++ wp_page.switch_to_tab(tab: "files")
-- attachments.drag_and_drop_file '.work-package-comment',
++ attachments.drag_and_drop_file ".work-package-comment",
image_fixture.path,
:center,
page.find('[data-qa-tab-id="activity"]'),
delay_dragleave: true
-- wp_page.expect_tab 'Activity'
++ wp_page.expect_tab "Activity"
end
end
-- include_examples 'attachment dropzone common'
++ include_examples "attachment dropzone common"
-- context 'with a user that is allowed to add attachments but not edit WP (#29203)' do
++ context "with a user that is allowed to add attachments but not edit WP (#29203)" do
let(:role) do
create(:project_role,
permissions: %i[view_work_packages add_work_package_attachments add_work_package_notes])
end
-- include_examples 'attachment dropzone common'
++ include_examples "attachment dropzone common"
end
# This one is not shared, because it requires edit WP
-- it 'can upload an image via attaching and drag & drop' do
-- wp_page.switch_to_tab(tab: 'files')
-- container = page.find_test_selector('op-attachments--drop-box')
++ it "can upload an image via attaching and drag & drop" do
++ wp_page.switch_to_tab(tab: "files")
++ container = page.find_test_selector("op-attachments--drop-box")
##
# Attach file manually
-- expect(page).not_to have_test_selector('op-files-tab--file-list-item-title')
++ expect(page).not_to have_test_selector("op-files-tab--file-list-item-title")
attachments.attach_file_on_input(image_fixture.path)
editor.wait_until_upload_progress_toaster_cleared
expect(page)
-- .to have_test_selector('op-files-tab--file-list-item-title',
-- text: 'image.png',
++ .to have_test_selector("op-files-tab--file-list-item-title",
++ text: "image.png",
wait: 5)
# Drop zone should become hidden again
@@@ -332,8 -332,8 +332,8 @@@
attachments.drag_and_drop_file(container, image_fixture.path)
editor.wait_until_upload_progress_toaster_cleared
expect(page)
-- .to have_test_selector('op-files-tab--file-list-item-title',
-- text: 'image.png',
++ .to have_test_selector("op-files-tab--file-list-item-title",
++ text: "image.png",
count: 2,
wait: 5)
@@@ -345,12 -345,12 +345,12 @@@
attachments.drag_and_drop_file container,
image_fixture.path,
:center,
-- ["#{field.selector} #{field.display_selector}", '.work-package--single-view']
++ ["#{field.selector} #{field.display_selector}", ".work-package--single-view"]
editor.wait_until_upload_progress_toaster_cleared
expect(page)
-- .to have_test_selector('op-files-tab--file-list-item-title',
-- text: 'image.png',
++ .to have_test_selector("op-files-tab--file-list-item-title",
++ text: "image.png",
count: 3,
wait: 5)
@@@ -368,8 -368,8 +368,8 @@@
editor.wait_until_upload_progress_toaster_cleared
expect(page)
-- .to have_test_selector('op-files-tab--file-list-item-title',
-- text: 'image.png',
++ .to have_test_selector("op-files-tab--file-list-item-title",
++ text: "image.png",
count: 3,
wait: 5)
diff --cc spec/features/work_packages/details/markdown/todolist_spec.rb
index 47831b8436c,c78914665e1..4e03179a6f0
--- a/spec/features/work_packages/details/markdown/todolist_spec.rb
+++ b/spec/features/work_packages/details/markdown/todolist_spec.rb
@@@ -26,117 -26,117 +26,117 @@@
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'spec_helper'
++require "spec_helper"
--RSpec.describe 'Todolists in CKEditor', :js do
++RSpec.describe "Todolists in CKEditor", :js do
let(:user) { create(:admin) }
before do
login_as user
end
-- describe 'with an existing work package' do
++ describe "with an existing work package" do
let(:work_package) { create(:work_package) }
let(:wp_page) { Pages::FullWorkPackage.new(work_package) }
let(:field) { wp_page.edit_field :description }
let(:ckeditor) { field.ckeditor }
-- it 'can add task list and edit them again' do
++ it "can add task list and edit them again" do
wp_page.visit!
wp_page.ensure_page_loaded
field.activate!
ckeditor.clear
-- ckeditor.click_toolbar_button 'To-do List'
-- ckeditor.type_slowly 'Todo item 1'
++ ckeditor.click_toolbar_button "To-do List"
++ ckeditor.type_slowly "Todo item 1"
ckeditor.type_slowly :enter
-- ckeditor.type_slowly 'Todo item 2'
++ ckeditor.type_slowly "Todo item 2"
ckeditor.type_slowly :enter
# Indent
ckeditor.type_slowly :tab
-- ckeditor.type_slowly 'Nested item 1'
++ ckeditor.type_slowly "Nested item 1"
ckeditor.type_slowly :enter
-- ckeditor.type_slowly 'Nested item 2'
++ ckeditor.type_slowly "Nested item 2"
ckeditor.type_slowly :enter
# Outdent
ckeditor.type_slowly %i[shift tab]
-- ckeditor.type_slowly 'Todo item 3'
++ ckeditor.type_slowly "Todo item 3"
# Select first and first nested item
ckeditor.in_editor do |_container, editable|
- first_item = editable.all('.op-uc-list li')[0]
- first_item = editable.all('.todo-list li')[0]
-- first_item.find('input[type=checkbox]', visible: :all).set true
++ first_item = editable.all(".todo-list li")[0]
++ first_item.find("input[type=checkbox]", visible: :all).set true
# First nested
- first_nested_item = editable.all('.op-uc-list .op-uc-list li')[0]
- first_nested_item = editable.all('.todo-list .todo-list li')[0]
-- first_nested_item.find('input[type=checkbox]', visible: :all).set true
++ first_nested_item = editable.all(".todo-list .todo-list li")[0]
++ first_nested_item.find("input[type=checkbox]", visible: :all).set true
sleep 0.5
end
field.submit_by_click
-- wp_page.expect_and_dismiss_toaster message: 'Successful update.'
++ wp_page.expect_and_dismiss_toaster message: "Successful update."
within(field.display_element) do
-- expect(page).to have_css('.op-uc-list--task-checkbox', count: 5)
-- expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 2)
++ expect(page).to have_css(".op-uc-list--task-checkbox", count: 5)
++ expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 2)
-- expect(page).to have_css('.op-uc-list--item', text: 'Todo item 1')
-- expect(page).to have_css('.op-uc-list--item', text: 'Todo item 2')
-- expect(page).to have_css('.op-uc-list--item', text: 'Todo item 3')
++ expect(page).to have_css(".op-uc-list--item", text: "Todo item 1")
++ expect(page).to have_css(".op-uc-list--item", text: "Todo item 2")
++ expect(page).to have_css(".op-uc-list--item", text: "Todo item 3")
-- expect(page).to have_css('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
-- expect(page).to have_css('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 2')
++ expect(page).to have_css(".op-uc-list .op-uc-list .op-uc-list--item", text: "Nested item 1")
++ expect(page).to have_css(".op-uc-list .op-uc-list .op-uc-list--item", text: "Nested item 2")
-- first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
-- expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
-- first_nested_item = page.find('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
-- expect(first_nested_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ first_item = page.find(".op-uc-list--item", text: "Todo item 1")
++ expect(first_item).to have_css(".op-uc-list--task-checkbox[checked]")
++ first_nested_item = page.find(".op-uc-list .op-uc-list .op-uc-list--item", text: "Nested item 1")
++ expect(first_nested_item).to have_css(".op-uc-list--task-checkbox[checked]")
end
# Expect still the same when editing again
field.activate!
ckeditor.in_editor do |_container, editable|
-- expect(editable).to have_css('.op-uc-list li', count: 5)
++ expect(editable).to have_css(".op-uc-list li", count: 5)
-- first_item = editable.all('.op-uc-list li')[0].find('input[type=checkbox]', visible: :all)
++ first_item = editable.all(".op-uc-list li")[0].find("input[type=checkbox]", visible: :all)
expect(first_item).to be_checked
# First nested
-- first_nested_item = editable.all('.op-uc-list .op-uc-list li')[0].find('input[type=checkbox]', visible: :all)
++ first_nested_item = editable.all(".op-uc-list .op-uc-list li")[0].find("input[type=checkbox]", visible: :all)
expect(first_nested_item).to be_checked
# Check last item
-- last_item = editable.all('.op-uc-list li').last
-- last_item.find('input[type=checkbox]', visible: :all).set true
++ last_item = editable.all(".op-uc-list li").last
++ last_item.find("input[type=checkbox]", visible: :all).set true
sleep 0.5
end
field.submit_by_click
-- wp_page.expect_and_dismiss_toaster message: 'Successful update.'
++ wp_page.expect_and_dismiss_toaster message: "Successful update."
within(field.display_element) do
-- expect(page).to have_css('.op-uc-list--task-checkbox', count: 5)
-- expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 3)
++ expect(page).to have_css(".op-uc-list--task-checkbox", count: 5)
++ expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 3)
-- first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
-- expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
-- first_nested_item = page.find('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
-- expect(first_nested_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ first_item = page.find(".op-uc-list--item", text: "Todo item 1")
++ expect(first_item).to have_css(".op-uc-list--task-checkbox[checked]")
++ first_nested_item = page.find(".op-uc-list .op-uc-list .op-uc-list--item", text: "Nested item 1")
++ expect(first_nested_item).to have_css(".op-uc-list--task-checkbox[checked]")
-- last_item = page.find('.op-uc-list .op-uc-list--item', text: 'Todo item 3')
-- expect(last_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ last_item = page.find(".op-uc-list .op-uc-list--item", text: "Todo item 3")
++ expect(last_item).to have_css(".op-uc-list--task-checkbox[checked]")
end
end
end
-- describe 'creating a new work package' do
++ describe "creating a new work package" do
let!(:status) { create(:default_status) }
let!(:priority) { create(:default_priority) }
let!(:type) { create(:type_task) }
@@@ -148,45 -148,45 +148,45 @@@
before do
wp_page.visit!
-- wp_page.edit_field(:subject).set_value 'Title'
++ wp_page.edit_field(:subject).set_value "Title"
field.expect_active!
ckeditor.clear
end
-- it 'can add a task list with links in them (Regression #30920)' do
-- ckeditor.click_toolbar_button 'To-do List'
-- ckeditor.type_slowly 'Todo item 1'
++ it "can add a task list with links in them (Regression #30920)" do
++ ckeditor.click_toolbar_button "To-do List"
++ ckeditor.type_slowly "Todo item 1"
ckeditor.type_slowly :enter
-- ckeditor.insert_link 'https://community.openproject.com'
++ ckeditor.insert_link "https://community.openproject.com"
ckeditor.type_slowly :enter
ckeditor.type_slowly :tab
-- ckeditor.insert_link 'https://community.openproject.com/nested'
++ ckeditor.insert_link "https://community.openproject.com/nested"
# Update the link text, no idea how to do this differently
ckeditor.in_editor do |_container, editable|
- link = editable.find('.op-uc-list .op-uc-list a')
- link = editable.find('.todo-list .todo-list a')
-- link.set('This is a link')
++ link = editable.find(".todo-list .todo-list a")
++ link.set("This is a link")
sleep 0.5
end
# Select nested item
ckeditor.in_editor do |_container, editable|
- editable.find('.op-uc-list .op-uc-list input[type=checkbox]', visible: :all).set true
- editable.find('.todo-list .todo-list input[type=checkbox]', visible: :all).set true
++ editable.find(".todo-list .todo-list input[type=checkbox]", visible: :all).set true
sleep 0.5
end
wp_page.save!
-- wp_page.expect_and_dismiss_toaster message: 'Successful creation.'
++ wp_page.expect_and_dismiss_toaster message: "Successful creation."
-- expect(page).to have_css('.op-uc-list--task-checkbox', count: 3)
-- expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 1)
++ expect(page).to have_css(".op-uc-list--task-checkbox", count: 3)
++ expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 1)
expect(page).to have_css('.op-uc-list--item a[href="https://community.openproject.com/"]')
nested_link = page.find('.op-uc-list--item .op-uc-list--item a[href="https://community.openproject.com/nested"]')
-- expect(nested_link.text).to eq 'This is a link'
++ expect(nested_link.text).to eq "This is a link"
description = WorkPackage.last.description
expected = <<~EOS
@@@ -198,61 -198,61 +198,61 @@@
expect(description.strip).to eq expected.strip
end
-- it 'can add task list and edit them again' do
-- ckeditor.click_toolbar_button 'To-do List'
-- ckeditor.type_slowly 'Todo item 1'
++ it "can add task list and edit them again" do
++ ckeditor.click_toolbar_button "To-do List"
++ ckeditor.type_slowly "Todo item 1"
ckeditor.type_slowly :enter
-- ckeditor.type_slowly 'Todo item 2'
++ ckeditor.type_slowly "Todo item 2"
# Select first item
ckeditor.in_editor do |_container, editable|
- first_item = editable.all('.op-uc-list li')[0]
- first_item = editable.all('.todo-list li')[0]
-- first_item.find('input[type=checkbox]', visible: :all).set true
++ first_item = editable.all(".todo-list li")[0]
++ first_item.find("input[type=checkbox]", visible: :all).set true
sleep 0.5
end
wp_page.save!
-- wp_page.expect_and_dismiss_toaster message: 'Successful creation.'
++ wp_page.expect_and_dismiss_toaster message: "Successful creation."
within(field.display_element) do
-- expect(page).to have_css('.op-uc-list--task-checkbox', count: 2)
-- expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 1)
++ expect(page).to have_css(".op-uc-list--task-checkbox", count: 2)
++ expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 1)
-- expect(page).to have_css('.op-uc-list--item', text: 'Todo item 1')
-- expect(page).to have_css('.op-uc-list--item', text: 'Todo item 2')
++ expect(page).to have_css(".op-uc-list--item", text: "Todo item 1")
++ expect(page).to have_css(".op-uc-list--item", text: "Todo item 2")
-- first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
-- expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ first_item = page.find(".op-uc-list--item", text: "Todo item 1")
++ expect(first_item).to have_css(".op-uc-list--task-checkbox[checked]")
end
# Expect still the same when editing again
field.activate!
ckeditor.in_editor do |_container, editable|
- expect(editable).to have_css('.op-uc-list li', count: 2)
- expect(editable).to have_css('.todo-list li', count: 2)
++ expect(editable).to have_css(".todo-list li", count: 2)
- first_item = editable.all('.op-uc-list li')[0].find('input[type=checkbox]', visible: :all)
- first_item = editable.all('.todo-list li')[0].find('input[type=checkbox]', visible: :all)
++ first_item = editable.all(".todo-list li")[0].find("input[type=checkbox]", visible: :all)
expect(first_item).to be_checked
# Check last item
- last_item = editable.all('.op-uc-list li').last
- last_item = editable.all('.todo-list li').last
-- last_item.find('input[type=checkbox]', visible: :all).set true
++ last_item = editable.all(".todo-list li").last
++ last_item.find("input[type=checkbox]", visible: :all).set true
sleep 0.5
end
field.submit_by_click
-- wp_page.expect_and_dismiss_toaster message: 'Successful update.'
++ wp_page.expect_and_dismiss_toaster message: "Successful update."
within(field.display_element) do
-- expect(page).to have_css('.op-uc-list--task-checkbox', count: 2)
-- expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 2)
++ expect(page).to have_css(".op-uc-list--task-checkbox", count: 2)
++ expect(page).to have_css(".op-uc-list--task-checkbox[checked]", count: 2)
-- first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
-- expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ first_item = page.find(".op-uc-list--item", text: "Todo item 1")
++ expect(first_item).to have_css(".op-uc-list--task-checkbox[checked]")
-- last_item = page.find('.op-uc-list .op-uc-list--item', text: 'Todo item 2')
-- expect(last_item).to have_css('.op-uc-list--task-checkbox[checked]')
++ last_item = page.find(".op-uc-list .op-uc-list--item", text: "Todo item 2")
++ expect(last_item).to have_css(".op-uc-list--task-checkbox[checked]")
end
end
end
diff --cc spec/support/shared/with_good_job.rb
index 00000000000,1cdf84367ae..3d72211e303
mode 000000,100644..100644
--- a/spec/support/shared/with_good_job.rb
+++ b/spec/support/shared/with_good_job.rb
@@@ -1,0 -1,53 +1,52 @@@
+ #-- copyright
+ # OpenProject is an open source project management software.
+ # Copyright (C) 2012-2024 the OpenProject GmbH
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License version 3.
+ #
+ # OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+ # Copyright (C) 2006-2013 Jean-Philippe Lang
+ # Copyright (C) 2010-2013 the ChiliProject Team
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program; if not, write to the Free Software
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ # See COPYRIGHT and LICENSE files for more details.
+ #++
+
+ # Disable the test adapter for the given classes
+ # allowing GoodJob to handle execution and scheduling,
+ # which in turn allows us to check concurrency controls etc.
+ RSpec.configure do |config|
+ config.around(:example, :with_good_job) do |example|
+ original_adapter = ActiveJob::Base.queue_adapter
+ good_job_adapter = GoodJob::Adapter.new(execution_mode: :inline)
+
+ begin
+ classes = Array(example.metadata[:with_good_job])
+ unless classes.all? { |cls| cls <= ApplicationJob }
+ raise ArgumentError.new("Pass the ApplicationJob subclasses you want to disable the test adapter on.")
+ end
+
+ classes.each(&:disable_test_adapter)
+ ActiveJob::Base.queue_adapter = good_job_adapter
+ example.run
-
+ ensure
+ ActiveJob::Base.queue_adapter = original_adapter
+ classes.each { |cls| cls.enable_test_adapter(original_adapter) }
+ good_job_adapter&.shutdown
+ end
+ end
+ end
diff --cc spec/support/shared/with_test_ldap.rb
index 4ebfd693f8e,caa9b02e231..bc0916e9a2f
--- a/spec/support/shared/with_test_ldap.rb
+++ b/spec/support/shared/with_test_ldap.rb
@@@ -25,22 -25,22 +25,20 @@@
#
# See COPYRIGHT and LICENSE files for more details.
#++
--require 'ladle'
++require "ladle"
--RSpec.shared_context 'with temporary LDAP' do
-- # rubocop:disable RSpec/InstanceVariable
++RSpec.shared_context "with temporary LDAP" do
before(:all) do
-- ldif = Rails.root.join('spec/fixtures/ldap/users.ldif')
++ ldif = Rails.root.join("spec/fixtures/ldap/users.ldif")
@ldap_server = Ladle::Server.new(quiet: false,
port: ParallelHelper.port_for_ldap.to_s,
-- domain: 'dc=example,dc=com',
++ domain: "dc=example,dc=com",
ldif:).start
end
after(:all) do
@ldap_server.stop
end
-- # rubocop:enable RSpec/InstanceVariable
# Ldap has:
# three users aa729, bb459, cc414
@@@ -48,18 -48,22 +46,22 @@@
let!(:ldap_auth_source) do
create(:ldap_auth_source,
port: ParallelHelper.port_for_ldap.to_s,
-- account: 'uid=admin,ou=system',
-- account_password: 'secret',
-- base_dn: 'ou=people,dc=example,dc=com',
++ account: "uid=admin,ou=system",
++ account_password: "secret",
++ base_dn: "ou=people,dc=example,dc=com",
onthefly_register:,
filter_string: ldap_filter,
-- attr_login: 'uid',
- attr_firstname: 'givenName',
- attr_lastname: 'sn',
- attr_mail: 'mail',
- attr_admin: 'isAdmin')
++ attr_login: "uid",
+ attr_firstname:,
+ attr_lastname:,
+ attr_mail:,
+ attr_admin:)
end
let(:onthefly_register) { false }
let(:ldap_filter) { nil }
- let(:attr_firstname) { 'givenName' }
- let(:attr_lastname) { 'sn' }
- let(:attr_mail) { 'mail' }
- let(:attr_admin) { 'isAdmin' }
++ let(:attr_firstname) { "givenName" }
++ let(:attr_lastname) { "sn" }
++ let(:attr_mail) { "mail" }
++ let(:attr_admin) { "isAdmin" }
end