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

lint: Run rubocop safe autocorrect

Christophe Bliard9e865b4f7b41
diff --git a/app/contracts/admin_only_contract.rb b/app/contracts/admin_only_contract.rb
index 98e3679781f..41aaaddcc28 100644
--- a/app/contracts/admin_only_contract.rb
+++ b/app/contracts/admin_only_contract.rb
@@ -27,7 +27,7 @@
#++
# A contract that only checks whether the current user is an admin
-class AdminOnlyContract < ::ModelContract
+class AdminOnlyContract < ModelContract
include RequiresAdminGuard
protected
diff --git a/app/controllers/attribute_help_texts_controller.rb b/app/controllers/attribute_help_texts_controller.rb
index aecbcf4123b..f9f33b1f3a3 100644
--- a/app/controllers/attribute_help_texts_controller.rb
+++ b/app/controllers/attribute_help_texts_controller.rb
@@ -35,6 +35,10 @@ class AttributeHelpTextsController < ApplicationController
before_action :find_entry, only: %i(edit update destroy)
before_action :find_type_scope
+ def index
+ @texts_by_type = AttributeHelpText.all_by_scope
+ end
+
def new
@attribute_help_text = AttributeHelpText.new type: @attribute_scope
end
@@ -43,32 +47,32 @@ class AttributeHelpTextsController < ApplicationController
def upsale; end
- def update
- call = ::AttributeHelpTexts::UpdateService
- .new(user: current_user, model: @attribute_help_text)
+ def create
+ call = ::AttributeHelpTexts::CreateService
+ .new(user: current_user)
.call(permitted_params_with_attachments)
if call.success?
- flash[:notice] = t(:notice_successful_update)
- redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)
+ flash[:notice] = t(:notice_successful_create)
+ redirect_to attribute_help_texts_path(tab: call.result.attribute_scope)
else
+ @attribute_help_text = call.result
flash[:error] = call.message || I18n.t('notice_internal_server_error')
- render action: 'edit'
+ render action: 'new'
end
end
- def create
- call = ::AttributeHelpTexts::CreateService
- .new(user: current_user)
+ def update
+ call = ::AttributeHelpTexts::UpdateService
+ .new(user: current_user, model: @attribute_help_text)
.call(permitted_params_with_attachments)
if call.success?
- flash[:notice] = t(:notice_successful_create)
- redirect_to attribute_help_texts_path(tab: call.result.attribute_scope)
+ flash[:notice] = t(:notice_successful_update)
+ redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)
else
- @attribute_help_text = call.result
flash[:error] = call.message || I18n.t('notice_internal_server_error')
- render action: 'new'
+ render action: 'edit'
end
end
@@ -82,10 +86,6 @@ class AttributeHelpTextsController < ApplicationController
redirect_to attribute_help_texts_path(tab: @attribute_help_text.attribute_scope)
end
- def index
- @texts_by_type = AttributeHelpText.all_by_scope
- end
-
protected
def require_ee_token
diff --git a/app/controllers/auth_sources_controller.rb b/app/controllers/auth_sources_controller.rb
index 07e9860e37b..0e53b24245b 100644
--- a/app/controllers/auth_sources_controller.rb
+++ b/app/controllers/auth_sources_controller.rb
@@ -47,6 +47,11 @@ class AuthSourcesController < ApplicationController
render 'auth_sources/new'
end
+ def edit
+ @auth_source = AuthSource.find(params[:id])
+ render 'auth_sources/edit'
+ end
+
def create
@auth_source = auth_source_class.new permitted_params.auth_source
if @auth_source.save
@@ -57,11 +62,6 @@ class AuthSourcesController < ApplicationController
end
end
- def edit
- @auth_source = AuthSource.find(params[:id])
- render 'auth_sources/edit'
- end
-
def update
@auth_source = AuthSource.find(params[:id])
updated = permitted_params.auth_source
diff --git a/app/controllers/colors_controller.rb b/app/controllers/colors_controller.rb
index b2b6fd74011..4921a1b4da4 100644
--- a/app/controllers/colors_controller.rb
+++ b/app/controllers/colors_controller.rb
@@ -53,6 +53,13 @@ class ColorsController < ApplicationController
end
end
+ def edit
+ @color = Color.find(params[:id])
+ respond_to do |format|
+ format.html
+ end
+ end
+
def create
@color = Color.new(permitted_params.color)
@@ -65,13 +72,6 @@ class ColorsController < ApplicationController
end
end
- def edit
- @color = Color.find(params[:id])
- respond_to do |format|
- format.html
- end
- end
-
def update
@color = Color.find(params[:id])
diff --git a/app/controllers/concerns/accounts/user_password_change.rb b/app/controllers/concerns/accounts/user_password_change.rb
index 4a2a27d13a9..ff4c5b8b621 100644
--- a/app/controllers/concerns/accounts/user_password_change.rb
+++ b/app/controllers/concerns/accounts/user_password_change.rb
@@ -102,8 +102,8 @@ module Accounts::UserPasswordChange
def flash_error_message(log_reason: '', flash_now: true)
flash_hash = flash_now ? flash.now : flash
- logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip}" \
- " at #{Time.now.utc}: #{log_reason}"
+ logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} " \
+ "at #{Time.now.utc}: #{log_reason}"
flash_message = yield
diff --git a/app/controllers/custom_actions_controller.rb b/app/controllers/custom_actions_controller.rb
index a52acb1a18a..c42aaab2f2d 100644
--- a/app/controllers/custom_actions_controller.rb
+++ b/app/controllers/custom_actions_controller.rb
@@ -45,6 +45,8 @@ class CustomActionsController < ApplicationController
@custom_action = CustomAction.new
end
+ def edit; end
+
def create
CustomActions::CreateService
.new(user: current_user)
@@ -52,8 +54,6 @@ class CustomActionsController < ApplicationController
&index_or_render(:new))
end
- def edit; end
-
def update
CustomActions::UpdateService
.new(action: @custom_action, user: current_user)
diff --git a/app/controllers/custom_fields_controller.rb b/app/controllers/custom_fields_controller.rb
index 40be315292e..b9637d684c4 100644
--- a/app/controllers/custom_fields_controller.rb
+++ b/app/controllers/custom_fields_controller.rb
@@ -51,6 +51,8 @@ class CustomFieldsController < ApplicationController
end
end
+ def edit; end
+
def create
call = ::CustomFields::CreateService
.new(user: current_user)
@@ -66,8 +68,6 @@ class CustomFieldsController < ApplicationController
end
end
- def edit; end
-
def update
perform_update(get_custom_field_params)
end
diff --git a/app/controllers/enumerations_controller.rb b/app/controllers/enumerations_controller.rb
index 8196417541a..eaca5109b56 100644
--- a/app/controllers/enumerations_controller.rb
+++ b/app/controllers/enumerations_controller.rb
@@ -36,8 +36,6 @@ class EnumerationsController < ApplicationController
def index; end
- def edit; end
-
def new
enum_class = enumeration_class(permitted_params.enumeration_type)
if enum_class
@@ -47,6 +45,8 @@ class EnumerationsController < ApplicationController
end
end
+ def edit; end
+
def create
enum_params = permitted_params.enumerations
type = permitted_params.enumeration_type
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index 3f961ddddf1..bf5208a0387 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -1,4 +1,4 @@
-class ErrorsController < ::ActionController::Base
+class ErrorsController < ActionController::Base
include ErrorsHelper
include OpenProjectErrorHelper
include Accounts::CurrentUser
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index 753a4ec754a..2f8a28ab9f4 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -86,6 +86,8 @@ class ForumsController < ApplicationController
def new; end
+ def edit; end
+
def create
if @forum.save
flash[:notice] = I18n.t(:notice_successful_create)
@@ -95,8 +97,6 @@ class ForumsController < ApplicationController
end
end
- def edit; end
-
def update
if @forum.update(permitted_params.forum)
flash[:notice] = I18n.t(:notice_successful_update)
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 13e37f3d88b..928b2e52003 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -70,6 +70,13 @@ class MessagesController < ApplicationController
.result
end
+ # Edit a message
+ def edit
+ return render_403 unless @message.editable_by?(User.current)
+
+ @message.attributes = permitted_params.message(@message)
+ end
+
# Create a new topic
def create
call = create_message(@forum)
@@ -97,13 +104,6 @@ class MessagesController < ApplicationController
redirect_to topic_path(@topic, r: @reply)
end
- # Edit a message
- def edit
- return render_403 unless @message.editable_by?(User.current)
-
- @message.attributes = permitted_params.message(@message)
- end
-
# Edit a message
def update
# TODO: move into contract
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index a0aa0feabc1..e899e094e9e 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -70,6 +70,8 @@ class NewsController < ApplicationController
@news = News.new(project: @project, author: User.current)
end
+ def edit; end
+
def create
@news = News.new(project: @project, author: User.current)
@news.attributes = permitted_params.news
@@ -81,8 +83,6 @@ class NewsController < ApplicationController
end
end
- def edit; end
-
def update
@news.attributes = permitted_params.news
if @news.save
diff --git a/app/controllers/oauth/applications_controller.rb b/app/controllers/oauth/applications_controller.rb
index 2d7d28d9c21..d1412c242b6 100644
--- a/app/controllers/oauth/applications_controller.rb
+++ b/app/controllers/oauth/applications_controller.rb
@@ -39,15 +39,15 @@ module OAuth
@applications = ::Doorkeeper::Application.without_integration.includes(:owner).all
end
- def new; end
-
- def edit; end
-
def show
@reveal_secret = flash[:reveal_secret]
flash.delete :reveal_secret
end
+ def new; end
+
+ def edit; end
+
def create
call = ::OAuth::PersistApplicationService.new(@application, user: current_user)
.call(permitted_params.oauth_application)
diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb
index 8c767f33c52..9e69896a2ac 100644
--- a/app/controllers/placeholder_users_controller.rb
+++ b/app/controllers/placeholder_users_controller.rb
@@ -68,6 +68,11 @@ class PlaceholderUsersController < ApplicationController
.result
end
+ def edit
+ @membership ||= Member.new
+ @individual_principal = @placeholder_user
+ end
+
def create
service = PlaceholderUsers::CreateService.new(user: User.current)
service_result = service.call(permitted_params.placeholder_user)
@@ -90,11 +95,6 @@ class PlaceholderUsersController < ApplicationController
end
end
- def edit
- @membership ||= Member.new
- @individual_principal = @placeholder_user
- end
-
def update
service_result = PlaceholderUsers::UpdateService
.new(user: User.current,
diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 10cb384214b..e52b8712195 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -51,11 +51,29 @@ class RepositoriesController < ApplicationController
rescue_from OpenProject::SCM::Exceptions::SCMError, with: :show_error_command_failed
- def update
- @repository = @project.repository
- update_repository(params.fetch(:repository, {}))
+ def show
+ if Setting.autofetch_changesets? && @path.blank?
+ @repository.fetch_changesets
+ @repository.update_required_storage
+ end
- redirect_to project_settings_repository_path(@project)
+ @limit = Setting.repository_truncate_at
+ @entries = @repository.entries(@path, @rev, limit: @limit)
+ @changeset = @repository.find_changeset_by_name(@rev)
+
+ if request.xhr?
+ if @entries && @repository.valid?
+ render(partial: 'dir_list_content')
+ else
+ render(nothing: true)
+ end
+ elsif @entries.nil? && @repository.invalid?
+ show_error_not_found
+ else
+ @changesets = @repository.latest_changesets(@path, @rev)
+ @properties = @repository.properties(@path, @rev)
+ render action: 'show'
+ end
end
def create
@@ -71,6 +89,13 @@ class RepositoriesController < ApplicationController
redirect_to project_settings_repository_path(@project)
end
+ def update
+ @repository = @project.repository
+ update_repository(params.fetch(:repository, {}))
+
+ redirect_to project_settings_repository_path(@project)
+ end
+
def committers
@committers = @repository.committers
@users = @project.users.to_a
@@ -105,31 +130,6 @@ class RepositoriesController < ApplicationController
redirect_to project_settings_repository_path(@project)
end
- def show
- if Setting.autofetch_changesets? && @path.blank?
- @repository.fetch_changesets
- @repository.update_required_storage
- end
-
- @limit = Setting.repository_truncate_at
- @entries = @repository.entries(@path, @rev, limit: @limit)
- @changeset = @repository.find_changeset_by_name(@rev)
-
- if request.xhr?
- if @entries && @repository.valid?
- render(partial: 'dir_list_content')
- else
- render(nothing: true)
- end
- elsif @entries.nil? && @repository.invalid?
- show_error_not_found
- else
- @changesets = @repository.latest_changesets(@path, @rev)
- @properties = @repository.properties(@path, @rev)
- render action: 'show'
- end
- end
-
alias_method :browse, :show
def changes
diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb
index b8fc9a7220a..15a959a444b 100644
--- a/app/controllers/roles_controller.rb
+++ b/app/controllers/roles_controller.rb
@@ -48,6 +48,11 @@ class RolesController < ApplicationController
@roles = roles_scope
end
+ def edit
+ @role = Role.find(params[:id])
+ @call = set_role_attributes(@role, 'update')
+ end
+
def create
@call = create_role
@role = @call.result
@@ -62,11 +67,6 @@ class RolesController < ApplicationController
end
end
- def edit
- @role = Role.find(params[:id])
- @call = set_role_attributes(@role, 'update')
- end
-
def update
@role = Role.find(params[:id])
@call = update_role(@role, permitted_params.role)
diff --git a/app/controllers/statuses_controller.rb b/app/controllers/statuses_controller.rb
index 749cf2c3ec3..0330a7906d7 100644
--- a/app/controllers/statuses_controller.rb
+++ b/app/controllers/statuses_controller.rb
@@ -44,6 +44,10 @@ class StatusesController < ApplicationController
@status = Status.new
end
+ def edit
+ @status = Status.find(params[:id])
+ end
+
def create
@status = Status.new(permitted_params.status)
if @status.save
@@ -54,10 +58,6 @@ class StatusesController < ApplicationController
end
end
- def edit
- @status = Status.find(params[:id])
- end
-
def update
@status = Status.find(params[:id])
if @status.update(permitted_params.status)
diff --git a/app/controllers/types_controller.rb b/app/controllers/types_controller.rb
index e87027ef2c2..99be7bfa094 100644
--- a/app/controllers/types_controller.rb
+++ b/app/controllers/types_controller.rb
@@ -46,6 +46,19 @@ class TypesController < ApplicationController
load_projects_and_types
end
+ def edit
+ if params[:tab].blank?
+ redirect_to tab: :settings
+ else
+ type = ::Type
+ .includes(:projects,
+ :custom_fields)
+ .find(params[:id])
+
+ render_edit_tab(type)
+ end
+ end
+
def create
CreateTypeService
.new(current_user)
@@ -64,19 +77,6 @@ class TypesController < ApplicationController
end
end
- def edit
- if params[:tab].blank?
- redirect_to tab: :settings
- else
- type = ::Type
- .includes(:projects,
- :custom_fields)
- .find(params[:id])
-
- render_edit_tab(type)
- end
- end
-
def update
@type = ::Type.find(params[:id])
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 2b3a9ea698f..2fc7a7b7437 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -82,6 +82,11 @@ class UsersController < ApplicationController
@user = User.new(language: Setting.default_language)
end
+ def edit
+ @membership ||= Member.new
+ @individual_principal = @user
+ end
+
def create
call = Users::CreateService
.new(user: current_user)
@@ -98,11 +103,6 @@ class UsersController < ApplicationController
end
end
- def edit
- @membership ||= Member.new
- @individual_principal = @user
- end
-
def update
update_params = build_user_update_params
call = ::Users::UpdateService.new(model: @user, user: current_user).call(update_params)
diff --git a/app/controllers/versions_controller.rb b/app/controllers/versions_controller.rb
index 660a2f4d311..bab55e44127 100644
--- a/app/controllers/versions_controller.rb
+++ b/app/controllers/versions_controller.rb
@@ -65,6 +65,8 @@ class VersionsController < ApplicationController
@version = @project.versions.build
end
+ def edit; end
+
def create
attributes = permitted_params
.version
@@ -77,8 +79,6 @@ class VersionsController < ApplicationController
render_cu(call, :notice_successful_create, 'new')
end
- def edit; end
-
def update
attributes = permitted_params
.version
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 202adb8329b..e612bb9dd0a 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -83,37 +83,6 @@ class WikiController < ApplicationController
@pages_by_parent_id = @pages.group_by(&:parent_id)
end
- def new; end
-
- def new_child
- find_existing_page
- return if performed?
-
- old_page = @page
-
- build_wiki_page_and_content
-
- @page.parent = old_page
- render action: 'new'
- end
-
- def create
- call = attachable_create_call ::WikiPages::CreateService,
- args: permitted_params.wiki_page_with_content.to_h.merge(wiki: @wiki)
-
- @page = call.result
- @content = @page.content
-
- if call.success?
- call_hook(:controller_wiki_edit_after_save, params:, page: @page)
- flash[:notice] = I18n.t(:notice_successful_create)
- redirect_to_show
- else
- @errors = call.errors
- render action: 'new'
- end
- end
-
# display a page (in editing mode if it doesn't exist)
def show
# Set the related page ID to make it the parent of new links
@@ -132,6 +101,20 @@ class WikiController < ApplicationController
@editable = editable?
end
+ def new; end
+
+ def new_child
+ find_existing_page
+ return if performed?
+
+ old_page = @page
+
+ build_wiki_page_and_content
+
+ @page.parent = old_page
+ render action: 'new'
+ end
+
# edit an existing page or a new one
def edit
@page = @wiki.find_or_new_page(wiki_page_title)
@@ -148,6 +131,23 @@ class WikiController < ApplicationController
@content.lock_version = @page.content.lock_version
end
+ def create
+ call = attachable_create_call ::WikiPages::CreateService,
+ args: permitted_params.wiki_page_with_content.to_h.merge(wiki: @wiki)
+
+ @page = call.result
+ @content = @page.content
+
+ if call.success?
+ call_hook(:controller_wiki_edit_after_save, params:, page: @page)
+ flash[:notice] = I18n.t(:notice_successful_create)
+ redirect_to_show
+ else
+ @errors = call.errors
+ render action: 'new'
+ end
+ end
+
# Creates a new page or updates an existing one
def update
@old_title = params[:id]
diff --git a/app/controllers/work_packages/auto_completes_controller.rb b/app/controllers/work_packages/auto_completes_controller.rb
index ddd67f872c4..44a8e3daf1c 100644
--- a/app/controllers/work_packages/auto_completes_controller.rb
+++ b/app/controllers/work_packages/auto_completes_controller.rb
@@ -28,7 +28,7 @@
require 'rack/utils'
-class WorkPackages::AutoCompletesController < ::ApplicationController
+class WorkPackages::AutoCompletesController < ApplicationController
def index
@work_packages = work_package_with_id | work_packages_by_subject_or_id
diff --git a/app/controllers/work_packages_controller.rb b/app/controllers/work_packages_controller.rb
index 1ea4b50c293..90832fd1aa6 100644
--- a/app/controllers/work_packages_controller.rb
+++ b/app/controllers/work_packages_controller.rb
@@ -41,42 +41,42 @@ class WorkPackagesController < ApplicationController
before_action :load_and_validate_query, only: :index, unless: -> { request.format.html? }
before_action :load_work_packages, only: :index, if: -> { request.format.atom? }
- def show
+ def index
respond_to do |format|
format.html do
- render :show,
- locals: { work_package:, menu_name: project_or_wp_query_menu },
+ render :index,
+ locals: { query: @query, project: @project, menu_name: project_or_wp_query_menu },
layout: 'angular/angular'
end
- format.any(*supported_single_formats) do
- export_single(request.format.symbol)
+ format.any(*supported_list_formats) do
+ export_list(request.format.symbol)
end
format.atom do
- atom_journals
- end
-
- format.all do
- head :not_acceptable
+ atom_list
end
end
end
- def index
+ def show
respond_to do |format|
format.html do
- render :index,
- locals: { query: @query, project: @project, menu_name: project_or_wp_query_menu },
+ render :show,
+ locals: { work_package:, menu_name: project_or_wp_query_menu },
layout: 'angular/angular'
end
- format.any(*supported_list_formats) do
- export_list(request.format.symbol)
+ format.any(*supported_single_formats) do
+ export_single(request.format.symbol)
end
format.atom do
- atom_list
+ atom_journals
+ end
+
+ format.all do
+ head :not_acceptable
end
end
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 66231d81010..46fc524e1f0 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -381,7 +381,8 @@ module ApplicationHelper
end
def calendar_for(*_args)
- ActiveSupport::Deprecation.warn "calendar_for has been removed. Please use the op-basic-single-date-picker angular component instead", caller
+ ActiveSupport::Deprecation.warn "calendar_for has been removed. Please use the op-basic-single-date-picker angular component instead",
+ caller
end
def locale_first_day_of_week
diff --git a/app/helpers/custom_fields_helper.rb b/app/helpers/custom_fields_helper.rb
index 47f4e90ce66..09db112430e 100644
--- a/app/helpers/custom_fields_helper.rb
+++ b/app/helpers/custom_fields_helper.rb
@@ -158,7 +158,7 @@ module CustomFieldsHelper
angular_component_tag 'op-modal-single-date-picker',
inputs: {
id: field_id,
- name: field_name,
+ name: field_name
}
when 'text'
styled_text_area_tag(field_name, '', id: field_id, rows: 3, with_text_formatting: true)
diff --git a/app/models/activities/base_activity_provider.rb b/app/models/activities/base_activity_provider.rb
index 8ffe8927b5c..9bd0ccea200 100644
--- a/app/models/activities/base_activity_provider.rb
+++ b/app/models/activities/base_activity_provider.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
diff --git a/app/models/activities/work_package_activity_provider.rb b/app/models/activities/work_package_activity_provider.rb
index be601b7cbdb..6ee678d2293 100644
--- a/app/models/activities/work_package_activity_provider.rb
+++ b/app/models/activities/work_package_activity_provider.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 09cc72c52fd..e965d56a42a 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -1,4 +1,4 @@
-class ApplicationRecord < ::ActiveRecord::Base
+class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
##
diff --git a/app/models/exports/exporter.rb b/app/models/exports/exporter.rb
index e1b99a22c45..6f1d05b74a6 100644
--- a/app/models/exports/exporter.rb
+++ b/app/models/exports/exporter.rb
@@ -51,7 +51,7 @@ module Exports
def sane_filename(name)
parts = name.split /(?<=.)\.(?=[^.])(?!.*\.[^.])/m
- parts.map! { |s| s.gsub /[^a-z0-9\-]+/i, '_' }
+ parts.map! { |s| s.gsub /[^a-z0-9-]+/i, '_' }
parts.join '.'
end
diff --git a/app/models/ldap_auth_source.rb b/app/models/ldap_auth_source.rb
index d7e8a9eb661..cc7c990acbf 100644
--- a/app/models/ldap_auth_source.rb
+++ b/app/models/ldap_auth_source.rb
@@ -36,11 +36,11 @@ class LdapAuthSource < AuthSource
}.freeze, _default: :start_tls
validates :tls_mode, inclusion: { in: tls_modes.keys }
- validates_presence_of :host, :port, :attr_login
- validates_length_of :name, :host, maximum: 60, allow_nil: true
- validates_length_of :account, :account_password, :base_dn, maximum: 255, allow_nil: true
- validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :attr_admin, maximum: 30, allow_nil: true
- validates_numericality_of :port, only_integer: true
+ validates :host, :port, :attr_login, presence: true
+ validates :name, :host, length: { maximum: 60, allow_nil: true }
+ validates :account, :account_password, :base_dn, length: { maximum: 255, allow_nil: true }
+ validates :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :attr_admin, length: { maximum: 30, allow_nil: true }
+ validates :port, numericality: { only_integer: true }
validate :validate_filter_string
validate :validate_tls_certificate_string, if: -> { tls_certificate_string.present? }
@@ -163,7 +163,7 @@ class LdapAuthSource < AuthSource
def strip_ldap_attributes
%i[attr_login attr_firstname attr_lastname attr_mail attr_admin].each do |attr|
- write_attribute(attr, read_attribute(attr).strip) unless read_attribute(attr).nil?
+ self[attr] = self[attr].strip unless self[attr].nil?
end
end
@@ -247,7 +247,7 @@ class LdapAuthSource < AuthSource
end
def self.get_attr(entry, attr_name)
- if !attr_name.blank?
+ if attr_name.present?
entry[attr_name].is_a?(Array) ? entry[attr_name].first : entry[attr_name]
end
end
diff --git a/app/models/paper_trail_audit.rb b/app/models/paper_trail_audit.rb
index f5a4da30f17..2537432f72b 100644
--- a/app/models/paper_trail_audit.rb
+++ b/app/models/paper_trail_audit.rb
@@ -1,4 +1,4 @@
-class PaperTrailAudit < ::ApplicationVersion
+class PaperTrailAudit < ApplicationVersion
self.table_name = :paper_trail_audits
self.sequence_name = :paper_trail_audits_id_seq
end
diff --git a/app/models/queries/work_packages/filter/work_package_filter.rb b/app/models/queries/work_packages/filter/work_package_filter.rb
index bd8482794aa..efd61585adb 100644
--- a/app/models/queries/work_packages/filter/work_package_filter.rb
+++ b/app/models/queries/work_packages/filter/work_package_filter.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Queries::WorkPackages::Filter::WorkPackageFilter < ::Queries::Filters::Base
+class Queries::WorkPackages::Filter::WorkPackageFilter < Queries::Filters::Base
include ::Queries::Filters::Serializable
self.model = WorkPackage
diff --git a/app/models/query/sort_criteria.rb b/app/models/query/sort_criteria.rb
index b392c26b2c3..bb856d2ebcd 100644
--- a/app/models/query/sort_criteria.rb
+++ b/app/models/query/sort_criteria.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class ::Query::SortCriteria < ::SortHelper::SortCriteria
+class ::Query::SortCriteria < SortHelper::SortCriteria
attr_reader :available_columns
##
diff --git a/app/models/work_package/pdf_export/work_package_to_pdf.rb b/app/models/work_package/pdf_export/work_package_to_pdf.rb
index e1a73dccd0f..6eaf99ea020 100644
--- a/app/models/work_package/pdf_export/work_package_to_pdf.rb
+++ b/app/models/work_package/pdf_export/work_package_to_pdf.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class WorkPackage::PDFExport::WorkPackageToPdf < ::Exports::Exporter
+class WorkPackage::PDFExport::WorkPackageToPdf < Exports::Exporter
include WorkPackage::PDFExport::Common
include WorkPackage::PDFExport::Formattable
include WorkPackage::PDFExport::Attachments
diff --git a/app/services/attachments/delete_service.rb b/app/services/attachments/delete_service.rb
index e19385d6927..275383772bf 100644
--- a/app/services/attachments/delete_service.rb
+++ b/app/services/attachments/delete_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Attachments::DeleteService < ::BaseServices::Delete
+class Attachments::DeleteService < BaseServices::Delete
include Attachments::TouchContainer
def call(params = {})
diff --git a/app/services/copy/concerns/copy_attachments.rb b/app/services/copy/concerns/copy_attachments.rb
index 93222e61c23..869c0d135ef 100644
--- a/app/services/copy/concerns/copy_attachments.rb
+++ b/app/services/copy/concerns/copy_attachments.rb
@@ -7,7 +7,6 @@ module Copy
Attachment
.where(container_type:, container_id: from_id)
.find_each do |source|
-
copy = Attachment
.new(attachment_copy_attributes(source, to_id))
source.file.copy_to(copy)
diff --git a/app/services/groups/create_service.rb b/app/services/groups/create_service.rb
index d5c37511f1d..4bc5594dd19 100644
--- a/app/services/groups/create_service.rb
+++ b/app/services/groups/create_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Groups::CreateService < ::BaseServices::Create; end
+class Groups::CreateService < BaseServices::Create; end
diff --git a/app/services/groups/delete_service.rb b/app/services/groups/delete_service.rb
index 2c4e2b521ae..a632093b586 100644
--- a/app/services/groups/delete_service.rb
+++ b/app/services/groups/delete_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Groups::DeleteService < ::BaseServices::Delete
+class Groups::DeleteService < BaseServices::Delete
protected
def destroy(group)
diff --git a/app/services/groups/update_service.rb b/app/services/groups/update_service.rb
index 3f0a7597db1..2cefba76718 100644
--- a/app/services/groups/update_service.rb
+++ b/app/services/groups/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Groups::UpdateService < ::BaseServices::Update
+class Groups::UpdateService < BaseServices::Update
protected
def persist(call)
diff --git a/app/services/members/create_service.rb b/app/services/members/create_service.rb
index 945d2104bf4..aa1512d9f91 100644
--- a/app/services/members/create_service.rb
+++ b/app/services/members/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Members::CreateService < ::BaseServices::Create
+class Members::CreateService < BaseServices::Create
include Members::Concerns::NotificationSender
around_call :post_process
diff --git a/app/services/members/delete_service.rb b/app/services/members/delete_service.rb
index caf011cd1fe..0b8ebd456bc 100644
--- a/app/services/members/delete_service.rb
+++ b/app/services/members/delete_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Members::DeleteService < ::BaseServices::Delete
+class Members::DeleteService < BaseServices::Delete
include Members::Concerns::CleanedUp
protected
diff --git a/app/services/members/update_service.rb b/app/services/members/update_service.rb
index 48a51b0f112..dd9a41d3e57 100644
--- a/app/services/members/update_service.rb
+++ b/app/services/members/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Members::UpdateService < ::BaseServices::Update
+class Members::UpdateService < BaseServices::Update
include Members::Concerns::CleanedUp
include Members::Concerns::NotificationSender
diff --git a/app/services/messages/create_service.rb b/app/services/messages/create_service.rb
index 5761b32695a..ce62e162d1d 100644
--- a/app/services/messages/create_service.rb
+++ b/app/services/messages/create_service.rb
@@ -26,6 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Messages::CreateService < ::BaseServices::Create
+class Messages::CreateService < BaseServices::Create
include Attachments::ReplaceAttachments
end
diff --git a/app/services/messages/update_service.rb b/app/services/messages/update_service.rb
index 33b10472a30..a86ff797755 100644
--- a/app/services/messages/update_service.rb
+++ b/app/services/messages/update_service.rb
@@ -26,6 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Messages::UpdateService < ::BaseServices::Update
+class Messages::UpdateService < BaseServices::Update
include Attachments::ReplaceAttachments
end
diff --git a/app/services/notifications/create_service.rb b/app/services/notifications/create_service.rb
index 965375f0963..14f729921cf 100644
--- a/app/services/notifications/create_service.rb
+++ b/app/services/notifications/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Notifications::CreateService < ::BaseServices::Create
+class Notifications::CreateService < BaseServices::Create
protected
def persist(service_result)
diff --git a/app/services/notifications/update_service.rb b/app/services/notifications/update_service.rb
index 5b88ac4eceb..c326e9232f4 100644
--- a/app/services/notifications/update_service.rb
+++ b/app/services/notifications/update_service.rb
@@ -26,5 +26,5 @@
# Not that at the time of writing, the usually used UpdateContract does not exist.
# Currently, this is only used internally, without user input, so it is safe to hand the EmptyContract in.
-class Notifications::UpdateService < ::BaseServices::Update
+class Notifications::UpdateService < BaseServices::Update
end
diff --git a/app/services/oauth_clients/set_attributes_service.rb b/app/services/oauth_clients/set_attributes_service.rb
index 063ce976093..176f10068f1 100644
--- a/app/services/oauth_clients/set_attributes_service.rb
+++ b/app/services/oauth_clients/set_attributes_service.rb
@@ -27,5 +27,5 @@
#++
# See also: create_service.rb for comments
-class OAuthClients::SetAttributesService < ::BaseServices::SetAttributes
+class OAuthClients::SetAttributesService < BaseServices::SetAttributes
end
diff --git a/app/services/placeholder_users/create_service.rb b/app/services/placeholder_users/create_service.rb
index e11fc8328a0..a6f91dbd7a6 100644
--- a/app/services/placeholder_users/create_service.rb
+++ b/app/services/placeholder_users/create_service.rb
@@ -26,5 +26,5 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class PlaceholderUsers::CreateService < ::BaseServices::Create
+class PlaceholderUsers::CreateService < BaseServices::Create
end
diff --git a/app/services/placeholder_users/delete_service.rb b/app/services/placeholder_users/delete_service.rb
index 3db51fc17c7..32caed4677e 100644
--- a/app/services/placeholder_users/delete_service.rb
+++ b/app/services/placeholder_users/delete_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class PlaceholderUsers::DeleteService < ::BaseServices::Delete
+class PlaceholderUsers::DeleteService < BaseServices::Delete
def destroy(placeholder)
placeholder.locked!
::Principals::DeleteJob.perform_later(placeholder)
diff --git a/app/services/placeholder_users/update_service.rb b/app/services/placeholder_users/update_service.rb
index 89ee214f155..6ce90ea6690 100644
--- a/app/services/placeholder_users/update_service.rb
+++ b/app/services/placeholder_users/update_service.rb
@@ -26,5 +26,5 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class PlaceholderUsers::UpdateService < ::BaseServices::Update
+class PlaceholderUsers::UpdateService < BaseServices::Update
end
diff --git a/app/services/queries/create_service.rb b/app/services/queries/create_service.rb
index edef1c66afc..ff3db817089 100644
--- a/app/services/queries/create_service.rb
+++ b/app/services/queries/create_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Queries::CreateService < ::BaseServices::Create; end
+class Queries::CreateService < BaseServices::Create; end
diff --git a/app/services/queries/set_attributes_service.rb b/app/services/queries/set_attributes_service.rb
index 2ab27276c59..a9a636ac913 100644
--- a/app/services/queries/set_attributes_service.rb
+++ b/app/services/queries/set_attributes_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Queries::SetAttributesService < ::BaseServices::SetAttributes
+class Queries::SetAttributesService < BaseServices::SetAttributes
def set_attributes(params)
set_ordered_work_packages params.delete(:ordered_work_packages)
super
diff --git a/app/services/queries/update_service.rb b/app/services/queries/update_service.rb
index 403e8154cda..935d1379cab 100644
--- a/app/services/queries/update_service.rb
+++ b/app/services/queries/update_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Queries::UpdateService < ::BaseServices::Update; end
+class Queries::UpdateService < BaseServices::Update; end
diff --git a/app/services/relations/base_service.rb b/app/services/relations/base_service.rb
index b38e6f029eb..82a9a46ddf2 100644
--- a/app/services/relations/base_service.rb
+++ b/app/services/relations/base_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Relations::BaseService < ::BaseServices::BaseCallable
+class Relations::BaseService < BaseServices::BaseCallable
include Contracted
include Shared::ServiceContext
diff --git a/app/services/relations/delete_service.rb b/app/services/relations/delete_service.rb
index 764c526f6b5..2f7cd345767 100644
--- a/app/services/relations/delete_service.rb
+++ b/app/services/relations/delete_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Relations::DeleteService < ::BaseServices::Delete; end
+class Relations::DeleteService < BaseServices::Delete; end
diff --git a/app/services/roles/create_service.rb b/app/services/roles/create_service.rb
index c04626c7ce2..92f166656ca 100644
--- a/app/services/roles/create_service.rb
+++ b/app/services/roles/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Roles::CreateService < ::BaseServices::Create
+class Roles::CreateService < BaseServices::Create
include Roles::NotifyMixin
private
diff --git a/app/services/roles/update_service.rb b/app/services/roles/update_service.rb
index 31b591afd19..6e0c08c9868 100644
--- a/app/services/roles/update_service.rb
+++ b/app/services/roles/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Roles::UpdateService < ::BaseServices::Update
+class Roles::UpdateService < BaseServices::Update
include Roles::NotifyMixin
private
diff --git a/app/services/versions/create_service.rb b/app/services/versions/create_service.rb
index 2d29442e694..64969d7d83d 100644
--- a/app/services/versions/create_service.rb
+++ b/app/services/versions/create_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Versions::CreateService < ::BaseServices::Create; end
+class Versions::CreateService < BaseServices::Create; end
diff --git a/app/services/versions/delete_service.rb b/app/services/versions/delete_service.rb
index e8a02e52040..ce83ae08263 100644
--- a/app/services/versions/delete_service.rb
+++ b/app/services/versions/delete_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Versions::DeleteService < ::BaseServices::Delete; end
+class Versions::DeleteService < BaseServices::Delete; end
diff --git a/app/services/views/create_service.rb b/app/services/views/create_service.rb
index e56283dce6d..f27895e80c6 100644
--- a/app/services/views/create_service.rb
+++ b/app/services/views/create_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Views::CreateService < ::BaseServices::Create; end
+class Views::CreateService < BaseServices::Create; end
diff --git a/app/services/wiki_pages/create_service.rb b/app/services/wiki_pages/create_service.rb
index cb3af146673..e5ae4529cef 100644
--- a/app/services/wiki_pages/create_service.rb
+++ b/app/services/wiki_pages/create_service.rb
@@ -26,6 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class WikiPages::CreateService < ::BaseServices::Create
+class WikiPages::CreateService < BaseServices::Create
include Attachments::ReplaceAttachments
end
diff --git a/app/services/wiki_pages/set_attributes_service.rb b/app/services/wiki_pages/set_attributes_service.rb
index a8b672feb67..d91bffa1464 100644
--- a/app/services/wiki_pages/set_attributes_service.rb
+++ b/app/services/wiki_pages/set_attributes_service.rb
@@ -33,7 +33,7 @@
# In the long run, those two should probably be unified on the data layer as well.
#
# Attributes for both the page as well as for the content are accepted.
-class WikiPages::SetAttributesService < ::BaseServices::SetAttributes
+class WikiPages::SetAttributesService < BaseServices::SetAttributes
include Attachments::SetReplacements
private
diff --git a/app/services/wiki_pages/update_service.rb b/app/services/wiki_pages/update_service.rb
index 45e9d0f9f96..937170fbf1b 100644
--- a/app/services/wiki_pages/update_service.rb
+++ b/app/services/wiki_pages/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class WikiPages::UpdateService < ::BaseServices::Update
+class WikiPages::UpdateService < BaseServices::Update
include Attachments::ReplaceAttachments
protected
diff --git a/app/services/work_packages/delete_service.rb b/app/services/work_packages/delete_service.rb
index 6e3b5a36d7a..37e3208624c 100644
--- a/app/services/work_packages/delete_service.rb
+++ b/app/services/work_packages/delete_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class WorkPackages::DeleteService < ::BaseServices::Delete
+class WorkPackages::DeleteService < BaseServices::Delete
include ::WorkPackages::Shared::UpdateAncestors
private
diff --git a/app/services/work_packages/update_service.rb b/app/services/work_packages/update_service.rb
index 12ca0cb9866..7e007069a94 100644
--- a/app/services/work_packages/update_service.rb
+++ b/app/services/work_packages/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class WorkPackages::UpdateService < ::BaseServices::Update
+class WorkPackages::UpdateService < BaseServices::Update
include ::WorkPackages::Shared::UpdateAncestors
include Attachments::ReplaceAttachments
diff --git a/app/services/workflows/bulk_update_service.rb b/app/services/workflows/bulk_update_service.rb
index bca44a61c1c..dd1c1334070 100644
--- a/app/services/workflows/bulk_update_service.rb
+++ b/app/services/workflows/bulk_update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Workflows::BulkUpdateService < ::BaseServices::Update
+class Workflows::BulkUpdateService < BaseServices::Update
def initialize(role:, type:)
@role = role
@type = type
diff --git a/app/views/common/feed.atom.builder b/app/views/common/feed.atom.builder
index 4c9356f14a0..84a6383a020 100644
--- a/app/views/common/feed.atom.builder
+++ b/app/views/common/feed.atom.builder
@@ -38,7 +38,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do
xml.id url_for(controller: '/homescreen', action: :index, only_path: false)
xml.updated(updated_time.xmlschema)
xml.author { xml.name Setting.app_title }
- xml.generator(uri: OpenProject::Info.url) { xml.text! OpenProject::Info.app_name; }
+ xml.generator(uri: OpenProject::Info.url) { xml.text! OpenProject::Info.app_name }
@items.each do |item|
item_event = !first_item.nil? && first_item.respond_to?(:data) ? item.data : item
diff --git a/app/workers/application_job.rb b/app/workers/application_job.rb
index 8ff3ee81196..ead4ca7c060 100644
--- a/app/workers/application_job.rb
+++ b/app/workers/application_job.rb
@@ -28,7 +28,7 @@
require 'active_job'
-class ApplicationJob < ::ActiveJob::Base
+class ApplicationJob < ActiveJob::Base
include ::JobStatus::ApplicationJobWithStatus
##
diff --git a/app/workers/attachments/cleanup_uncontainered_job.rb b/app/workers/attachments/cleanup_uncontainered_job.rb
index 02f35cd5758..5f94daaa428 100644
--- a/app/workers/attachments/cleanup_uncontainered_job.rb
+++ b/app/workers/attachments/cleanup_uncontainered_job.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Attachments::CleanupUncontaineredJob < ::Cron::CronJob
+class Attachments::CleanupUncontaineredJob < Cron::CronJob
queue_with_priority :low
# runs at 10:03 pm
diff --git a/app/workers/backup_job.rb b/app/workers/backup_job.rb
index 142b17f00b7..ed584fb5388 100644
--- a/app/workers/backup_job.rb
+++ b/app/workers/backup_job.rb
@@ -29,7 +29,7 @@
require 'tempfile'
require 'zip'
-class BackupJob < ::ApplicationJob
+class BackupJob < ApplicationJob
queue_with_priority :above_normal
attr_reader :backup, :user
diff --git a/lib/api/decorators/single.rb b/lib/api/decorators/single.rb
index 2e39b03d141..702053e3951 100644
--- a/lib/api/decorators/single.rb
+++ b/lib/api/decorators/single.rb
@@ -65,7 +65,6 @@ module API
render_nil: false,
writable: false
-
class_attribute :to_eager_load
class_attribute :checked_permissions
diff --git a/lib/api/open_project_api.rb b/lib/api/open_project_api.rb
index d6daaba8885..b68cf3e82df 100644
--- a/lib/api/open_project_api.rb
+++ b/lib/api/open_project_api.rb
@@ -61,6 +61,6 @@ Grape::DSL::Routing::ClassMethods.module_eval do
end
def patches
- ::Constants::APIPatchRegistry.patches_for(base)
+ Constants::APIPatchRegistry.patches_for(base)
end
end
diff --git a/lib/core_extensions.rb b/lib/core_extensions.rb
index 40578ce7021..32bdd3c4b1b 100644
--- a/lib/core_extensions.rb
+++ b/lib/core_extensions.rb
@@ -29,5 +29,5 @@
require 'core_extensions/string'
require 'core_extensions/time_with_zone'
-::String.prepend CoreExtensions::String
-::ActiveSupport::TimeWithZone.include CoreExtensions::TimeWithZone
+String.prepend CoreExtensions::String
+ActiveSupport::TimeWithZone.include CoreExtensions::TimeWithZone
diff --git a/lib/open_project/journal_formatter/attachment.rb b/lib/open_project/journal_formatter/attachment.rb
index d9b18b3cfe7..9b323b8c4fb 100644
--- a/lib/open_project/journal_formatter/attachment.rb
+++ b/lib/open_project/journal_formatter/attachment.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class OpenProject::JournalFormatter::Attachment < ::JournalFormatter::Base
+class OpenProject::JournalFormatter::Attachment < JournalFormatter::Base
include ApplicationHelper
include OpenProject::StaticRouting::UrlHelpers
include OpenProject::ObjectLinking
diff --git a/lib/open_project/journal_formatter/custom_field.rb b/lib/open_project/journal_formatter/custom_field.rb
index 360196dac30..2f85550dc37 100644
--- a/lib/open_project/journal_formatter/custom_field.rb
+++ b/lib/open_project/journal_formatter/custom_field.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class OpenProject::JournalFormatter::CustomField < ::JournalFormatter::Base
+class OpenProject::JournalFormatter::CustomField < JournalFormatter::Base
include CustomFieldsHelper
private
diff --git a/lib/open_project/patches/delivery_job.rb b/lib/open_project/patches/delivery_job.rb
index 3d90026dea0..21ae39c7331 100644
--- a/lib/open_project/patches/delivery_job.rb
+++ b/lib/open_project/patches/delivery_job.rb
@@ -37,4 +37,4 @@ module OpenProject
end
end
-ActionMailer::MailDeliveryJob.include ::JobStatus::ApplicationJobWithStatus
+ActionMailer::MailDeliveryJob.include JobStatus::ApplicationJobWithStatus
diff --git a/lib/open_project/scm/adapters/local_client.rb b/lib/open_project/scm/adapters/local_client.rb
index 6356f754cf8..f997322550e 100644
--- a/lib/open_project/scm/adapters/local_client.rb
+++ b/lib/open_project/scm/adapters/local_client.rb
@@ -41,7 +41,7 @@ module OpenProject
# Reads the configuration for this strategy from OpenProject's `configuration.yml`.
def config
['scm', vendor].inject(OpenProject::Configuration) do |acc, key|
- HashWithIndifferentAccess.new acc[key]
+ ActiveSupport::HashWithIndifferentAccess.new acc[key]
end
end
end
diff --git a/lib/open_project/text_formatting/formats.rb b/lib/open_project/text_formatting/formats.rb
index cbc0c53d315..247c48d69d5 100644
--- a/lib/open_project/text_formatting/formats.rb
+++ b/lib/open_project/text_formatting/formats.rb
@@ -60,5 +60,5 @@ module OpenProject::TextFormatting
end
end
-OpenProject::TextFormatting::Formats.register_plain! ::OpenProject::TextFormatting::Formats::Plain::Format
-OpenProject::TextFormatting::Formats.register_rich! ::OpenProject::TextFormatting::Formats::Markdown::Format
+OpenProject::TextFormatting::Formats.register_plain! OpenProject::TextFormatting::Formats::Plain::Format
+OpenProject::TextFormatting::Formats.register_rich! OpenProject::TextFormatting::Formats::Markdown::Format
diff --git a/lib/redmine/gmail.rb b/lib/redmine/gmail.rb
index bca0b8838c1..8040f1a7e0f 100644
--- a/lib/redmine/gmail.rb
+++ b/lib/redmine/gmail.rb
@@ -4,7 +4,7 @@ require 'googleauth'
module Redmine
module Gmail
class << self
- def check(gmail_options={}, options={})
+ def check(gmail_options = {}, options = {})
credentials = gmail_options[:credentials] || ""
username = gmail_options[:user_id] || ""
query = gmail_options[:query] || ""
@@ -39,7 +39,7 @@ module Redmine
message_error(message_id, gmail, gmail_options)
end
- def message_received(message_id, gmail, gmail_options)
+ def message_received(message_id, gmail, _gmail_options)
log_debug { "Message #{message_id} successfully received" }
modify_request = Google::Apis::GmailV1::ModifyThreadRequest.new(remove_label_ids: ['UNREAD'])
diff --git a/lib/tasks/attachment_migrations.rake b/lib/tasks/attachment_migrations.rake
index ecc4dce4168..167e41b2c21 100644
--- a/lib/tasks/attachment_migrations.rake
+++ b/lib/tasks/attachment_migrations.rake
@@ -51,8 +51,8 @@ end
namespace :migrations do
namespace :attachments do
- include ::Tasks::Shared::UserFeedback
- include ::Tasks::Shared::AttachmentMigration
+ include Tasks::Shared::UserFeedback
+ include Tasks::Shared::AttachmentMigration
desc 'Removes all attachments from versions and projects'
task delete_from_projects_and_versions: :environment do |_task|
diff --git a/lib/tasks/cron.rake b/lib/tasks/cron.rake
index 9d52389a22f..5a1b90227cc 100644
--- a/lib/tasks/cron.rake
+++ b/lib/tasks/cron.rake
@@ -36,6 +36,6 @@ namespace 'openproject:cron' do
# making sure cron jobs are scheduled. See lib/tasks/delayed_job.rake.
desc 'Ensure the cron-like background jobs are actively scheduled'
task schedule: [:environment] do
- ::Cron::CronJob.schedule_registered_jobs!
+ Cron::CronJob.schedule_registered_jobs!
end
end
diff --git a/lib/tasks/environment.rake b/lib/tasks/environment.rake
index 79eaf92c1a8..81cae268697 100644
--- a/lib/tasks/environment.rake
+++ b/lib/tasks/environment.rake
@@ -38,6 +38,6 @@ namespace 'environment' do
desc 'Eager load the application (only applicable in dev mode)'
task eager_load: :environment do
- ::Zeitwerk::Loader.eager_load_all if Rails.env.development?
+ Zeitwerk::Loader.eager_load_all if Rails.env.development?
end
end
diff --git a/lib/tasks/ldap.rake b/lib/tasks/ldap.rake
index 731ae3f7f32..e3409ca843e 100644
--- a/lib/tasks/ldap.rake
+++ b/lib/tasks/ldap.rake
@@ -45,7 +45,7 @@ namespace :ldap do
ldap = LdapAuthSource.find_by!(name: args.fetch(:name))
logins = args.fetch(:logins, '').split(/\s*,\s*/)
- ::Ldap::SynchronizeUsersService
+ Ldap::SynchronizeUsersService
.new(ldap, logins)
.call
end
@@ -60,7 +60,7 @@ namespace :ldap do
# Parse filter string if available
filter = Net::LDAP::Filter.from_rfc2254 args.fetch(:filter, 'objectClass = *')
- ::Ldap::ImportUsersFromFilterService
+ Ldap::ImportUsersFromFilterService
.new(ldap, filter)
.call
end
@@ -75,7 +75,7 @@ namespace :ldap do
puts "--> Reading username file #{file}"
users = File.read(file).lines(chomp: true)
- ::Ldap::ImportUsersFromListService
+ Ldap::ImportUsersFromListService
.new(ldap, users)
.call
end
diff --git a/lib/tasks/plugins.rake b/lib/tasks/plugins.rake
index 4ed562e91aa..8b309afab33 100644
--- a/lib/tasks/plugins.rake
+++ b/lib/tasks/plugins.rake
@@ -32,7 +32,7 @@ namespace :openproject do
namespace :plugins do
desc 'Register plugins from the :opf_plugins bundle group to the frontend'
task register_frontend: [:environment] do
- ::OpenProject::Plugins::FrontendLinking.regenerate!
+ OpenProject::Plugins::FrontendLinking.regenerate!
end
end
end
diff --git a/lib/tasks/scm.rake b/lib/tasks/scm.rake
index 2b9b9eec5a5..16507435adb 100644
--- a/lib/tasks/scm.rake
+++ b/lib/tasks/scm.rake
@@ -66,8 +66,8 @@ namespace :scm do
end
unless Dir.exist?(managed)
- warn "WARNING: Managed repository path set to '#{managed}'," \
- " but does not exist for SCM vendor #{vendor}!"
+ warn "WARNING: Managed repository path set to '#{managed}', " \
+ "but does not exist for SCM vendor #{vendor}!"
next
end
diff --git a/lib/tasks/setting.rake b/lib/tasks/setting.rake
index 3701200682a..e5037340d9c 100644
--- a/lib/tasks/setting.rake
+++ b/lib/tasks/setting.rake
@@ -62,8 +62,8 @@ namespace :setting do
desc 'List the supported environment variables to override settings'
task available_envs: :environment do
Settings::Definition.all.sort.each do |_name, definition|
- puts "#{Settings::Definition.possible_env_names(definition).first}" \
- " (default=#{definition.default.inspect}) #{definition.description}"
+ puts "#{Settings::Definition.possible_env_names(definition).first} " \
+ "(default=#{definition.default.inspect}) #{definition.description}"
end
end
end
diff --git a/lib/tasks/version.rake b/lib/tasks/version.rake
index 8e2be7c9c09..38cdbc99f6f 100644
--- a/lib/tasks/version.rake
+++ b/lib/tasks/version.rake
@@ -29,5 +29,5 @@
require 'open_project/version'
desc 'Displays the current version of OpenProject'
task :version do
- puts ::OpenProject::VERSION.to_semver
+ puts OpenProject::VERSION.to_semver
end
diff --git a/lib_static/open_project/authentication/manager.rb b/lib_static/open_project/authentication/manager.rb
index 472bbe2b82a..35c4f6f841f 100644
--- a/lib_static/open_project/authentication/manager.rb
+++ b/lib_static/open_project/authentication/manager.rb
@@ -1,5 +1,3 @@
-require 'set'
-
module OpenProject
module Authentication
class Manager < Warden::Manager
diff --git a/lib_static/open_project/authentication/strategies/warden/global_basic_auth.rb b/lib_static/open_project/authentication/strategies/warden/global_basic_auth.rb
index 4f2a26e7177..c23a7fdf023 100644
--- a/lib_static/open_project/authentication/strategies/warden/global_basic_auth.rb
+++ b/lib_static/open_project/authentication/strategies/warden/global_basic_auth.rb
@@ -51,7 +51,7 @@ module OpenProject
def self.openproject_config
config = OpenProject::Configuration
%w(authentication global_basic_auth).inject(config) do |acc, key|
- HashWithIndifferentAccess.new acc[key]
+ ActiveSupport::HashWithIndifferentAccess.new acc[key]
end
end
diff --git a/modules/avatars/spec/features/my_avatar_spec.rb b/modules/avatars/spec/features/my_avatar_spec.rb
index d6d674741e2..b3b89813767 100644
--- a/modules/avatars/spec/features/my_avatar_spec.rb
+++ b/modules/avatars/spec/features/my_avatar_spec.rb
@@ -26,7 +26,7 @@ describe 'My avatar management', js: true do
expect(page).to have_text '[Error 404]'
visit my_account_path
- expect(page).to have_no_selector '.avatar-menu-item'
+ expect(page).not_to have_selector '.avatar-menu-item'
end
end
end
diff --git a/modules/avatars/spec/features/shared_avatar_examples.rb b/modules/avatars/spec/features/shared_avatar_examples.rb
index a8ecf5bff32..1cfa78a0181 100644
--- a/modules/avatars/spec/features/shared_avatar_examples.rb
+++ b/modules/avatars/spec/features/shared_avatar_examples.rb
@@ -28,8 +28,8 @@ shared_examples 'avatar management' do
expect(page).to have_selector('.avatars--current-gravatar')
# Local not rendered
- expect(page).to have_no_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
- expect(page).to have_no_selector('.avatars--current-local-avatar', text: 'none')
+ expect(page).not_to have_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
+ expect(page).not_to have_selector('.avatars--current-local-avatar', text: 'none')
end
end
@@ -42,10 +42,10 @@ shared_examples 'avatar management' do
expect(page).to have_selector('.avatars--current-local-avatar', text: 'none')
# Gravatars not rendered
- expect(page).to have_no_selector('.form--fieldset-legend', text: 'GRAVATAR')
+ expect(page).not_to have_selector('.form--fieldset-legend', text: 'GRAVATAR')
# Attach a new invalid image
- find('#avatar_file_input').set UploadedFile.load_from(File.join(image_base_path, 'invalid.txt')).path
+ find_by_id('avatar_file_input').set UploadedFile.load_from(File.join(image_base_path, 'invalid.txt')).path
# Expect error
expect(page).to have_selector('.form--label.-error')
@@ -54,11 +54,11 @@ shared_examples 'avatar management' do
# Attach new image
visit avatar_management_path
expect(page).to have_selector('.avatars--current-local-avatar', text: 'none')
- find('#avatar_file_input').set UploadedFile.load_from(File.join(image_base_path, 'too_big.jpg')).path
+ find_by_id('avatar_file_input').set UploadedFile.load_from(File.join(image_base_path, 'too_big.jpg')).path
# Expect not error, since ng-file-upload resizes the image
- expect(page).to have_no_selector('.form--label.-error')
- expect(page).to have_no_selector('.avatars--error-pane span')
+ expect(page).not_to have_selector('.form--label.-error')
+ expect(page).not_to have_selector('.avatars--error-pane span')
# Expect preview
expect(page).to have_selector('.preview img')
diff --git a/modules/avatars/spec/features/user_avatar_spec.rb b/modules/avatars/spec/features/user_avatar_spec.rb
index cacad8a27e8..e8ea8737857 100644
--- a/modules/avatars/spec/features/user_avatar_spec.rb
+++ b/modules/avatars/spec/features/user_avatar_spec.rb
@@ -48,7 +48,7 @@ describe 'User avatar management', js: true do
it 'does not render the user edit tab' do
visit edit_user_path(user)
- expect(page).to have_no_selector '#tab-avatar'
+ expect(page).not_to have_selector '#tab-avatar'
end
end
end
diff --git a/modules/avatars/spec/models/user_spec.rb b/modules/avatars/spec/models/user_spec.rb
index d5ee4a1833b..a3ddc822704 100644
--- a/modules/avatars/spec/models/user_spec.rb
+++ b/modules/avatars/spec/models/user_spec.rb
@@ -6,7 +6,7 @@ describe User do
include_examples "there are users with and without avatars"
- specify { expect(user.attachments).to all be_a_kind_of Attachment }
+ specify { expect(user.attachments).to all be_a Attachment }
describe "#local_avatar_attachment" do
subject { user.local_avatar_attachment }
@@ -14,7 +14,7 @@ describe User do
context "WHEN user has an avatar" do
let(:user) { user_with_avatar }
- it { is_expected.to be_a_kind_of Attachment }
+ it { is_expected.to be_a Attachment }
end
context "WHEN user has no avatar" do
diff --git a/modules/backlogs/lib/open_project/backlogs/list.rb b/modules/backlogs/lib/open_project/backlogs/list.rb
index a2feae645ae..5ddabb6de28 100644
--- a/modules/backlogs/lib/open_project/backlogs/list.rb
+++ b/modules/backlogs/lib/open_project/backlogs/list.rb
@@ -83,7 +83,7 @@ module OpenProject::Backlogs::List
# Override acts_as_list implementation to avoid it calling save.
# Calling save would remove the changes/saved_changes information.
- def set_list_position(new_position, _raise_exception_if_save_fails = false) # rubocop:disable Style/OptionalBooleanParameter
+ def set_list_position(new_position, _raise_exception_if_save_fails = false)
update_columns(position: new_position)
end
diff --git a/modules/backlogs/spec/features/empty_backlogs_spec.rb b/modules/backlogs/spec/features/empty_backlogs_spec.rb
index c9c5abdf6da..ae8c39168ca 100644
--- a/modules/backlogs/spec/features/empty_backlogs_spec.rb
+++ b/modules/backlogs/spec/features/empty_backlogs_spec.rb
@@ -66,7 +66,7 @@ describe 'Empty backlogs project',
it 'onlies show a no results box' do
expect(page).to have_selector '.generic-table--no-results-container', text: I18n.t(:backlogs_empty_title)
- expect(page).to have_no_selector '.generic-table--no-results-description'
+ expect(page).not_to have_selector '.generic-table--no-results-description'
end
end
end
diff --git a/modules/backlogs/spec/models/burndown_spec.rb b/modules/backlogs/spec/models/burndown_spec.rb
index 8ff2ebcd9dd..9c9a8e6628c 100644
--- a/modules/backlogs/spec/models/burndown_spec.rb
+++ b/modules/backlogs/spec/models/burndown_spec.rb
@@ -157,7 +157,7 @@ describe Burndown do
let!(:stories) do
stories = []
- (0..9).each do |i|
+ 10.times do |i|
stories[i] = create(:story, subject: "Story #{i}",
project:,
version:,
@@ -181,7 +181,7 @@ describe Burndown do
describe 'WITH 5 stories having been reduced to 0 story points, one story per day' do
before do
- (0..4).each do |i|
+ 5.times do |i|
set_attribute_journalized stories[i], :story_points=, nil, version.start_date + i.days + 1.hour
end
end
diff --git a/modules/backlogs/spec/support/pages/taskboard.rb b/modules/backlogs/spec/support/pages/taskboard.rb
index 23ba9c355e8..78a13124e56 100644
--- a/modules/backlogs/spec/support/pages/taskboard.rb
+++ b/modules/backlogs/spec/support/pages/taskboard.rb
@@ -70,8 +70,8 @@ module Pages
change_attributes_in_modal(attributes)
- expect(page).to have_no_selector('.ui-dialog')
- expect(page).to have_no_selector('#work_package_')
+ expect(page).not_to have_selector('.ui-dialog')
+ expect(page).not_to have_selector('#work_package_')
end
def update_task(task, attributes)
@@ -79,7 +79,7 @@ module Pages
change_attributes_in_modal(attributes)
- expect(page).to have_no_selector('.ui-dialog')
+ expect(page).not_to have_selector('.ui-dialog')
sleep(0.5)
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/comments/api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/comments/api.rb
index a55bcc01448..b8b1c6aa6b1 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/comments/api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/comments/api.rb
@@ -79,7 +79,7 @@ module Bim::Bcf::API::V2_1
requires :comment_guid, type: String, desc: 'The comment\'s UUID'
end
- route_param :comment_guid, regexp: /\A[a-f0-9\-]+\z/ do
+ route_param :comment_guid, regexp: /\A[a-f0-9-]+\z/ do
after_validation do
@comment = all_comments.find_by!(uuid: declared_params[:comment_guid])
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
index c16182d93ab..3c2761f4737 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/topics_api.rb
@@ -81,7 +81,7 @@ module Bim::Bcf::API::V2_1
})
.mount
- route_param :topic_uuid, regexp: /\A[a-f0-9\-]+\z/ do
+ route_param :topic_uuid, regexp: /\A[a-f0-9-]+\z/ do
after_validation do
@issue = topics.find_by!(uuid: params[:topic_uuid])
end
diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
index dddec8e08fb..dfe1e234fe9 100644
--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
@@ -50,7 +50,7 @@ module Bim::Bcf::API::V2_1
})
.mount
- route_param :viewpoint_uuid, regexp: /\A[a-f0-9\-]+\z/ do
+ route_param :viewpoint_uuid, regexp: /\A[a-f0-9-]+\z/ do
%i[/ selection coloring visibility].each do |key|
namespace = key == :/ ? :Full : key.to_s.camelize
diff --git a/modules/bim/config/routes.rb b/modules/bim/config/routes.rb
index 1849d7a76b5..f870fdef8b8 100644
--- a/modules/bim/config/routes.rb
+++ b/modules/bim/config/routes.rb
@@ -28,7 +28,7 @@
OpenProject::Application.routes.draw do
scope '', as: 'bcf' do
- mount ::Bim::Bcf::API::Root => '/api/bcf'
+ mount Bim::Bcf::API::Root => '/api/bcf'
scope 'projects/:project_id', as: 'project' do
resources :issues, controller: 'bim/bcf/issues' do
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
index 5173221d2f6..080ddda4102 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
@@ -192,7 +192,7 @@ module OpenProject::Bim::BcfXml
# Save the viewpoint as json
json_viewpoint: viewpoint_as_json(vp[:uuid], read_entry(vp[:viewpoint])),
- viewpoint_name: vp[:viewpoint],
+ viewpoint_name: vp[:viewpoint]
)
# Save the snapshot as file attachment
diff --git a/modules/bim/lib/open_project/bim/engine.rb b/modules/bim/lib/open_project/bim/engine.rb
index e8c287e3d97..f31a02e9af5 100644
--- a/modules/bim/lib/open_project/bim/engine.rb
+++ b/modules/bim/lib/open_project/bim/engine.rb
@@ -37,8 +37,7 @@ module OpenProject::Bim
register 'openproject-bim',
author_url: 'https://www.openproject.org',
settings: {
- default: {
- }
+ default: {}
} do
project_module(:bim,
dependencies: :work_package_tracking,
@@ -199,7 +198,6 @@ module OpenProject::Bim
Mime::Type.register "application/octet-stream", :bcfzip unless Mime::Type.lookup_by_extension(:bcfzip)
end
- # rubocop:disable Naming/VariableNumber
config.to_prepare do
Doorkeeper.configuration.scopes.add(:bcf_v2_1)
@@ -214,8 +212,6 @@ module OpenProject::Bim
%i[oauth session]
end
end
- # rubocop:enable Naming/VariableNumber
-
config.to_prepare do
::Exports::Register.register do
list ::WorkPackage, OpenProject::Bim::BcfXml::Exporter
diff --git a/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb b/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
index f02093b51b0..03bde549d67 100644
--- a/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
@@ -33,8 +33,8 @@ describe Bim::IfcModels::CreateContract do
it_behaves_like 'ifc model contract' do
let(:ifc_model) do
Bim::IfcModels::IfcModel.new(project: model_project,
- title: model_title,
- uploader: model_user).tap do |m|
+ title: model_title,
+ uploader: model_user).tap do |m|
m.extend(OpenProject::ChangedBySystem)
m.changed_by_system("uploader_id" => [nil, model_user.id])
end
diff --git a/modules/bim/spec/features/bcf/api_authorization_spec.rb b/modules/bim/spec/features/bcf/api_authorization_spec.rb
index 61912dafdf7..71caa48bdfc 100644
--- a/modules/bim/spec/features/bcf/api_authorization_spec.rb
+++ b/modules/bim/spec/features/bcf/api_authorization_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
describe 'authorization for BCF api',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let!(:user) { create(:admin) }
let(:client_secret) { app.plaintext_secret }
let(:scope) { 'bcf_v2_1' }
@@ -90,7 +89,7 @@ describe 'authorization for BCF api',
find('input.button[value="Authorize"]').click
# Expect auth token
- code = find('#authorization_code').text
+ code = find_by_id('authorization_code').text
# And also have a grant for this application
user.oauth_grants.reload
diff --git a/modules/bim/spec/features/bcf_view_management_spec.rb b/modules/bim/spec/features/bcf_view_management_spec.rb
index d90df7a9a04..8fd72257256 100644
--- a/modules/bim/spec/features/bcf_view_management_spec.rb
+++ b/modules/bim/spec/features/bcf_view_management_spec.rb
@@ -32,8 +32,7 @@ require_relative '../support/pages/ifc_models/show_default'
require_relative '../../../../spec/features/views/shared_examples'
describe 'bcf view management',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:bcf_page) { Pages::IfcModels::ShowDefault.new(project) }
let(:role) do
diff --git a/modules/bim/spec/features/bim_filter_spec.rb b/modules/bim/spec/features/bim_filter_spec.rb
index 01034e657f3..2a9fde8e6db 100644
--- a/modules/bim/spec/features/bim_filter_spec.rb
+++ b/modules/bim/spec/features/bim_filter_spec.rb
@@ -32,8 +32,7 @@ require_relative '../support/pages/ifc_models/show'
require_relative '../support/pages/ifc_models/show_default'
describe 'BIM filter spec',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %w(bim work_package_tracking)) }
let(:open_status) { create(:status, is_closed: false) }
let(:closed_status) { create(:status, is_closed: true) }
diff --git a/modules/bim/spec/features/bim_navigation_spec.rb b/modules/bim/spec/features/bim_navigation_spec.rb
index 8e8b633a415..f8d8123b9c5 100644
--- a/modules/bim/spec/features/bim_navigation_spec.rb
+++ b/modules/bim/spec/features/bim_navigation_spec.rb
@@ -29,8 +29,7 @@
require_relative '../spec_helper'
describe 'BIM navigation spec',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let!(:work_package) { create(:work_package, project:) }
let(:role) do
@@ -105,7 +104,7 @@ describe 'BIM navigation spec',
model_page.switch_view 'Viewer'
model_page.model_viewer_visible true
- expect(page).to have_no_selector('[data-qa-selector="op-wp-card-view"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-wp-card-view"]')
# Go to list only
model_page.switch_view 'Cards'
diff --git a/modules/bim/spec/features/ifc_models/direct_ifc_upload_spec.rb b/modules/bim/spec/features/ifc_models/direct_ifc_upload_spec.rb
index 57636317228..3f42dc5d0e4 100644
--- a/modules/bim/spec/features/ifc_models/direct_ifc_upload_spec.rb
+++ b/modules/bim/spec/features/ifc_models/direct_ifc_upload_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative './ifc_upload_shared_examples'
-describe 'direct IFC upload', js: true, with_direct_uploads: :redirect, with_config: { edition: 'bim' } do
+describe 'direct IFC upload', js: true, with_config: { edition: 'bim' }, with_direct_uploads: :redirect do
it_behaves_like 'can upload an IFC file' do
# with direct upload, we don't get the model name
let(:model_name) { 'model.ifc' }
diff --git a/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb b/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb
index b5801e61f30..c3b7dad0aca 100644
--- a/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb
+++ b/modules/bim/spec/features/ifc_models/ifc_upload_shared_examples.rb
@@ -14,9 +14,9 @@ shared_examples 'can upload an IFC file' do
it 'allows uploading an IFC file' do
visit new_bcf_project_ifc_model_path(project_id: project.identifier)
- page.find('#bim_ifc_models_ifc_model_is_default').set(true) unless set_tick_is_default_after_file
+ page.find_by_id('bim_ifc_models_ifc_model_is_default').set(true) unless set_tick_is_default_after_file
page.attach_file("file", ifc_fixture.path, visible: :all)
- page.find('#bim_ifc_models_ifc_model_is_default').set true if set_tick_is_default_after_file
+ page.find_by_id('bim_ifc_models_ifc_model_is_default').set true if set_tick_is_default_after_file
click_on "Create"
diff --git a/modules/bim/spec/features/model_management_spec.rb b/modules/bim/spec/features/model_management_spec.rb
index 27c33658269..c7b143aa19f 100644
--- a/modules/bim/spec/features/model_management_spec.rb
+++ b/modules/bim/spec/features/model_management_spec.rb
@@ -31,8 +31,7 @@ require 'spec_helper'
require_relative '../support/pages/ifc_models/index'
describe 'model management',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:index_page) { Pages::IfcModels::Index.new(project) }
let(:role) { create(:role, permissions: %i[view_ifc_models manage_bcf manage_ifc_models view_work_packages]) }
diff --git a/modules/bim/spec/features/model_viewer_spec.rb b/modules/bim/spec/features/model_viewer_spec.rb
index 37869808091..cfe8a5f0bcd 100644
--- a/modules/bim/spec/features/model_viewer_spec.rb
+++ b/modules/bim/spec/features/model_viewer_spec.rb
@@ -29,8 +29,7 @@
require_relative '../spec_helper'
describe 'model viewer',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
# TODO: Add empty viewpoint and stub method to load viewpoints once defined
let(:work_package) { create(:work_package, project:) }
diff --git a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
index a81f14ea9d1..ff41cd78e18 100644
--- a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
+++ b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_navigation_spec.rb
@@ -29,9 +29,7 @@
require_relative '../../spec_helper'
describe 'BIM Revit Add-in navigation spec',
- with_config: { edition: 'bim' },
- js: true,
- driver: :chrome_revit_add_in do
+ driver: :chrome_revit_add_in, js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let!(:work_package) { create(:work_package, project:) }
let(:role) do
diff --git a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_refresh_button_spec.rb b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_refresh_button_spec.rb
index adb4d097f79..5573ea603dd 100644
--- a/modules/bim/spec/features/revit_add_in/bim_revit_add_in_refresh_button_spec.rb
+++ b/modules/bim/spec/features/revit_add_in/bim_revit_add_in_refresh_button_spec.rb
@@ -29,9 +29,7 @@
require_relative '../../spec_helper'
describe 'BIM Revit Add-in navigation spec',
- with_config: { edition: 'bim' },
- js: true,
- driver: :chrome_revit_add_in do
+ driver: :chrome_revit_add_in, js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let!(:work_package) { create(:work_package, project:) }
let(:role) do
diff --git a/modules/bim/spec/features/show_default_spec.rb b/modules/bim/spec/features/show_default_spec.rb
index 3025ba766e5..438bd31138d 100644
--- a/modules/bim/spec/features/show_default_spec.rb
+++ b/modules/bim/spec/features/show_default_spec.rb
@@ -29,8 +29,7 @@
require_relative '../spec_helper'
describe 'show default model',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:index_page) { Pages::IfcModels::Index.new(project) }
let(:show_default_page) { Pages::IfcModels::ShowDefault.new(project) }
diff --git a/modules/bim/spec/features/viewer/create_viewpoint_spec.rb b/modules/bim/spec/features/viewer/create_viewpoint_spec.rb
index ce38de982fa..b5ae7425f5e 100644
--- a/modules/bim/spec/features/viewer/create_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/create_viewpoint_spec.rb
@@ -29,8 +29,7 @@
require_relative '../../spec_helper'
describe 'Create viewpoint from BCF details page',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:user) { create(:admin) }
diff --git a/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb b/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb
index 9f7d7c3324e..28079d606a5 100644
--- a/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb
@@ -29,8 +29,7 @@
require_relative '../../spec_helper'
describe 'Delete viewpoint in model viewer',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %i[bim work_package_tracking]) }
let(:user) { create(:admin) }
diff --git a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
index 01bc3c4da24..a8f598cc3e5 100644
--- a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
@@ -29,8 +29,7 @@
require_relative '../../spec_helper'
describe 'Show viewpoint in model viewer',
- with_config: { edition: 'bim' },
- js: true do
+ js: true, with_config: { edition: 'bim' } do
let(:project) do
create(:project,
enabled_module_names: %i[bim work_package_tracking],
@@ -146,7 +145,7 @@ describe 'Show viewpoint in model viewer',
it 'does not show the viewpoint' do
wp_details.visit!
bcf_details.expect_viewpoint_count(0)
- expect(page).to have_no_selector('h3.attributes-group--header-text', text: 'BCF')
+ expect(page).not_to have_selector('h3.attributes-group--header-text', text: 'BCF')
end
end
end
diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
index 664b45c774a..c6fa43154df 100644
--- a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
+++ b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_shared_examples.rb
@@ -50,15 +50,15 @@ end
shared_examples 'has camera' do |camera_type|
it 'has a camera object' do
# camera xyz floats
- expect(subject.dig(camera_type)).to be_kind_of(Hash)
- expect(subject.dig(camera_type, 'field_of_view')).to be_kind_of(Numeric) if camera_type == 'perspective_camera'
- expect(subject.dig(camera_type, 'view_to_world_scale')).to be_kind_of(Numeric) if camera_type == 'orthogonal_camera'
+ expect(subject.dig(camera_type)).to be_a(Hash)
+ expect(subject.dig(camera_type, 'field_of_view')).to be_a(Numeric) if camera_type == 'perspective_camera'
+ expect(subject.dig(camera_type, 'view_to_world_scale')).to be_a(Numeric) if camera_type == 'orthogonal_camera'
%w[camera_view_point camera_direction camera_up_vector].each do |key|
camera_vp = subject.dig(camera_type, key)
- expect(camera_vp).to be_kind_of(Hash)
+ expect(camera_vp).to be_a(Hash)
expect(camera_vp.keys).to contain_exactly 'x', 'y', 'z'
- expect(camera_vp.values).to all(be_kind_of(Numeric))
+ expect(camera_vp.values).to all(be_a(Numeric))
end
end
end
@@ -66,15 +66,15 @@ end
shared_examples 'has lines' do
it 'has a lines entry' do
lines = subject['lines']
- expect(lines).to be_kind_of(Array)
+ expect(lines).to be_a(Array)
lines.each do |line|
- expect(line).to be_kind_of(Hash)
+ expect(line).to be_a(Hash)
expect(line.keys).to contain_exactly 'start_point', 'end_point'
expect(line['start_point'].keys).to contain_exactly 'x', 'y', 'z'
- expect(line['start_point'].values).to all(be_kind_of(Numeric))
+ expect(line['start_point'].values).to all(be_a(Numeric))
expect(line['end_point'].keys).to contain_exactly 'x', 'y', 'z'
- expect(line['end_point'].values).to all(be_kind_of(Numeric))
+ expect(line['end_point'].values).to all(be_a(Numeric))
end
end
end
@@ -82,15 +82,15 @@ end
shared_examples 'has clipping planes' do
it 'has a lines entry' do
clipping_planes = subject['clipping_planes']
- expect(clipping_planes).to be_kind_of(Array)
+ expect(clipping_planes).to be_a(Array)
clipping_planes.each do |plane|
- expect(plane).to be_kind_of(Hash)
+ expect(plane).to be_a(Hash)
expect(plane.keys).to contain_exactly 'location', 'direction'
expect(plane['location'].keys).to contain_exactly 'x', 'y', 'z'
- expect(plane['location'].values).to all(be_kind_of(Numeric))
+ expect(plane['location'].values).to all(be_a(Numeric))
expect(plane['direction'].keys).to contain_exactly 'x', 'y', 'z'
- expect(plane['direction'].values).to all(be_kind_of(Numeric))
+ expect(plane['direction'].values).to all(be_a(Numeric))
end
end
end
@@ -98,18 +98,18 @@ end
shared_examples 'has bitmaps' do
it 'has a bitmaps entry' do
bitmaps = subject['bitmaps']
- expect(bitmaps).to be_kind_of(Array)
+ expect(bitmaps).to be_a(Array)
bitmaps.each do |bitmap|
- expect(bitmap).to be_kind_of(Hash)
+ expect(bitmap).to be_a(Hash)
expect(bitmap.keys).to contain_exactly 'bitmap_type', 'bitmap_data', 'location', 'normal', 'up', 'height'
expect(bitmap['location'].keys).to contain_exactly 'x', 'y', 'z'
- expect(bitmap['location'].values).to all(be_kind_of(Numeric))
+ expect(bitmap['location'].values).to all(be_a(Numeric))
expect(bitmap['normal'].keys).to contain_exactly 'x', 'y', 'z'
- expect(bitmap['normal'].values).to all(be_kind_of(Numeric))
+ expect(bitmap['normal'].values).to all(be_a(Numeric))
expect(bitmap['up'].keys).to contain_exactly 'x', 'y', 'z'
- expect(bitmap['up'].values).to all(be_kind_of(Numeric))
- expect(bitmap['height']).to be_kind_of(Numeric)
+ expect(bitmap['up'].values).to all(be_a(Numeric))
+ expect(bitmap['height']).to be_a(Numeric)
end
end
end
@@ -117,10 +117,10 @@ end
shared_examples 'has components selection' do
it 'has components selections' do
selection = subject.dig('components', 'selection')
- expect(selection).to be_kind_of(Array)
+ expect(selection).to be_a(Array)
selection.each do |item|
- expect(item).to be_kind_of(Hash)
+ expect(item).to be_a(Hash)
expect(item.keys).to include 'ifc_guid'
# Has only allowed keys
@@ -132,16 +132,16 @@ end
shared_examples 'has components coloring' do
it 'has components coloring' do
coloring = subject.dig('components', 'coloring')
- expect(coloring).to be_kind_of(Array)
+ expect(coloring).to be_a(Array)
coloring.each do |item|
- expect(item).to be_kind_of(Hash)
+ expect(item).to be_a(Hash)
expect(item.keys).to include 'color', 'components'
expect(item['color']).to match /\A#[a-f0-9]{6}\Z/i
- expect(item['components']).to be_kind_of(Array)
+ expect(item['components']).to be_a(Array)
item['components'].each do |component|
- expect(component).to be_kind_of(Hash)
+ expect(component).to be_a(Hash)
expect(component.keys).to include 'ifc_guid'
end
end
@@ -151,17 +151,17 @@ end
shared_examples 'has components visibility' do
it 'has components visibility' do
visibility = subject.dig('components', 'visibility')
- expect(visibility).to be_kind_of(Hash)
+ expect(visibility).to be_a(Hash)
expect(visibility.keys - %w[default_visibility exceptions view_setup_hints]).to be_empty
expect(visibility['default_visibility']).to be_boolean
Array(visibility['exceptions']).each do |item|
- expect(item).to be_kind_of(Hash)
+ expect(item).to be_a(Hash)
expect(item.keys).to include 'ifc_guid'
end
hints = visibility['view_setup_hints']
- expect(hints).to be_kind_of(Hash)
+ expect(hints).to be_a(Hash)
expect(hints.keys).to contain_exactly 'spaces_visible', 'space_boundaries_visible', 'openings_visible'
expect(hints.values).to all(be_boolean)
end
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
index 3919243fab1..01eaf4e1019 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/topics_api_spec.rb
@@ -330,8 +330,7 @@ describe 'BCF 2.1 topics resource', content_type: :json, with_mail: false do
shared_examples_for 'topics api write invalid parameters errors' do
context 'without a title' do
let(:params) do
- {
- }
+ {}
end
it_behaves_like 'bcf api unprocessable response' do
diff --git a/modules/bim/spec/support/components/bcf_details_viewpoints.rb b/modules/bim/spec/support/components/bcf_details_viewpoints.rb
index 4a91aea6faa..ea4666e8041 100644
--- a/modules/bim/spec/support/components/bcf_details_viewpoints.rb
+++ b/modules/bim/spec/support/components/bcf_details_viewpoints.rb
@@ -33,7 +33,7 @@ module Components
end
def expect_no_viewpoint_addable
- expect(page).to have_no_selector('a.button', text: 'Viewpoint')
+ expect(page).not_to have_selector('a.button', text: 'Viewpoint')
end
def next_viewpoint
diff --git a/modules/bim/spec/support/pages/ifc_models/index.rb b/modules/bim/spec/support/pages/ifc_models/index.rb
index 60dfad04c5c..adc8bf9e4ad 100644
--- a/modules/bim/spec/support/pages/ifc_models/index.rb
+++ b/modules/bim/spec/support/pages/ifc_models/index.rb
@@ -57,7 +57,7 @@ module Pages
visit!
else
- expect(page).to have_no_selector('.button.-alt-highlight', text: 'IFC model')
+ expect(page).not_to have_selector('.button.-alt-highlight', text: 'IFC model')
end
end
diff --git a/modules/bim/spec/support/pages/ifc_models/show_default.rb b/modules/bim/spec/support/pages/ifc_models/show_default.rb
index 22f971dfb22..5f8fbb50097 100644
--- a/modules/bim/spec/support/pages/ifc_models/show_default.rb
+++ b/modules/bim/spec/support/pages/ifc_models/show_default.rb
@@ -78,8 +78,8 @@ module Pages
expect(page).to have_selector(selector, count: 8)
end
else
- expect(page).to have_no_selector(selector)
- expect(page).to have_no_selector('[data-qa-selector="op-ifc-viewer--toolbar-container"]')
+ expect(page).not_to have_selector(selector)
+ expect(page).not_to have_selector('[data-qa-selector="op-ifc-viewer--toolbar-container"]')
end
end
@@ -107,7 +107,7 @@ module Pages
def switch_view(value)
retry_block do
- page.find('#bcf-view-toggle-button').click
+ page.find_by_id('bcf-view-toggle-button').click
within('#bcf-view-context-menu') do
page.find('.menu-item', text: value, exact_text: true).click
end
@@ -119,7 +119,7 @@ module Pages
end
def has_no_menu_item_with_text?(value)
- expect(page).to have_no_selector('.menu-item', text: value)
+ expect(page).not_to have_selector('.menu-item', text: value)
end
private
diff --git a/modules/boards/spec/features/action_boards/subproject_board_spec.rb b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
index ab27d1456c5..8ac7d10fb35 100644
--- a/modules/boards/spec/features/action_boards/subproject_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
@@ -244,7 +244,7 @@ describe 'Subproject action board', js: true do
board_page.open_and_fill_add_list_modal subproject2.name
- expect(page).to have_no_selector('.ng-option', text: subproject2.name)
+ expect(page).not_to have_selector('.ng-option', text: subproject2.name)
end
end
end
diff --git a/modules/boards/spec/features/action_boards/version_board_spec.rb b/modules/boards/spec/features/action_boards/version_board_spec.rb
index b0b6d876f22..0a17958e07e 100644
--- a/modules/boards/spec/features/action_boards/version_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/version_board_spec.rb
@@ -254,7 +254,7 @@ describe 'Version action board', js: true do
# Can open that version
board_page.click_list_dropdown 'Closed version', 'Open version'
- expect(page).to have_no_selector('[data-qa-selector="op-version-board-header"].-closed')
+ expect(page).not_to have_selector('[data-qa-selector="op-version-board-header"].-closed')
closed_version.reload
expect(closed_version.status).to eq 'open'
@@ -330,7 +330,7 @@ describe 'Version action board', js: true do
board_page.expect_editable_board(true)
board_page.expect_editable_list(false)
- expect(page).to have_no_selector('[data-qa-selector="op-wp-single-card"].-draggable')
+ expect(page).not_to have_selector('[data-qa-selector="op-wp-single-card"].-draggable')
end
end
diff --git a/modules/boards/spec/features/board_enterprise_spec.rb b/modules/boards/spec/features/board_enterprise_spec.rb
index f711e5da653..54026680f2d 100644
--- a/modules/boards/spec/features/board_enterprise_spec.rb
+++ b/modules/boards/spec/features/board_enterprise_spec.rb
@@ -67,7 +67,7 @@ describe 'Boards enterprise spec', js: true do
board_page = board_index.open_board(manual_board)
board_page.expect_query 'My board'
- expect(page).to have_no_selector '[data-qa-selector="op-enterprise-banner"]'
+ expect(page).not_to have_selector '[data-qa-selector="op-enterprise-banner"]'
board_index.visit!
board_page = board_index.open_board(action_board)
@@ -96,12 +96,12 @@ describe 'Boards enterprise spec', js: true do
board_page = board_index.open_board(manual_board)
board_page.expect_query 'My board'
- expect(page).to have_no_selector '[data-qa-selector="op-enterprise-banner"]'
+ expect(page).not_to have_selector '[data-qa-selector="op-enterprise-banner"]'
board_index.visit!
board_page = board_index.open_board(action_board)
board_page.expect_query 'Subproject board'
- expect(page).to have_no_selector '[data-qa-selector="op-enterprise-banner"]'
+ expect(page).not_to have_selector '[data-qa-selector="op-enterprise-banner"]'
end
end
end
diff --git a/modules/boards/spec/features/board_management_spec.rb b/modules/boards/spec/features/board_management_spec.rb
index 85405ee73c2..b99d3b2b47b 100644
--- a/modules/boards/spec/features/board_management_spec.rb
+++ b/modules/boards/spec/features/board_management_spec.rb
@@ -89,13 +89,13 @@ describe 'Board management spec', js: true do
page.find('.menu-item', text: 'Add new card').click
board_page.within_list('List 2') do
- subject = page.find('#wp-new-inline-edit--field-subject')
+ subject = page.find_by_id('wp-new-inline-edit--field-subject')
subject.set 'New card 1'
subject.send_keys :enter
end
board_page.within_list('List 1') do
- subject = page.find('#wp-new-inline-edit--field-subject')
+ subject = page.find_by_id('wp-new-inline-edit--field-subject')
subject.set 'New card 2'
subject.send_keys :enter
end
diff --git a/modules/boards/spec/features/board_navigation_spec.rb b/modules/boards/spec/features/board_navigation_spec.rb
index 30700bb5af7..1b967c8529b 100644
--- a/modules/boards/spec/features/board_navigation_spec.rb
+++ b/modules/boards/spec/features/board_navigation_spec.rb
@@ -166,7 +166,7 @@ describe 'Work Package boards spec', js: true do
# Go to full view of WP
split_view.switch_to_fullscreen
- find('#action-show-more-dropdown-menu').click
+ find_by_id('action-show-more-dropdown-menu').click
click_link(I18n.t('js.button_delete'))
# Delete the WP
diff --git a/modules/boards/spec/features/support/board_index_page.rb b/modules/boards/spec/features/support/board_index_page.rb
index 56744df253a..348afa0649b 100644
--- a/modules/boards/spec/features/support/board_index_page.rb
+++ b/modules/boards/spec/features/support/board_index_page.rb
@@ -68,7 +68,7 @@ module Pages
if expect_empty
expect(page).to have_selector('.boards-list--add-item-text', wait: 10)
- expect(page).to have_no_selector('.boards-list--item')
+ expect(page).not_to have_selector('.boards-list--item')
else
expect(page).to have_selector('.boards-list--item', wait: 10)
end
diff --git a/modules/boards/spec/features/support/board_page.rb b/modules/boards/spec/features/support/board_page.rb
index 7b8b1d1e385..04940c25ae5 100644
--- a/modules/boards/spec/features/support/board_page.rb
+++ b/modules/boards/spec/features/support/board_page.rb
@@ -83,7 +83,7 @@ module Pages
# Add item in dropdown
page.find('.menu-item', text: 'Add new card').click
- subject = page.find('#wp-new-inline-edit--field-subject')
+ subject = page.find_by_id('wp-new-inline-edit--field-subject')
subject.set card_title
subject.send_keys :enter
@@ -126,7 +126,7 @@ module Pages
query: work_package.subject,
results_selector: '.work-packages-partitioned-query-space--container')
- expect(target_dropdown).to have_no_selector('.ui-menu-item', text: work_package.subject)
+ expect(target_dropdown).not_to have_selector('.ui-menu-item', text: work_package.subject)
end
##
@@ -202,7 +202,7 @@ module Pages
end
def expect_not_changed
- expect(page).to have_no_selector('.editable-toolbar-title--save')
+ expect(page).not_to have_selector('.editable-toolbar-title--save')
end
def expect_list(name)
@@ -214,7 +214,7 @@ module Pages
end
def expect_empty
- expect(page).to have_no_selector('.boards-list--item', wait: 10)
+ expect(page).not_to have_selector('.boards-list--item', wait: 10)
end
def remove_list(name)
@@ -223,7 +223,7 @@ module Pages
accept_alert_dialog!
expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
- expect(page).to have_no_selector list_selector(name)
+ expect(page).not_to have_selector list_selector(name)
end
def click_list_dropdown(list_name, action)
diff --git a/modules/budgets/spec/features/costs_edit_fields_spec.rb b/modules/budgets/spec/features/costs_edit_fields_spec.rb
index a3e25fcb151..e1a98a10741 100644
--- a/modules/budgets/spec/features/costs_edit_fields_spec.rb
+++ b/modules/budgets/spec/features/costs_edit_fields_spec.rb
@@ -47,9 +47,9 @@ describe 'Work Package budget fields', js: true do
create_page.visit!
expect(page).to have_selector('.inline-edit--container.budget')
- expect(page).to have_no_selector('.inline-edit--container.laborCosts')
- expect(page).to have_no_selector('.inline-edit--container.materialCosts')
- expect(page).to have_no_selector('.inline-edit--container.overallCosts')
+ expect(page).not_to have_selector('.inline-edit--container.laborCosts')
+ expect(page).not_to have_selector('.inline-edit--container.materialCosts')
+ expect(page).not_to have_selector('.inline-edit--container.overallCosts')
field = create_page.edit_field(:budget)
field.set_value budget.name
diff --git a/modules/budgets/spec/support/pages/budget_form.rb b/modules/budgets/spec/support/pages/budget_form.rb
index 9247e788584..68edd2b930d 100644
--- a/modules/budgets/spec/support/pages/budget_form.rb
+++ b/modules/budgets/spec/support/pages/budget_form.rb
@@ -84,7 +84,7 @@ module Pages
# Submit the costs form
def submit_form!
- find('#budget-table--submit-button').click
+ find_by_id('budget-table--submit-button').click
end
##
diff --git a/modules/calendar/spec/features/calendar_dates_spec.rb b/modules/calendar/spec/features/calendar_dates_spec.rb
index ab1001a64a8..824a6e09be4 100644
--- a/modules/calendar/spec/features/calendar_dates_spec.rb
+++ b/modules/calendar/spec/features/calendar_dates_spec.rb
@@ -56,22 +56,22 @@ describe 'Calendar non working days', js: true do
expect(page).to have_selector('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
expect(page).to have_selector('.fc-day-sun.fc-non-working-day', minimum: 1)
- expect(page).to have_no_selector('.fc-day-mon.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-tue.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-wed.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-thu.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-fri.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-mon.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-tue.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-wed.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-thu.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-fri.fc-non-working-day')
find('.fc-next-button').click
expect(page).to have_selector('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
expect(page).to have_selector('.fc-day-sun.fc-non-working-day', minimum: 1)
- expect(page).to have_no_selector('.fc-day-mon.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-tue.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-wed.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-thu.fc-non-working-day')
- expect(page).to have_no_selector('.fc-day-fri.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-mon.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-tue.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-wed.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-thu.fc-non-working-day')
+ expect(page).not_to have_selector('.fc-day-fri.fc-non-working-day')
end
end
diff --git a/modules/calendar/spec/features/calendars_index_spec.rb b/modules/calendar/spec/features/calendars_index_spec.rb
index 5f13fd9eb08..be71c7b0240 100644
--- a/modules/calendar/spec/features/calendars_index_spec.rb
+++ b/modules/calendar/spec/features/calendars_index_spec.rb
@@ -88,10 +88,10 @@ describe 'Team planner index', js: true, with_ee: %i[team_planner_view] do
expect(page).to have_selector 'td', text: query.name
# Does not show the delete
- expect(page).to have_no_selector "[data-qa-selector='calendar-remove-#{query.id}']"
+ expect(page).not_to have_selector "[data-qa-selector='calendar-remove-#{query.id}']"
# Does not show the create button
- expect(page).to have_no_selector '.button', text: 'Calendar'
+ expect(page).not_to have_selector '.button', text: 'Calendar'
end
context 'when the view is non-public' do
@@ -99,13 +99,13 @@ describe 'Team planner index', js: true, with_ee: %i[team_planner_view] do
it 'does not show a non-public view' do
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).to have_no_selector 'td', text: query.name
+ expect(page).not_to have_selector 'td', text: query.name
# Does not show the delete
- expect(page).to have_no_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
+ expect(page).not_to have_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
# Does not show the create button
- expect(page).to have_no_selector '.button', text: 'Calendar'
+ expect(page).not_to have_selector '.button', text: 'Calendar'
end
end
end
diff --git a/modules/calendar/spec/features/calendars_spec.rb b/modules/calendar/spec/features/calendars_spec.rb
index b7f4228c9fb..176aee3d8ae 100644
--- a/modules/calendar/spec/features/calendars_spec.rb
+++ b/modules/calendar/spec/features/calendars_spec.rb
@@ -91,9 +91,9 @@ describe 'Work package calendars', js: true do
expect(page)
.to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
filters.expect_filter_count 1
@@ -106,7 +106,7 @@ describe 'Work package calendars', js: true do
# non matching work packages are no longer displayed
expect(page)
- .to have_no_selector '.fc-event-title', text: current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: current_work_package.subject
expect(page)
.to have_selector '.fc-event-title', text: another_current_work_package.subject
@@ -117,11 +117,11 @@ describe 'Work package calendars', js: true do
find('.fc-next-button').click
expect(page)
- .to have_no_selector '.fc-event-title', text: current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
.to have_selector '.fc-event-title', text: another_future_work_package.subject
@@ -129,9 +129,9 @@ describe 'Work package calendars', js: true do
filters.remove_filter 'subject'
expect(page)
- .to have_no_selector '.fc-event-title', text: current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
.to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
@@ -147,17 +147,17 @@ describe 'Work package calendars', js: true do
expect(page)
.to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
# open the page via the url should show the next month again
visit future_url
expect(page)
- .to have_no_selector '.fc-event-title', text: current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_current_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
.to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
@@ -171,9 +171,9 @@ describe 'Work package calendars', js: true do
expect(page)
.to have_selector '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_no_selector '.fc-event-title', text: another_future_work_package.subject
+ .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
# click goes to work package split screen
page.find('.fc-event-title', text: current_work_package.subject).click
diff --git a/modules/costs/app/models/entry.rb b/modules/costs/app/models/entry.rb
index 8ef8d75f3df..8c4554eee87 100644
--- a/modules/costs/app/models/entry.rb
+++ b/modules/costs/app/models/entry.rb
@@ -104,7 +104,7 @@ module Entry
rescue NoMethodError
end
- def self.method_missing(*a, &)
- Delegator.send(*a, &)
+ def self.method_missing(...)
+ Delegator.send(...)
end
end
diff --git a/modules/costs/app/models/rate.rb b/modules/costs/app/models/rate.rb
index 063bf20dc59..d73208f968c 100644
--- a/modules/costs/app/models/rate.rb
+++ b/modules/costs/app/models/rate.rb
@@ -172,7 +172,7 @@ class Rate < ApplicationRecord
end
def count_rates(date1, date2 = nil)
- (@rate.class).where(conditions_between(date1, date2, :valid_from)).count
+ @rate.class.where(conditions_between(date1, date2, :valid_from)).count
end
def orphaned_child_entries(date1, date2 = nil)
diff --git a/modules/costs/app/services/time_entries/create_service.rb b/modules/costs/app/services/time_entries/create_service.rb
index 5efcbdd3737..b20d6367d5b 100644
--- a/modules/costs/app/services/time_entries/create_service.rb
+++ b/modules/costs/app/services/time_entries/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class TimeEntries::CreateService < ::BaseServices::Create
+class TimeEntries::CreateService < BaseServices::Create
def after_perform(call)
OpenProject::Notifications.send(
OpenProject::Events::TIME_ENTRY_CREATED,
diff --git a/modules/costs/app/services/time_entries/delete_service.rb b/modules/costs/app/services/time_entries/delete_service.rb
index 9df3d59d2eb..668e523261c 100644
--- a/modules/costs/app/services/time_entries/delete_service.rb
+++ b/modules/costs/app/services/time_entries/delete_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class TimeEntries::DeleteService < ::BaseServices::Delete; end
+class TimeEntries::DeleteService < BaseServices::Delete; end
diff --git a/modules/costs/app/services/time_entries/update_service.rb b/modules/costs/app/services/time_entries/update_service.rb
index bea7e38d5d1..60531ac8399 100644
--- a/modules/costs/app/services/time_entries/update_service.rb
+++ b/modules/costs/app/services/time_entries/update_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class TimeEntries::UpdateService < ::BaseServices::Update; end
+class TimeEntries::UpdateService < BaseServices::Update; end
diff --git a/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb b/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb
index 24b9269661d..136b3b18706 100644
--- a/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb
+++ b/modules/costs/spec/features/cost_entries/add_cost_entry_spec.rb
@@ -93,7 +93,7 @@ describe 'Work Package cost fields', js: true do
expect(page).to have_selector('#cost_entry_costs', text: '4.00 EUR')
# Override costs
- find('#cost_entry_costs').click
+ find_by_id('cost_entry_costs').click
SeleniumHubWaiter.wait
fill_in 'cost_entry_overridden_costs', with: '15.52'
@@ -130,7 +130,7 @@ describe 'Work Package cost fields', js: true do
expect(page).to have_selector('#cost_entry_costs', text: '2,84 EUR')
# Override costs
- find('#cost_entry_costs').click
+ find_by_id('cost_entry_costs').click
SeleniumHubWaiter.wait
fill_in 'cost_entry_overridden_costs', with: '1.350,25'
@@ -150,7 +150,7 @@ describe 'Work Package cost fields', js: true do
# Toggle the cost button
SeleniumHubWaiter.wait
- find('#cost_entry_costs').click
+ find_by_id('cost_entry_costs').click
# Update the costs in german locale
SeleniumHubWaiter.wait
@@ -183,7 +183,7 @@ describe 'Work Package cost fields', js: true do
find('.menu-item', text: I18n.t(:button_log_costs)).click
SeleniumHubWaiter.wait
- expect(page).to have_no_selector('#cost_entry_user_id option', text: placeholder_user.name, visible: :all)
+ expect(page).not_to have_selector('#cost_entry_user_id option', text: placeholder_user.name, visible: :all)
expect(page).to have_selector('#cost_entry_user_id option', text: user.name, visible: :all)
end
end
diff --git a/modules/costs/spec/features/cost_entries/add_entry_without_rate_permission_spec.rb b/modules/costs/spec/features/cost_entries/add_entry_without_rate_permission_spec.rb
index 71dcf4fb359..59e32754113 100644
--- a/modules/costs/spec/features/cost_entries/add_entry_without_rate_permission_spec.rb
+++ b/modules/costs/spec/features/cost_entries/add_entry_without_rate_permission_spec.rb
@@ -73,7 +73,7 @@ describe 'Create cost entry without rate permissions', js: true do
select 'A', from: 'cost_entry_cost_type_id'
fill_in 'cost_entry_units', with: '1'
expect(page).to have_selector('#cost_entry_unit_name', text: 'A single')
- expect(page).to have_no_selector('#cost_entry_costs')
+ expect(page).not_to have_selector('#cost_entry_costs')
click_on 'Save'
diff --git a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
index 357a479df16..90a588eccb9 100644
--- a/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
+++ b/modules/costs/spec/features/cost_types/delete_cost_type_spec.rb
@@ -53,7 +53,7 @@ describe 'deleting a cost type', js: true do
SeleniumHubWaiter.wait
# Show locked
- find('#include_deleted').set true
+ find_by_id('include_deleted').set true
click_on 'Apply'
# Expect no results if not locked
diff --git a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb
index 11b1a4938dc..1e1f5b88ed5 100644
--- a/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb
+++ b/modules/costs/spec/features/destroy_work_package_with_cost_entries_spec.rb
@@ -75,7 +75,7 @@ describe 'Deleting time entries', js: true do
wp_page.visit!
SeleniumHubWaiter.wait
- find('#action-show-more-dropdown-menu').click
+ find_by_id('action-show-more-dropdown-menu').click
click_link(I18n.t('js.button_delete'))
diff --git a/modules/costs/spec/features/users_hourly_rates_spec.rb b/modules/costs/spec/features/users_hourly_rates_spec.rb
index 876f2deb3aa..07a479fbb85 100644
--- a/modules/costs/spec/features/users_hourly_rates_spec.rb
+++ b/modules/costs/spec/features/users_hourly_rates_spec.rb
@@ -73,7 +73,7 @@ describe 'hourly rates on user edit', js: true do
expect(page).to have_text /rate history/i
expect(page).to have_text I18n.t('no_results_title_text')
- expect(page).to have_no_text 'Current rate'
+ expect(page).not_to have_text 'Current rate'
end
end
end
diff --git a/modules/costs/spec/models/cost_entry_spec.rb b/modules/costs/spec/models/cost_entry_spec.rb
index a5ec9cd9279..69fa46baa57 100644
--- a/modules/costs/spec/models/cost_entry_spec.rb
+++ b/modules/costs/spec/models/cost_entry_spec.rb
@@ -163,7 +163,7 @@ describe CostEntry do
end
it 'updates costs' do
- (0..5).each do |units|
+ 6.times do |units|
cost_entry.units = units
cost_entry.save!
expect(cost_entry.costs).to eq(first_rate.rate * units)
diff --git a/modules/costs/spec/models/time_entry_spec.rb b/modules/costs/spec/models/time_entry_spec.rb
index 5cea5e1ea6f..19037c63878 100644
--- a/modules/costs/spec/models/time_entry_spec.rb
+++ b/modules/costs/spec/models/time_entry_spec.rb
@@ -125,7 +125,7 @@ describe TimeEntry do
end
it 'returns the current costs depending on the number of hours' do
- (0..100).each do |hours|
+ 101.times do |hours|
time_entry.hours = hours
time_entry.save!
expect(time_entry.costs).to eq(time_entry.rate.rate * hours)
@@ -206,7 +206,7 @@ describe TimeEntry do
end
it 'returns the current costs depending on the number of hours' do
- (0..100).each do |hours|
+ 101.times do |hours|
@default_example.hours = hours
@default_example.save!
expect(@default_example.costs).to eq(@default_example.rate.rate * hours)
diff --git a/modules/dashboards/spec/features/custom_text_spec.rb b/modules/dashboards/spec/features/custom_text_spec.rb
index 17a6438bb08..012b7c0bebb 100644
--- a/modules/dashboards/spec/features/custom_text_spec.rb
+++ b/modules/dashboards/spec/features/custom_text_spec.rb
@@ -137,7 +137,7 @@ describe 'Project description widget on dashboard', js: true do
within custom_text_widget.area do
expect(page).to have_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
- expect(page).to have_no_selector('notifications-upload-progress')
+ expect(page).not_to have_selector('notifications-upload-progress')
field.save!
end
@@ -149,7 +149,7 @@ describe 'Project description widget on dashboard', js: true do
.to have_selector('#content img', count: 1)
expect(page)
- .to have_no_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
+ .not_to have_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
end
end
end
@@ -175,7 +175,7 @@ describe 'Project description widget on dashboard', js: true do
.to have_content(dashboard.widgets.first.options[:text])
expect(page)
- .to have_no_selector('.inplace-editing--container')
+ .not_to have_selector('.inplace-editing--container')
end
end
end
diff --git a/modules/dashboards/spec/features/members_spec.rb b/modules/dashboards/spec/features/members_spec.rb
index 2e06b0474a0..86ebb6390e8 100644
--- a/modules/dashboards/spec/features/members_spec.rb
+++ b/modules/dashboards/spec/features/members_spec.rb
@@ -126,7 +126,7 @@ describe 'Members widget on dashboard', js: true do
within members_area.area do
expect(page)
- .to have_no_link('Member')
+ .not_to have_link('Member')
end
# A user without view permission will not see any members
@@ -144,10 +144,10 @@ describe 'Members widget on dashboard', js: true do
.to have_content('No visible members')
expect(page)
- .to have_no_link('Member')
+ .not_to have_link('Member')
expect(page)
- .to have_no_link('View all members')
+ .not_to have_link('View all members')
end
end
end
diff --git a/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb b/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb
index 131f38799c8..2d681cfd737 100644
--- a/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb
+++ b/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb
@@ -90,6 +90,6 @@ describe 'Modifying a dashboard which already has widgets for which permissions
dashboard_page.visit!
expect(page)
- .to have_no_selector('.grid--area.-widgeted:nth-of-type(2)')
+ .not_to have_selector('.grid--area.-widgeted:nth-of-type(2)')
end
end
diff --git a/modules/dashboards/spec/features/work_package_calendar_spec.rb b/modules/dashboards/spec/features/work_package_calendar_spec.rb
index 7bb4459c6fa..f7d7d0553af 100644
--- a/modules/dashboards/spec/features/work_package_calendar_spec.rb
+++ b/modules/dashboards/spec/features/work_package_calendar_spec.rb
@@ -31,8 +31,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
describe 'Work package calendar widget on dashboard',
- with_mail: false,
- js: true do
+ js: true, with_mail: false do
let!(:type) { create(:type) }
let!(:priority) { create(:default_priority) }
let!(:project) { create(:project, types: [type]) }
@@ -135,10 +134,10 @@ describe 'Work package calendar widget on dashboard',
.to have_selector('.fc-event-title', text: ending_work_package.subject)
expect(page)
- .to have_no_selector('.fc-event-title', text: outdated_work_package.subject)
+ .not_to have_selector('.fc-event-title', text: outdated_work_package.subject)
expect(page)
- .to have_no_selector('.fc-event-title', text: other_project_work_package.subject)
+ .not_to have_selector('.fc-event-title', text: other_project_work_package.subject)
end
end
end
diff --git a/modules/dashboards/spec/features/work_package_graph_overview_spec.rb b/modules/dashboards/spec/features/work_package_graph_overview_spec.rb
index 848099a2119..fcc75a06b55 100644
--- a/modules/dashboards/spec/features/work_package_graph_overview_spec.rb
+++ b/modules/dashboards/spec/features/work_package_graph_overview_spec.rb
@@ -31,8 +31,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
describe 'Work package overview graph widget on dashboard',
- with_mail: false,
- js: true do
+ js: true, with_mail: false do
let!(:type) { create(:type) }
let!(:priority) { create(:default_priority) }
let!(:project) { create(:project, types: [type]) }
diff --git a/modules/dashboards/spec/features/work_package_table_spec.rb b/modules/dashboards/spec/features/work_package_table_spec.rb
index 971b89a3c9d..caabcbe9455 100644
--- a/modules/dashboards/spec/features/work_package_table_spec.rb
+++ b/modules/dashboards/spec/features/work_package_table_spec.rb
@@ -135,11 +135,11 @@ describe 'Arbitrary WorkPackage query table widget dashboard', js: true, with_ma
# as the Subject column is disabled
expect(filter_area.area)
- .to have_no_selector('.subject', text: type_work_package.subject)
+ .not_to have_selector('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .to have_no_selector('.id', text: other_type_work_package.id)
+ .not_to have_selector('.id', text: other_type_work_package.id)
# Work packages from other projects are not displayed as the query is project scoped
expect(filter_area.area)
@@ -166,11 +166,11 @@ describe 'Arbitrary WorkPackage query table widget dashboard', js: true, with_ma
# as the Subject column is disabled
expect(filter_area.area)
- .to have_no_selector('.subject', text: type_work_package.subject)
+ .not_to have_selector('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .to have_no_selector('.id', text: other_type_work_package.id)
+ .not_to have_selector('.id', text: other_type_work_package.id)
# Work packages from other projects are not displayed as the query is project scoped
expect(filter_area.area)
diff --git a/modules/documents/lib/open_project/documents/patches/textile_converter_patch.rb b/modules/documents/lib/open_project/documents/patches/textile_converter_patch.rb
index 97640a0fa86..97bf04aa866 100644
--- a/modules/documents/lib/open_project/documents/patches/textile_converter_patch.rb
+++ b/modules/documents/lib/open_project/documents/patches/textile_converter_patch.rb
@@ -37,6 +37,6 @@ module OpenProject::Documents::Patches
end
end
-::OpenProject::TextFormatting::Formats::Markdown::TextileConverter.prepend(
- ::OpenProject::Documents::Patches::TextileConverterPatch
+OpenProject::TextFormatting::Formats::Markdown::TextileConverter.prepend(
+ OpenProject::Documents::Patches::TextileConverterPatch
)
diff --git a/modules/github_integration/app/models/github_pull_request.rb b/modules/github_integration/app/models/github_pull_request.rb
index f41fa7969fd..d2ad6621e2d 100644
--- a/modules/github_integration/app/models/github_pull_request.rb
+++ b/modules/github_integration/app/models/github_pull_request.rb
@@ -54,7 +54,7 @@ class GithubPullRequest < ApplicationRecord
unless: :partial?
validate :validate_labels_schema
- scope :without_work_package, -> { left_outer_joins(:work_packages).where(work_packages: { id: nil }) }
+ scope :without_work_package, -> { where.missing(:work_packages) }
def self.find_by_github_identifiers(id: nil, url: nil, initialize: false)
raise ArgumentError, "needs an id or an url" if id.nil? && url.blank?
diff --git a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/issue_comment_spec.rb b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/issue_comment_spec.rb
index b3c65e090f9..980b2340d55 100644
--- a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/issue_comment_spec.rb
+++ b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/issue_comment_spec.rb
@@ -125,8 +125,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::IssueComment do
context 'when commented on a PR' do
let(:comment) do
- "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package" \
- " in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
+ "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package " \
+ "in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
end
it_behaves_like 'creating a comment on the work package'
@@ -136,8 +136,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::IssueComment do
context 'when we already have a GithubPullRequest for the commented PR' do
let(:github_pull_request) { create(:github_pull_request, github_html_url: pr_html_url) }
let(:comment) do
- "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package" \
- " in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
+ "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package " \
+ "in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
end
before do
@@ -184,8 +184,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::IssueComment do
context 'when editing a PR comment with a new work package reference' do
let(:comment) do
- "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package" \
- " in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
+ "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package " \
+ "in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
end
it_behaves_like 'creating a comment on the work package'
@@ -195,8 +195,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::IssueComment do
context 'when we already have a GithubPullRequest for the commented PR' do
let(:github_pull_request) { create(:github_pull_request, github_html_url: pr_html_url) }
let(:comment) do
- "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package" \
- " in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
+ "**Referenced in PR:** [test_user](https://github.com/test_user) referenced this work package " \
+ "in Pull request 123 [PR or issue title](https://comment.url) on [test_user/repo](https://github.com/test_user/repo).\n"
end
before do
diff --git a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/pull_request_spec.rb b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/pull_request_spec.rb
index 35d47179dc4..50574cd28eb 100644
--- a/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/pull_request_spec.rb
+++ b/modules/github_integration/spec/lib/open_project/github_integration/notification_handler/pull_request_spec.rb
@@ -128,8 +128,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
context 'with a closed action' do
let(:action) { 'closed' }
let(:comment) do
- "**PR Closed:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo)" \
- " has been closed by [test_user](github.com/test_user).\n"
+ "**PR Closed:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo) " \
+ "has been closed by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
@@ -140,8 +140,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
let(:action) { 'closed' }
let(:pr_merged) { true }
let(:comment) do
- "**PR Merged:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo)" \
- " has been merged by [test_user](github.com/test_user).\n"
+ "**PR Merged:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo) " \
+ "has been merged by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
@@ -171,8 +171,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
context 'with an edited action' do
let(:action) { 'edited' }
let(:comment) do
- "**Referenced in PR:** [test_user](github.com/test_user) referenced this work package" \
- " in Pull request 1 [A PR title](http://pr.url) on [test_user/repo](github.com/test_user/repo).\n"
+ "**Referenced in PR:** [test_user](github.com/test_user) referenced this work package " \
+ "in Pull request 1 [A PR title](http://pr.url) on [test_user/repo](github.com/test_user/repo).\n"
end
it_behaves_like 'adding a comment'
@@ -241,8 +241,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
context 'with an opened action' do
let(:action) { 'opened' }
let(:comment) do
- "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo)" \
- " has been opened by [test_user](github.com/test_user).\n"
+ "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo) " \
+ "has been opened by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
@@ -253,8 +253,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
let(:action) { 'opened' }
let(:pr_draft) { true }
let(:comment) do
- "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo)" \
- " has been opened by [test_user](github.com/test_user).\n"
+ "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo) " \
+ "has been opened by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
@@ -264,8 +264,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
context 'with a ready_for_review action' do
let(:action) { 'ready_for_review' }
let(:comment) do
- "**PR Ready for Review:** Pull request 1 [A PR title](http://pr.url)" \
- " for [test_user/repo](github.com/test_user/repo) was marked as ready for review by [test_user](github.com/test_user).\n"
+ "**PR Ready for Review:** Pull request 1 [A PR title](http://pr.url) " \
+ "for [test_user/repo](github.com/test_user/repo) was marked as ready for review by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
@@ -275,8 +275,8 @@ describe OpenProject::GithubIntegration::NotificationHandler::PullRequest do
context 'with a reopened action' do
let(:action) { 'reopened' }
let(:comment) do
- "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo)" \
- " has been opened by [test_user](github.com/test_user).\n"
+ "**PR Opened:** Pull request 1 [A PR title](http://pr.url) for [test_user/repo](github.com/test_user/repo) " \
+ "has been opened by [test_user](github.com/test_user).\n"
end
it_behaves_like 'adding a comment'
diff --git a/modules/grids/app/services/grids/create_service.rb b/modules/grids/app/services/grids/create_service.rb
index dc513252c67..8d4dfa777e4 100644
--- a/modules/grids/app/services/grids/create_service.rb
+++ b/modules/grids/app/services/grids/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Grids::CreateService < ::BaseServices::Create
+class Grids::CreateService < BaseServices::Create
include ::Shared::ServiceContext
protected
diff --git a/modules/grids/app/services/grids/delete_service.rb b/modules/grids/app/services/grids/delete_service.rb
index 18723b92473..a4c30f7e498 100644
--- a/modules/grids/app/services/grids/delete_service.rb
+++ b/modules/grids/app/services/grids/delete_service.rb
@@ -26,4 +26,4 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Grids::DeleteService < ::BaseServices::Delete; end
+class Grids::DeleteService < BaseServices::Delete; end
diff --git a/modules/grids/app/services/grids/set_attributes_service.rb b/modules/grids/app/services/grids/set_attributes_service.rb
index 68a884a46d8..24ca3172313 100644
--- a/modules/grids/app/services/grids/set_attributes_service.rb
+++ b/modules/grids/app/services/grids/set_attributes_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Grids::SetAttributesService < ::BaseServices::SetAttributes
+class Grids::SetAttributesService < BaseServices::SetAttributes
include Attachments::SetReplacements
private
diff --git a/modules/grids/app/services/grids/update_service.rb b/modules/grids/app/services/grids/update_service.rb
index 8a3d8590c79..93954d0a78e 100644
--- a/modules/grids/app/services/grids/update_service.rb
+++ b/modules/grids/app/services/grids/update_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Grids::UpdateService < ::BaseServices::Update
+class Grids::UpdateService < BaseServices::Update
protected
def perform(attributes)
diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb
index cd122213d00..b276cb71dfe 100644
--- a/modules/grids/spec/support/pages/grid.rb
+++ b/modules/grids/spec/support/pages/grid.rb
@@ -42,7 +42,7 @@ module Pages
def expect_no_help_mode
expect(page)
- .to have_no_selector('.toolbar-item .icon-add')
+ .not_to have_selector('.toolbar-item .icon-add')
end
def expect_unable_to_add_widget(row_number, column_number, location, name = nil)
@@ -91,7 +91,7 @@ module Pages
area.hover
expect(area)
- .to have_no_selector('.grid--widget-add')
+ .not_to have_selector('.grid--widget-add')
end
def expect_specific_widget_unaddable(row_number, column_number, location, name)
diff --git a/modules/ldap_groups/lib/tasks/ldap_groups.rake b/modules/ldap_groups/lib/tasks/ldap_groups.rake
index 20b615a69ca..98cf0646995 100644
--- a/modules/ldap_groups/lib/tasks/ldap_groups.rake
+++ b/modules/ldap_groups/lib/tasks/ldap_groups.rake
@@ -30,15 +30,14 @@ namespace :ldap_groups do
desc 'Synchronize groups and their users from the LDAP auth source.' \
'Will only synchronize for those users already present in the application.'
task synchronize: :environment do
- ::LdapGroups::SynchronizationService.synchronize!
+ LdapGroups::SynchronizationService.synchronize!
end
desc 'Print all members of groups tied to a synchronized group that are not derived from LDAP'
task print_unsynced_members: :environment do
- ::LdapGroups::SynchronizedGroup
+ LdapGroups::SynchronizedGroup
.includes(:group)
.find_each do |sync|
-
group = sync.group
unsynced_logins = User
.where(id: group.user_ids)
diff --git a/modules/ldap_groups/spec/features/administration_spec.rb b/modules/ldap_groups/spec/features/administration_spec.rb
index d786417a1b7..8a70f572ecc 100644
--- a/modules/ldap_groups/spec/features/administration_spec.rb
+++ b/modules/ldap_groups/spec/features/administration_spec.rb
@@ -19,7 +19,7 @@ describe 'LDAP group sync administration spec', js: true do
let!(:auth_source) { create(:ldap_auth_source, name: 'ldap') }
it 'allows synced group administration flow' do
- expect(page).to have_no_selector('.upsale-notification')
+ expect(page).not_to have_selector('.upsale-notification')
# Create group
find('.button', text: I18n.t('ldap_groups.synchronized_groups.singular')).click
diff --git a/modules/ldap_groups/spec/models/synchronized_group_spec.rb b/modules/ldap_groups/spec/models/synchronized_group_spec.rb
index 29b7b528d8b..c9a82811e48 100644
--- a/modules/ldap_groups/spec/models/synchronized_group_spec.rb
+++ b/modules/ldap_groups/spec/models/synchronized_group_spec.rb
@@ -109,7 +109,7 @@ describe LdapGroups::SynchronizedGroup do
context 'when the service call fails for any reason' do
let(:service) { instance_double(Groups::UpdateService) }
- let(:failure_result) { ServiceResult.new(success: false, message: 'oh noes') }
+ let(:failure_result) { ServiceResult.failure(message: 'oh noes') }
it 'does not commit the changes' do
allow(Groups::UpdateService).to receive(:new).and_return(service)
diff --git a/modules/meeting/app/helpers/meeting_contents_helper.rb b/modules/meeting/app/helpers/meeting_contents_helper.rb
index 691dcab302d..9f0bee99dbe 100644
--- a/modules/meeting/app/helpers/meeting_contents_helper.rb
+++ b/modules/meeting/app/helpers/meeting_contents_helper.rb
@@ -149,7 +149,7 @@ module MeetingContentsHelper
end
def text_with_icon(text, icon)
- op_icon("button--icon #{icon}") + # rubocop:disable Style/StringConcatenation
+ op_icon("button--icon #{icon}") +
' ' +
content_tag('span', text, class: 'button--text')
end
diff --git a/modules/meeting/spec/features/meetings_attachments_spec.rb b/modules/meeting/spec/features/meetings_attachments_spec.rb
index fc729b2e1f9..8076385e05f 100644
--- a/modules/meeting/spec/features/meetings_attachments_spec.rb
+++ b/modules/meeting/spec/features/meetings_attachments_spec.rb
@@ -63,7 +63,7 @@ describe 'Add an attachment to a meeting (agenda)', js: true do
##
# Attach file manually
- expect(page).to have_no_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
attachments.attach_file_on_input(image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 5)
diff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rb
index 80ea17b865b..148820500e3 100644
--- a/modules/meeting/spec/features/meetings_close_spec.rb
+++ b/modules/meeting/spec/features/meetings_close_spec.rb
@@ -92,7 +92,7 @@ describe 'Meetings close' do
visit meetings_path(project)
expect(page)
- .to have_no_link 'Close'
+ .not_to have_link 'Close'
end
end
end
diff --git a/modules/meeting/spec/features/meetings_delete_spec.rb b/modules/meeting/spec/features/meetings_delete_spec.rb
index 9b1b9f78e38..43fc4620bed 100644
--- a/modules/meeting/spec/features/meetings_delete_spec.rb
+++ b/modules/meeting/spec/features/meetings_delete_spec.rb
@@ -87,13 +87,13 @@ describe 'Meetings deletion' do
click_link meeting.title
expect(page)
- .to have_no_link 'Delete'
+ .not_to have_link 'Delete'
visit meetings_path(project)
click_link other_meeting.title
expect(page)
- .to have_no_link 'Delete'
+ .not_to have_link 'Delete'
end
end
end
diff --git a/modules/meeting/spec/features/meetings_search_spec.rb b/modules/meeting/spec/features/meetings_search_spec.rb
index 694e1d48eb7..4e6ce9af7a4 100644
--- a/modules/meeting/spec/features/meetings_search_spec.rb
+++ b/modules/meeting/spec/features/meetings_search_spec.rb
@@ -50,7 +50,7 @@ describe 'Meeting search', js: true do
wait_dropdown_open: false)
page.find('[data-qa-tab-id="meetings"]').click
- expect(page.find('#search-results')).to have_text(meeting.title)
+ expect(page.find_by_id('search-results')).to have_text(meeting.title)
end
end
end
diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rb
index d36b9a4ef03..cbea42f4996 100644
--- a/modules/meeting/spec/features/meetings_show_spec.rb
+++ b/modules/meeting/spec/features/meetings_show_spec.rb
@@ -64,8 +64,8 @@ describe 'Meetings', js: true do
expect(page).to have_selector('#meeting_agenda-text', text: 'foo')
# May not edit
- expect(page).to have_no_selector('#edit-meeting_agenda')
- expect(page).to have_no_selector('.meeting_agenda', text: 'Edit')
+ expect(page).not_to have_selector('#edit-meeting_agenda')
+ expect(page).not_to have_selector('.meeting_agenda', text: 'Edit')
end
it 'can view history' do
@@ -76,7 +76,7 @@ describe 'Meetings', js: true do
click_on 'History'
SeleniumHubWaiter.wait
- find('#version-1').click
+ find_by_id('version-1').click
expect(page).to have_selector('.meeting_agenda', text: 'foo')
end
@@ -99,7 +99,7 @@ describe 'Meetings', js: true do
it 'can not edit the minutes' do
visit meeting_path(meeting)
click_link 'Minutes'
- expect(page).to have_no_selector('.meeting_minutes', text: 'Edit')
+ expect(page).not_to have_selector('.meeting_minutes', text: 'Edit')
expect(page).to have_selector('.meeting_minutes', text: 'There is currently nothing to display')
end
end
@@ -110,8 +110,8 @@ describe 'Meetings', js: true do
it 'shows the minutes when visiting' do
visit meeting_path(meeting)
- expect(page).to have_no_selector('h2', text: 'Agenda')
- expect(page).to have_no_selector('#edit-meeting_minutes')
+ expect(page).not_to have_selector('h2', text: 'Agenda')
+ expect(page).not_to have_selector('#edit-meeting_minutes')
expect(page).to have_selector('h2', text: 'Minutes')
end
@@ -122,7 +122,7 @@ describe 'Meetings', js: true do
visit meeting_path(meeting)
expect(page).to have_selector('#edit-meeting_minutes')
expect(page).to have_selector('.meeting_minutes', text: 'Edit')
- expect(page).to have_no_selector('.button', text: 'Close the meeting to begin the Minutes')
+ expect(page).not_to have_selector('.button', text: 'Close the meeting to begin the Minutes')
end
end
end
diff --git a/modules/meeting/spec/support/pages/meetings/edit.rb b/modules/meeting/spec/support/pages/meetings/edit.rb
index 2caa8074b64..0b135c7f350 100644
--- a/modules/meeting/spec/support/pages/meetings/edit.rb
+++ b/modules/meeting/spec/support/pages/meetings/edit.rb
@@ -44,7 +44,7 @@ module Pages::Meetings
def expect_not_available_participant(user)
expect(page)
- .to have_no_field("#{user} invited")
+ .not_to have_field("#{user} invited")
end
def invite(user)
diff --git a/modules/meeting/spec/support/pages/meetings/index.rb b/modules/meeting/spec/support/pages/meetings/index.rb
index 65b96029135..0e31d538aca 100644
--- a/modules/meeting/spec/support/pages/meetings/index.rb
+++ b/modules/meeting/spec/support/pages/meetings/index.rb
@@ -69,7 +69,7 @@ module Pages::Meetings
within '#content-wrapper' do
meetings.each do |meeting|
expect(page).not_to have_selector(".meeting",
- text: meeting.title)
+ text: meeting.title)
end
end
end
diff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rb
index 7e704c0f2ee..a52a54b7257 100644
--- a/modules/meeting/spec/support/pages/meetings/show.rb
+++ b/modules/meeting/spec/support/pages/meetings/show.rb
@@ -59,7 +59,7 @@ module Pages::Meetings
users.each do |user|
within(".meeting.details") do
expect(page)
- .to have_no_link(user.name)
+ .not_to have_link(user.name)
end
end
end
diff --git a/modules/my_page/spec/features/my/accountable_spec.rb b/modules/my_page/spec/features/my/accountable_spec.rb
index b17d3b77a95..b729a6c3861 100644
--- a/modules/my_page/spec/features/my/accountable_spec.rb
+++ b/modules/my_page/spec/features/my/accountable_spec.rb
@@ -114,9 +114,9 @@ describe 'Accountable widget on my page', js: true do
.to have_selector('.subject', text: accountable_work_package.subject)
expect(accountable_area.area)
- .to have_no_selector('.subject', text: accountable_by_other_work_package.subject)
+ .not_to have_selector('.subject', text: accountable_by_other_work_package.subject)
expect(accountable_area.area)
- .to have_no_selector('.subject', text: accountable_but_invisible_work_package.subject)
+ .not_to have_selector('.subject', text: accountable_but_invisible_work_package.subject)
end
end
diff --git a/modules/my_page/spec/features/my/assigned_to_me_spec.rb b/modules/my_page/spec/features/my/assigned_to_me_spec.rb
index be71206dcbb..62f5992ef0b 100644
--- a/modules/my_page/spec/features/my/assigned_to_me_spec.rb
+++ b/modules/my_page/spec/features/my/assigned_to_me_spec.rb
@@ -138,7 +138,7 @@ describe 'Assigned to me embedded query on my page', js: true do
.to have_selector('.subject', text: assigned_work_package.subject)
expect(assigned_area.area)
- .to have_no_selector('.subject', text: assigned_to_other_work_package.subject)
+ .not_to have_selector('.subject', text: assigned_to_other_work_package.subject)
embedded_table.click_inline_create
diff --git a/modules/my_page/spec/features/my/custom_text_spec.rb b/modules/my_page/spec/features/my/custom_text_spec.rb
index a99a319c19a..16bad40f86a 100644
--- a/modules/my_page/spec/features/my/custom_text_spec.rb
+++ b/modules/my_page/spec/features/my/custom_text_spec.rb
@@ -101,7 +101,7 @@ describe 'Custom text widget on my page', js: true do
within custom_text_widget.area do
expect(page).to have_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
- expect(page).to have_no_selector('notifications-upload-progress')
+ expect(page).not_to have_selector('notifications-upload-progress')
field.save!
@@ -109,7 +109,7 @@ describe 'Custom text widget on my page', js: true do
.to have_selector('#content img', count: 1)
expect(page)
- .to have_no_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
+ .not_to have_selector('[data-qa-selector="op-attachment-list-item"]', text: 'image.png')
end
# ensure no one but the page's user can see the uploaded attachment
diff --git a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
index db17c23390f..04e9fc87029 100644
--- a/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
+++ b/modules/my_page/spec/features/my/time_entries_current_user_spec.rb
@@ -193,7 +193,7 @@ describe 'My page time entries current user widget spec', js: true, with_mail: f
time_logging_modal.work_package_field.autocomplete work_package.subject, select: false
expect(page).to have_selector('[data-qa-selector="op-autocompleter-item-subject"]', text: work_package.subject)
- expect(page).to have_no_selector('[data-qa-selector="op-autocompleter-item-subject"]', text: other_work_package.subject)
+ expect(page).not_to have_selector('[data-qa-selector="op-autocompleter-item-subject"]', text: other_work_package.subject)
time_logging_modal.update_work_package_field other_work_package.subject
diff --git a/modules/my_page/spec/features/my/work_package_table_spec.rb b/modules/my_page/spec/features/my/work_package_table_spec.rb
index 1b74e951b62..4e3f89bea1c 100644
--- a/modules/my_page/spec/features/my/work_package_table_spec.rb
+++ b/modules/my_page/spec/features/my/work_package_table_spec.rb
@@ -118,11 +118,11 @@ describe 'Arbitrary WorkPackage query table widget on my page', js: true, with_m
# as the Subject column is disabled
expect(filter_area.area)
- .to have_no_selector('.subject', text: type_work_package.subject)
+ .not_to have_selector('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .to have_no_selector('.id', text: other_type_work_package.id)
+ .not_to have_selector('.id', text: other_type_work_package.id)
scroll_to_element(filter_area.area)
within filter_area.area do
@@ -147,11 +147,11 @@ describe 'Arbitrary WorkPackage query table widget on my page', js: true, with_m
# as the Subject column is disabled
expect(filter_area.area)
- .to have_no_selector('.subject', text: type_work_package.subject)
+ .not_to have_selector('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .to have_no_selector('.id', text: other_type_work_package.id)
+ .not_to have_selector('.id', text: other_type_work_package.id)
within filter_area.area do
expect(page).to have_field('editable-toolbar-title', with: 'My WP Filter', wait: 10)
diff --git a/modules/openid_connect/spec/controllers/providers_controller_spec.rb b/modules/openid_connect/spec/controllers/providers_controller_spec.rb
index 0628094f356..35c1e675bf6 100644
--- a/modules/openid_connect/spec/controllers/providers_controller_spec.rb
+++ b/modules/openid_connect/spec/controllers/providers_controller_spec.rb
@@ -45,7 +45,6 @@ describe OpenIDConnect::ProvidersController do
end
context 'without an EE token' do
-
it 'renders upsale' do
get :index
expect(response).to have_http_status(:ok)
diff --git a/modules/pdf_export/app/models/export_card_configuration.rb b/modules/pdf_export/app/models/export_card_configuration.rb
index 25d41a268fb..2e675f2381b 100644
--- a/modules/pdf_export/app/models/export_card_configuration.rb
+++ b/modules/pdf_export/app/models/export_card_configuration.rb
@@ -68,7 +68,7 @@ class ExportCardConfiguration < ApplicationRecord
def validate(record)
begin
- if record.rows.nil? || !(YAML::load(record.rows)).is_a?(Hash)
+ if record.rows.nil? || !YAML::load(record.rows).is_a?(Hash)
record.errors.add(:rows, I18n.t('validation_error_yaml_is_badly_formed'))
return false
end
diff --git a/modules/reporting/app/models/cost_query/filter.rb b/modules/reporting/app/models/cost_query/filter.rb
index a5702414aaa..565ff8dc33d 100644
--- a/modules/reporting/app/models/cost_query/filter.rb
+++ b/modules/reporting/app/models/cost_query/filter.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "set"
-
class CostQuery::Filter < Report::Filter
def self.all
@all ||= super + Set[
diff --git a/modules/reporting/app/models/cost_query/group_by.rb b/modules/reporting/app/models/cost_query/group_by.rb
index 0c062840d79..f8ab40e18fc 100644
--- a/modules/reporting/app/models/cost_query/group_by.rb
+++ b/modules/reporting/app/models/cost_query/group_by.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "set"
-
class CostQuery::GroupBy < Report::GroupBy
def self.all
@all ||= super + Set[
diff --git a/modules/reporting/app/models/entry.rb b/modules/reporting/app/models/entry.rb
index a7e9d985bcd..bf2a6f1475a 100644
--- a/modules/reporting/app/models/entry.rb
+++ b/modules/reporting/app/models/entry.rb
@@ -116,7 +116,7 @@ module Entry
rescue NoMethodError
end
- def self.method_missing(*a, &)
- Delegator.send(*a, &)
+ def self.method_missing(...)
+ Delegator.send(...)
end
end
diff --git a/modules/reporting/lib/report/filter.rb b/modules/reporting/lib/report/filter.rb
index 0449e2cd808..3adb6e73209 100644
--- a/modules/reporting/lib/report/filter.rb
+++ b/modules/reporting/lib/report/filter.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'set'
-
class Report::Filter
def self.all
@all ||= Set[]
diff --git a/modules/reporting/lib/report/group_by.rb b/modules/reporting/lib/report/group_by.rb
index 16fa0133f11..79ca66a9cb3 100644
--- a/modules/reporting/lib/report/group_by.rb
+++ b/modules/reporting/lib/report/group_by.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'set'
-
class Report::GroupBy
include Report::QueryUtils
diff --git a/modules/reporting/lib/report/inherited_attribute.rb b/modules/reporting/lib/report/inherited_attribute.rb
index 009b8a094a8..b8293cbfabe 100644
--- a/modules/reporting/lib/report/inherited_attribute.rb
+++ b/modules/reporting/lib/report/inherited_attribute.rb
@@ -26,8 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require 'set'
-
module Report::InheritedAttribute
include Report::QueryUtils
diff --git a/modules/reporting/lib/report/sql_statement.rb b/modules/reporting/lib/report/sql_statement.rb
index e0072e9a258..5c038649564 100644
--- a/modules/reporting/lib/report/sql_statement.rb
+++ b/modules/reporting/lib/report/sql_statement.rb
@@ -46,8 +46,8 @@ class Report::SqlStatement
yield second
end
- def gsub(*args, &)
- to_s.gsub(*args, &)
+ def gsub(...)
+ to_s.gsub(...)
end
end
@@ -296,7 +296,7 @@ class Report::SqlStatement
"#<SqlStatement: #{to_s.inspect}>"
end
- def gsub(*args, &)
- to_s.gsub(*args, &)
+ def gsub(...)
+ to_s.gsub(...)
end
end
diff --git a/modules/reporting/lib/widget/filters.rb b/modules/reporting/lib/widget/filters.rb
index d0b75da6720..26455803693 100644
--- a/modules/reporting/lib/widget/filters.rb
+++ b/modules/reporting/lib/widget/filters.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Widget::Filters < ::Widget::Base
+class Widget::Filters < Widget::Base
def render
spacer = content_tag :li, '', class: 'advanced-filters--spacer hide-when-print'
diff --git a/modules/reporting/lib/widget/group_bys.rb b/modules/reporting/lib/widget/group_bys.rb
index 2e74403df22..362c50f935d 100644
--- a/modules/reporting/lib/widget/group_bys.rb
+++ b/modules/reporting/lib/widget/group_bys.rb
@@ -30,6 +30,7 @@ class Widget::GroupBys < Widget::Base
def render_options(group_by_ary)
group_by_ary.sort_by(&:label).map do |group_by|
next unless group_by.selectable?
+
label_text = CGI::escapeHTML(h(group_by.label)).to_s
option_tags = { value: group_by.underscore_name, 'data-label': label_text }
option_tags[:title] = label_text if group_by.label.length > 40
diff --git a/modules/reporting/lib/widget/table/entry_table.rb b/modules/reporting/lib/widget/table/entry_table.rb
index d30d59d941f..8362f980ac7 100644
--- a/modules/reporting/lib/widget/table/entry_table.rb
+++ b/modules/reporting/lib/widget/table/entry_table.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class ::Widget::Table::EntryTable < ::Widget::Table
+class ::Widget::Table::EntryTable < Widget::Table
FIELDS = %i[spent_on user_id activity_id work_package_id comments logged_by_id project_id].freeze
def render
diff --git a/modules/reporting/spec/features/custom_fields_spec.rb b/modules/reporting/spec/features/custom_fields_spec.rb
index ee31007792e..1ebfb84891f 100644
--- a/modules/reporting/spec/features/custom_fields_spec.rb
+++ b/modules/reporting/spec/features/custom_fields_spec.rb
@@ -112,7 +112,7 @@ describe 'Custom fields reporting', js: true do
# Update filter to value the work package has
select = find(custom_field_selector)
select.find('option', text: 'First option').select_option
- find('#query-icon-apply-button').click
+ find_by_id('query-icon-apply-button').click
# Expect row of work package
within('#result-table') do
diff --git a/modules/reporting/spec/features/filter_spec.rb b/modules/reporting/spec/features/filter_spec.rb
index 75d1bd649ca..242b8be9d64 100644
--- a/modules/reporting/spec/features/filter_spec.rb
+++ b/modules/reporting/spec/features/filter_spec.rb
@@ -20,8 +20,8 @@ describe 'Cost report calculations', js: true do
click_on 'Clear'
# Then filter "spent_on" should not be visible
# And filter "user_id" should not be visible
- expect(page).to have_no_selector("#filter_spent_on")
- expect(page).to have_no_selector("#filter_user_id")
+ expect(page).not_to have_selector("#filter_spent_on")
+ expect(page).not_to have_selector("#filter_user_id")
# Reload restores the query
# And the user with the login "developer" should be selected for "User Value"
diff --git a/modules/reporting/spec/features/me_value_spec.rb b/modules/reporting/spec/features/me_value_spec.rb
index 49734064838..4399dcb389a 100644
--- a/modules/reporting/spec/features/me_value_spec.rb
+++ b/modules/reporting/spec/features/me_value_spec.rb
@@ -37,7 +37,7 @@ describe 'Cost report showing my own times', js: true do
click_on 'Save'
fill_in 'query_name', with: 'Query ME value'
check 'query_is_public'
- find('#query-icon-save-button').click
+ find_by_id('query-icon-save-button').click
expect(page).to have_selector('.report', text: '10.00')
@@ -55,7 +55,7 @@ describe 'Cost report showing my own times', js: true do
# Create and save cost report
visit cost_report_path(report.id, project_id: project.identifier)
- expect(page).to have_no_selector('.report', text: '10.00')
+ expect(page).not_to have_selector('.report', text: '10.00')
expect(page).to have_selector('.report', text: '15.00')
expect(page).to have_field(filter_selector, text: 'me')
diff --git a/modules/reporting/spec/features/my_time_spec.rb b/modules/reporting/spec/features/my_time_spec.rb
index d202a30a9d4..da4bf176a10 100644
--- a/modules/reporting/spec/features/my_time_spec.rb
+++ b/modules/reporting/spec/features/my_time_spec.rb
@@ -33,7 +33,7 @@ describe 'Cost report showing my own times', js: true do
let(:current_user) { user2 }
it 'shows my time' do
- expect(page).to have_no_selector('.report')
+ expect(page).not_to have_selector('.report')
expect(page).to have_selector('.generic-table--no-results-title')
expect(page).not_to have_text '10.0' # 1 EUR x 10
end
diff --git a/modules/reporting/spec/features/permissions_spec.rb b/modules/reporting/spec/features/permissions_spec.rb
index 204940b2c26..c6bc73ed5bf 100644
--- a/modules/reporting/spec/features/permissions_spec.rb
+++ b/modules/reporting/spec/features/permissions_spec.rb
@@ -126,7 +126,7 @@ describe 'Cost report calculations', js: true do
report_page.switch_to_type 'Translations'
expect(page).to have_selector('.generic-table--no-results-title')
- expect(page).to have_no_selector('td.unit', text: '3.0 plural_unit')
+ expect(page).not_to have_selector('td.unit', text: '3.0 plural_unit')
end
end
@@ -141,7 +141,7 @@ describe 'Cost report calculations', js: true do
expect(page).not_to have_content '5.00 hours'
expect(page).not_to have_content '10.00 hours'
report_page.switch_to_type 'Translations'
- expect(page).to have_no_selector('td.unit', text: '3.0 plural_unit')
+ expect(page).not_to have_selector('td.unit', text: '3.0 plural_unit')
end
end
end
diff --git a/modules/reporting/spec/features/saving_spec.rb b/modules/reporting/spec/features/saving_spec.rb
index 762db58aff3..32f95664366 100644
--- a/modules/reporting/spec/features/saving_spec.rb
+++ b/modules/reporting/spec/features/saving_spec.rb
@@ -55,7 +55,7 @@ describe 'Cost report saving', js: true do
end
it 'cannot save reports' do
- expect(page).to have_no_selector('.buttons', text: 'Save')
+ expect(page).not_to have_selector('.buttons', text: 'Save')
end
end
end
diff --git a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
index fa795f395b9..4d6b8a75860 100644
--- a/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
+++ b/modules/reporting/spec/features/support/components/cost_reports_base_table.rb
@@ -46,7 +46,7 @@ module Components
if present
expect(page).to have_selector("#{row_selector(row)} .icon-#{icon}")
else
- expect(page).to have_no_selector("#{row_selector(row)} .icon-#{icon}")
+ expect(page).not_to have_selector("#{row_selector(row)} .icon-#{icon}")
end
end
diff --git a/modules/reporting/spec/features/support/pages/cost_report_page.rb b/modules/reporting/spec/features/support/pages/cost_report_page.rb
index 933133519f9..740ffd940b4 100644
--- a/modules/reporting/spec/features/support/pages/cost_report_page.rb
+++ b/modules/reporting/spec/features/support/pages/cost_report_page.rb
@@ -10,7 +10,7 @@ module Pages
# We often clear the page as the first action of the example,
# which is why the frontend might not be fully initialized
retry_block do
- scroll_to_and_click(find('#query-link-clear', text: 'Clear'))
+ scroll_to_and_click(find_by_id('query-link-clear', text: 'Clear'))
# Safeguard to force waiting for the form to be cleared
expect(page)
@@ -20,10 +20,10 @@ module Pages
def save(as:, public: false)
# Scroll to report bottom and click
- scroll_to_and_click(find('#query-icon-save-as', text: 'Save'))
+ scroll_to_and_click(find_by_id('query-icon-save-as', text: 'Save'))
# Ensure the form is visible
- scroll_to_element find('#save_as_form')
+ scroll_to_element find_by_id('save_as_form')
page.within('#save_as_form') do
fill_in 'Name', with: as
@@ -52,7 +52,7 @@ module Pages
end
def apply
- scroll_to_and_click(find("[id='query-icon-apply-button']"))
+ scroll_to_and_click(find_by_id('query-icon-apply-button'))
end
def add_to_rows(name)
@@ -67,7 +67,7 @@ module Pages
if present
expect(page).to have_selector('#group-by--selected-rows .group-by--selected-element', text:)
else
- expect(page).to have_no_selector('#group-by--selected-rows .group-by--selected-element', text:)
+ expect(page).not_to have_selector('#group-by--selected-rows .group-by--selected-element', text:)
end
end
@@ -75,7 +75,7 @@ module Pages
if present
expect(page).to have_selector('#group-by--selected-columns .group-by--selected-element', text:)
else
- expect(page).to have_no_selector('#group-by--selected-columns .group-by--selected-element', text:)
+ expect(page).not_to have_selector('#group-by--selected-columns .group-by--selected-element', text:)
end
end
@@ -83,7 +83,7 @@ module Pages
if present
expect(page).to have_selector('#ajax-indicator')
else
- expect(page).to have_no_selector('#ajax-indicator')
+ expect(page).not_to have_selector('#ajax-indicator')
end
end
diff --git a/modules/reporting/spec/features/update_cost_report_spec.rb b/modules/reporting/spec/features/update_cost_report_spec.rb
index 4fadbcfe10b..4fe5d720653 100644
--- a/modules/reporting/spec/features/update_cost_report_spec.rb
+++ b/modules/reporting/spec/features/update_cost_report_spec.rb
@@ -56,6 +56,7 @@ describe "updating a cost report's cost type", js: true do
retry_block do
cost_query = CostQuery.find_by!(name: 'My Query')
raise "Expected path change" unless page.has_current_path?("/projects/#{project.identifier}/cost_reports/#{cost_query.id}")
+
expect(page).to have_field('Labor', checked: true)
end
diff --git a/modules/storages/app/services/storages/file_links/create_service.rb b/modules/storages/app/services/storages/file_links/create_service.rb
index e2d6d4fe996..fb515e27f57 100644
--- a/modules/storages/app/services/storages/file_links/create_service.rb
+++ b/modules/storages/app/services/storages/file_links/create_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Storages::FileLinks::CreateService < ::BaseServices::Create
+class Storages::FileLinks::CreateService < BaseServices::Create
def persist(service_result)
if existing = find_existing(service_result.result)
service_result.result = existing
diff --git a/modules/storages/app/services/storages/file_links/set_attributes_service.rb b/modules/storages/app/services/storages/file_links/set_attributes_service.rb
index ee1d4d23785..3ccc2a0d2eb 100644
--- a/modules/storages/app/services/storages/file_links/set_attributes_service.rb
+++ b/modules/storages/app/services/storages/file_links/set_attributes_service.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class Storages::FileLinks::SetAttributesService < ::BaseServices::SetAttributes
+class Storages::FileLinks::SetAttributesService < BaseServices::SetAttributes
def set_default_attributes(_params)
model.creator ||= user
end
diff --git a/modules/storages/lib/api/v3/file_links/file_links_download_api.rb b/modules/storages/lib/api/v3/file_links/file_links_download_api.rb
index 5d425e2defd..7e729852b5b 100644
--- a/modules/storages/lib/api/v3/file_links/file_links_download_api.rb
+++ b/modules/storages/lib/api/v3/file_links/file_links_download_api.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class API::V3::FileLinks::FileLinksDownloadAPI < ::API::OpenProjectAPI
+class API::V3::FileLinks::FileLinksDownloadAPI < API::OpenProjectAPI
using Storages::Peripherals::ServiceResultRefinements
helpers Storages::Peripherals::StorageUrlHelper, Storages::Peripherals::StorageErrorHelper
diff --git a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb b/modules/storages/lib/api/v3/file_links/file_links_open_api.rb
index 15af002cc72..8fb55c50418 100644
--- a/modules/storages/lib/api/v3/file_links/file_links_open_api.rb
+++ b/modules/storages/lib/api/v3/file_links/file_links_open_api.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class API::V3::FileLinks::FileLinksOpenAPI < ::API::OpenProjectAPI
+class API::V3::FileLinks::FileLinksOpenAPI < API::OpenProjectAPI
helpers Storages::Peripherals::StorageUrlHelper
resources :open do
diff --git a/modules/storages/spec/contracts/storages/storages/create_contract_spec.rb b/modules/storages/spec/contracts/storages/storages/create_contract_spec.rb
index 764c13868c3..0797bd81a3d 100644
--- a/modules/storages/spec/contracts/storages/storages/create_contract_spec.rb
+++ b/modules/storages/spec/contracts/storages/storages/create_contract_spec.rb
@@ -38,9 +38,9 @@ describe Storages::Storages::CreateContract do
let(:current_user) { create(:admin) }
let(:storage) do
Storages::Storage.new(name: storage_name,
- provider_type: storage_provider_type,
- host: storage_host,
- creator: storage_creator)
+ provider_type: storage_provider_type,
+ host: storage_host,
+ creator: storage_creator)
end
let(:contract) { described_class.new(storage, current_user) }
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index e9f1f26971e..4466f961202 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -54,16 +54,16 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# Mock a valid response (=200) for example.com, so the host validation should succeed
mock_server_capabilities_response("https://example.com")
mock_server_config_check_response("https://example.com")
- page.find('#storages_storage_name').set("NC 1")
- page.find('#storages_storage_host').set("https://example.com")
+ page.find_by_id('storages_storage_name').set("NC 1")
+ page.find_by_id('storages_storage_host').set("https://example.com")
page.find('button[type=submit]', text: "Save and continue setup").click
# Show created oauth application
storage_type = I18n.t('storages.provider_types.nextcloud.name')
expect(page).to have_title("#{storage_type} #{I18n.t('storages.label_oauth_application_details')}")
- oauth_app_client_id = page.find('#client_id').value
+ oauth_app_client_id = page.find_by_id('client_id').value
expect(oauth_app_client_id.length).to eq 43
- expect(page.find('#secret').value.length).to eq 43
+ expect(page.find_by_id('secret').value.length).to eq 43
page.find('a.button', text: 'Done. Continue setup').click
# Add OAuthClient - Testing a number of different invalid states
@@ -71,21 +71,21 @@ describe 'Admin storages', :storage_server_helpers, js: true do
expect(page).to have_title("OAuth client details")
# Set the client_id but leave client_secret empty
- page.find('#oauth_client_client_id').set("0123456789")
+ page.find_by_id('oauth_client_client_id').set("0123456789")
page.find('button[type=submit]').click
# Check that we're still on the same page
expect(page).to have_title("OAuth client details")
# Set client_id to be empty but set the client_secret
- page.find('#oauth_client_client_id').set("")
- page.find('#oauth_client_client_secret').set("1234567890")
+ page.find_by_id('oauth_client_client_id').set("")
+ page.find_by_id('oauth_client_client_secret').set("1234567890")
page.find('button[type=submit]', text: 'Save').click
# Check that we're still on the same page
expect(page).to have_title("OAuth client details")
# Both client_id and client_secret valid
- page.find('#oauth_client_client_id').set("0123456789")
- page.find('#oauth_client_client_secret').set("1234567890")
+ page.find_by_id('oauth_client_client_id').set("0123456789")
+ page.find_by_id('oauth_client_client_secret').set("1234567890")
page.find('button[type=submit]', text: 'Save').click
# Show details of a storage
@@ -115,8 +115,8 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# The form the new OAuth client shall be empty as we are creating a new one.
expect(page).not_to have_text("234567")
- page.find('#oauth_client_client_id').set("2345678901")
- page.find('#oauth_client_client_secret').set("3456789012")
+ page.find_by_id('oauth_client_client_id').set("2345678901")
+ page.find_by_id('oauth_client_client_secret').set("3456789012")
page.find('button[type=submit]', text: 'Replace').click
# Check for client_id
@@ -126,8 +126,8 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# simulating server not running Nextcloud
page.find('.button--icon.icon-edit').click
mock_server_capabilities_response("https://other.example.com", response_code: '400')
- page.find('#storages_storage_name').set("Other NC")
- page.find('#storages_storage_host').set("https://other.example.com")
+ page.find_by_id('storages_storage_name').set("Other NC")
+ page.find_by_id('storages_storage_host').set("https://other.example.com")
page.find('button[type=submit]', text: "Save").click
expect(page).to have_title("Edit: Other NC")
@@ -138,8 +138,8 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# Edit page - Check for failed Nextcloud Version
# Test the behavior of a Nextcloud server with major version too low
mock_server_capabilities_response("https://old.example.com", response_nextcloud_major_version: 18)
- page.find('#storages_storage_name').set("Old NC")
- page.find('#storages_storage_host').set("https://old.example.com")
+ page.find_by_id('storages_storage_name').set("Old NC")
+ page.find_by_id('storages_storage_host').set("https://old.example.com")
page.find('button[type=submit]', text: "Save").click
expect(page).to have_title("Edit: Old NC")
@@ -149,8 +149,8 @@ describe 'Admin storages', :storage_server_helpers, js: true do
# Edit page - save working storage
# Restore the mocked working server example.com
- page.find('#storages_storage_host').set("https://example.com")
- page.find('#storages_storage_name').set("Other NC")
+ page.find_by_id('storages_storage_host').set("https://example.com")
+ page.find_by_id('storages_storage_name').set("Other NC")
page.find('button[type=submit]', text: "Save").click
created_storage = Storages::Storage.find_by(name: 'Other NC')
diff --git a/modules/team_planner/spec/features/team_planner_index_spec.rb b/modules/team_planner/spec/features/team_planner_index_spec.rb
index 3198ad75295..6e7eb7c7018 100644
--- a/modules/team_planner/spec/features/team_planner_index_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_index_spec.rb
@@ -81,10 +81,10 @@ describe 'Team planner index', js: true, with_ee: %i[team_planner_view] do
expect(page).to have_selector 'td', text: query.name
# Does not show the delete
- expect(page).to have_no_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
+ expect(page).not_to have_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
# Does not show the create button
- expect(page).to have_no_selector '.button', text: 'Team planner'
+ expect(page).not_to have_selector '.button', text: 'Team planner'
end
context 'when the view is non-public' do
@@ -92,13 +92,13 @@ describe 'Team planner index', js: true, with_ee: %i[team_planner_view] do
it 'does not show a non-public view' do
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).to have_no_selector 'td', text: query.name
+ expect(page).not_to have_selector 'td', text: query.name
# Does not show the delete
- expect(page).to have_no_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
+ expect(page).not_to have_selector "[data-qa-selector='team-planner-remove-#{query.id}']"
# Does not show the create button
- expect(page).to have_no_selector '.button', text: 'Team planner'
+ expect(page).not_to have_selector '.button', text: 'Team planner'
end
end
end
diff --git a/modules/team_planner/spec/features/team_planner_menu_spec.rb b/modules/team_planner/spec/features/team_planner_menu_spec.rb
index cadf1578812..3ae87c10aef 100644
--- a/modules/team_planner/spec/features/team_planner_menu_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_menu_spec.rb
@@ -76,7 +76,7 @@ describe 'Team planner sidemenu', js: true do
click_link 'Team planners'
end
- expect(page).to have_no_selector('[data-qa-selector="team-planner--create-button"]')
+ expect(page).not_to have_selector('[data-qa-selector="team-planner--create-button"]')
end
end
diff --git a/modules/team_planner/spec/features/team_planner_split_view_spec.rb b/modules/team_planner/spec/features/team_planner_split_view_spec.rb
index f2b17845ca1..0a3c78f72ae 100644
--- a/modules/team_planner/spec/features/team_planner_split_view_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_split_view_spec.rb
@@ -66,7 +66,7 @@ describe 'Team planner split view navigation', js: true, with_ee: %i[team_planne
# Expect clicking on a work package does not open the details
page.find('[data-qa-selector="op-wp-single-card--content-subject"]', text: work_package1.subject).click
- expect(page).to have_no_current_path /team_planners\/new\/details\/#{work_package1.id}/
+ expect(page).not_to have_current_path /team_planners\/new\/details\/#{work_package1.id}/
# Open split view through info icon
split_view = team_planner.open_split_view_by_info_icon work_package1
diff --git a/modules/team_planner/spec/support/components/add_existing_pane.rb b/modules/team_planner/spec/support/components/add_existing_pane.rb
index 4b21299811f..05f48769647 100644
--- a/modules/team_planner/spec/support/components/add_existing_pane.rb
+++ b/modules/team_planner/spec/support/components/add_existing_pane.rb
@@ -63,7 +63,7 @@ module Components
.to have_selector("[data-qa-selector='op-add-existing-pane--wp-#{work_package.id}']", wait: 10)
else
expect(page)
- .to have_no_selector("[data-qa-selector='op-add-existing-pane--wp-#{work_package.id}']")
+ .not_to have_selector("[data-qa-selector='op-add-existing-pane--wp-#{work_package.id}']")
end
end
diff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rb
index 9db45008130..8c5474cd3d1 100644
--- a/modules/team_planner/spec/support/pages/team_planner.rb
+++ b/modules/team_planner/spec/support/pages/team_planner.rb
@@ -133,7 +133,7 @@ module Pages
if present
expect(page).to have_selector('.fc-event', text: work_package.subject, wait: 10)
else
- expect(page).to have_no_selector('.fc-event', text: work_package.subject)
+ expect(page).not_to have_selector('.fc-event', text: work_package.subject)
end
end
diff --git a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
index 3f862a1ff40..0390e360a0f 100644
--- a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
@@ -1,10 +1,9 @@
require_relative '../spec_helper'
describe 'Admin 2FA management',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- },
- js: true do
+ } do
let(:dialog) { Components::PasswordConfirmationDialog.new }
let(:user_password) { 'admin!' * 4 }
let(:other_user) { create(:user, login: 'bob') }
@@ -22,7 +21,7 @@ describe 'Admin 2FA management',
visit edit_user_path(admin, tab: :two_factor_authentication)
expect(page).to have_selector('.on-off-status.-disabled')
- expect(page).to have_no_selector('.generic-table--empty-row', wait: 1)
+ expect(page).not_to have_selector('.generic-table--empty-row', wait: 1)
page.find('.admin--edit-section a').click
expect(page).to have_selector('.generic-table--empty-row')
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
index 483465e269f..c1a6957a06b 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
@@ -1,8 +1,7 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-describe 'Generate 2FA backup codes', with_config: { '2fa': { active_strategies: [:developer] } },
- js: true do
+describe 'Generate 2FA backup codes', js: true, with_config: { '2fa': { active_strategies: [:developer] } } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
index 07fc8fc138e..3ebcd043025 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
@@ -1,10 +1,9 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-describe 'Login with 2FA backup code', with_settings: {
- plugin_openproject_two_factor_authentication: { 'active_strategies' => [:developer] }
- },
- js: true do
+describe 'Login with 2FA backup code', js: true, with_settings: {
+ plugin_openproject_two_factor_authentication: { 'active_strategies' => [:developer] }
+} do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -19,8 +18,8 @@ describe 'Login with 2FA backup code', with_settings: {
first_login_step
# Open other options
- find('#toggle_resend_form').click
- expect(page).to have_no_selector('a', text: I18n.t('two_factor_authentication.backup_codes.enter_backup_code_title'))
+ find_by_id('toggle_resend_form').click
+ expect(page).not_to have_selector('a', text: I18n.t('two_factor_authentication.backup_codes.enter_backup_code_title'))
end
end
@@ -41,7 +40,7 @@ describe 'Login with 2FA backup code', with_settings: {
# Open other options
# This may fail on the first request when the assets aren't ready yet
SeleniumHubWaiter.wait
- find('#toggle_resend_form').click
+ find_by_id('toggle_resend_form').click
SeleniumHubWaiter.wait
find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'), wait: 2).click
@@ -57,7 +56,7 @@ describe 'Login with 2FA backup code', with_settings: {
# Try again!
first_login_step
SeleniumHubWaiter.wait
- find('#toggle_resend_form').click
+ find_by_id('toggle_resend_form').click
SeleniumHubWaiter.wait
find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title')).click
diff --git a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
index d4f6c73f18f..54f03635e02 100644
--- a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
@@ -2,13 +2,12 @@ require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
describe 'Login with enforced 2FA',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: {
'active_strategies' => [:developer],
'enforced' => true
}
- },
- js: true do
+ } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
index 6615d162032..ef07b0dc412 100644
--- a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
@@ -2,12 +2,11 @@ require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
describe 'Login with 2FA device',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: {
'active_strategies' => [:developer]
}
- },
- js: true do
+ } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
index ba6b7c19e3e..a9a7ac485e0 100644
--- a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
@@ -1,8 +1,7 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-describe 'Login with no required OTP', with_config: { '2fa': { active_strategies: [:developer] } },
- js: true do
+describe 'Login with no required OTP', js: true, with_config: { '2fa': { active_strategies: [:developer] } } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
diff --git a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
index 8b4e478605d..937e5f251c8 100644
--- a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
@@ -2,10 +2,9 @@ require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
describe 'Login by switching 2FA device',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- },
- js: true do
+ } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -25,7 +24,7 @@ describe 'Login by switching 2FA device',
SeleniumHubWaiter.wait
# Toggle device to TOTP
- find('#toggle_resend_form').click
+ find_by_id('toggle_resend_form').click
SeleniumHubWaiter.wait
find(".button--link[value='#{device2.redacted_identifier}']").click
diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
index 0de567e6de1..41a0f65af6f 100644
--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
@@ -1,10 +1,9 @@
require_relative '../spec_helper'
describe 'My Account 2FA configuration',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- },
- js: true do
+ } do
let(:dialog) { Components::PasswordConfirmationDialog.new }
let(:user_password) { 'boB!4' * 4 }
let(:user) do
diff --git a/modules/two_factor_authentication/spec/features/password_change_spec.rb b/modules/two_factor_authentication/spec/features/password_change_spec.rb
index a71e9826b8b..809d92b0c4d 100644
--- a/modules/two_factor_authentication/spec/features/password_change_spec.rb
+++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb
@@ -1,12 +1,11 @@
require_relative '../spec_helper'
describe 'Password change with OTP',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: {
'active_strategies' => [:developer]
}
- },
- js: true do
+ } do
let(:user_password) { 'boB&' * 4 }
let(:new_user_password) { '%obB' * 4 }
let(:user) do
diff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
index 0fd95ce0db8..89de082bc08 100644
--- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
+++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
@@ -2,13 +2,12 @@ require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
describe 'Login with 2FA remember cookie',
- with_settings: {
+ js: true, with_settings: {
plugin_openproject_two_factor_authentication: {
active_strategies: [:developer],
allow_remember_for_days: 30
}
- },
- js: true do
+ } do
let(:user_password) do
"user!user!"
end
@@ -52,7 +51,7 @@ describe 'Login with 2FA remember cookie',
} do
it 'does not show the save form' do
first_login_step
- expect(page).to have_no_selector('input#remember_me')
+ expect(page).not_to have_selector('input#remember_me')
end
end
@@ -63,7 +62,7 @@ describe 'Login with 2FA remember cookie',
find('.two-factor-authentication--remove-remember-cookie-link').click
expect(page).to have_selector('.flash.notice')
- expect(page).to have_no_selector('.two-factor-authentication--remove-remember-cookie-link')
+ expect(page).not_to have_selector('.two-factor-authentication--remove-remember-cookie-link')
# Log out and in again
visit '/logout'
diff --git a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
index c2ecbc66c2a..1ac82d8fb9c 100644
--- a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
+++ b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
@@ -23,7 +23,7 @@ end
def expect_not_logged_in
visit my_account_path
- expect(page).to have_no_selector('.form--field-container', text: user.login)
+ expect(page).not_to have_selector('.form--field-container', text: user.login)
end
shared_examples 'login without 2FA' do
diff --git a/modules/webhooks/app/workers/cleanup_webhook_logs_job.rb b/modules/webhooks/app/workers/cleanup_webhook_logs_job.rb
index 1dc67c00b09..ea9bca03f29 100644
--- a/modules/webhooks/app/workers/cleanup_webhook_logs_job.rb
+++ b/modules/webhooks/app/workers/cleanup_webhook_logs_job.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-class CleanupWebhookLogsJob < ::Cron::CronJob
+class CleanupWebhookLogsJob < Cron::CronJob
# runs at 5:28 on Sunday
self.cron_expression = '28 5 * * 7'
diff --git a/spec/controllers/account_controller_spec.rb b/spec/controllers/account_controller_spec.rb
index 2ec325f5959..283433d4d1d 100644
--- a/spec/controllers/account_controller_spec.rb
+++ b/spec/controllers/account_controller_spec.rb
@@ -322,8 +322,7 @@ describe AccountController,
end
context 'with direct login and redirecting callback',
- with_settings: { login_required?: true },
- with_config: { omniauth_direct_login_provider: 'foo' } do
+ with_config: { omniauth_direct_login_provider: 'foo' }, with_settings: { login_required?: true } do
it 'will still call the callback' do
# Set the previous session
session[:foo] = 'bar'
diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb
index 34c82868687..d4986be9c1d 100644
--- a/spec/controllers/users_controller_spec.rb
+++ b/spec/controllers/users_controller_spec.rb
@@ -482,7 +482,7 @@ describe UsersController do
perform_enqueued_jobs
mail = ActionMailer::Base.deliveries.last
refute_nil mail
- assert_equal [registered_user.mail], mail.to
+ expect([registered_user.mail]).to eq(mail.to)
mail.parts.each do |part|
assert part.body.encoded.include?(I18n.t(:notice_account_activated,
locale: 'de'))
diff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rb
index 392635dd14b..8f2cc441718 100644
--- a/spec/controllers/wiki_controller_spec.rb
+++ b/spec/controllers/wiki_controller_spec.rb
@@ -84,7 +84,7 @@ describe WikiController do
get_page
expect(assigns[:page]).to be_new_record
- expect(assigns[:page]).to be_kind_of WikiPage
+ expect(assigns[:page]).to be_a WikiPage
expect(assigns[:page].wiki).to eq(project.wiki)
end
@@ -92,7 +92,7 @@ describe WikiController do
get_page
expect(assigns[:content]).to be_new_record
- expect(assigns[:content]).to be_kind_of WikiContent
+ expect(assigns[:content]).to be_a WikiContent
expect(assigns[:content].page).to eq(assigns[:page])
end
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index dd3fe89d690..7c474ed65e6 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -139,7 +139,7 @@ describe 'Attribute help texts', js: true do
# Create new, status is now blocked
page.find('.attribute-help-texts--create-button').click
expect(page).to have_selector('#attribute_help_text_attribute_name option', text: 'Assignee')
- expect(page).to have_no_selector('#attribute_help_text_attribute_name option', text: 'Status')
+ expect(page).not_to have_selector('#attribute_help_text_attribute_name option', text: 'Status')
visit attribute_help_texts_path
# Destroy
diff --git a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb b/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb
index 8ef68bb673e..14021c0ae8d 100644
--- a/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb
+++ b/spec/features/admin/custom_fields/multi_value_custom_fields_spec.rb
@@ -48,13 +48,13 @@ describe 'Multi-value custom fields creation', js: true do
fill_in 'custom_field_custom_options_attributes_0_value', with: 'A'
# Add new row
- find('#add-custom-option').click
+ find_by_id('add-custom-option').click
SeleniumHubWaiter.wait
expect(page).to have_selector('input#custom_field_custom_options_attributes_1_value')
fill_in 'custom_field_custom_options_attributes_1_value', with: 'B'
# Add new row
- find('#add-custom-option').click
+ find_by_id('add-custom-option').click
SeleniumHubWaiter.wait
expect(page).to have_selector('input#custom_field_custom_options_attributes_2_value')
fill_in 'custom_field_custom_options_attributes_2_value', with: 'C'
diff --git a/spec/features/admin/enterprise/enterprise_spec.rb b/spec/features/admin/enterprise/enterprise_spec.rb
index 4399fb6e8ee..4dd31b13035 100644
--- a/spec/features/admin/enterprise/enterprise_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_spec.rb
@@ -43,8 +43,8 @@ describe 'Enterprise token', js: true do
token
end
- let(:textarea) { find '#enterprise_token_encoded_token' }
- let(:submit_button) { find '#token-submit-button' }
+ let(:textarea) { find_by_id 'enterprise_token_encoded_token' }
+ let(:submit_button) { find_by_id 'token-submit-button' }
describe 'EnterpriseToken management' do
before do
@@ -87,7 +87,7 @@ describe 'Enterprise token', js: true do
expect(page).to have_selector('.button.icon-delete', text: I18n.t(:button_delete))
# Expect section to be collapsed
- expect(page).to have_no_selector('#token_encoded_token', visible: true)
+ expect(page).not_to have_selector('#token_encoded_token', visible: true)
RequestStore.clear!
expect(EnterpriseToken.current.encoded_token).to eq('foobar')
diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rb
index 6b0736c7523..c1f34ca1e7d 100644
--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb
@@ -171,7 +171,7 @@ describe 'Enterprise trial management',
fill_in 'Last name', with: 'Bar'
fill_in 'Email', with: mail
- find('#trial-general-consent').check
+ find_by_id('trial-general-consent').check
end
it 'blocks the request assuming the mail was used' do
@@ -184,7 +184,7 @@ describe 'Enterprise trial management',
expect(page).to have_selector('.-required-highlighting #trial-email')
expect(page).to have_text('Each user can only create one trial.')
- expect(page).to have_no_text 'email sent - waiting for confirmation'
+ expect(page).not_to have_text 'email sent - waiting for confirmation'
end
it 'blocks the request assuming the domain was used' do
@@ -197,7 +197,7 @@ describe 'Enterprise trial management',
expect(page).to have_selector('.-required-highlighting #trial-domain-name')
expect(page).to have_text('There can only be one active trial per domain.')
- expect(page).to have_no_text 'email sent - waiting for confirmation'
+ expect(page).not_to have_text 'email sent - waiting for confirmation'
end
it 'shows an error in case of other errors' do
@@ -209,7 +209,7 @@ describe 'Enterprise trial management',
find('.button:not(:disabled)', text: 'Submit').click
expect(page).to have_text('Token version is invalid')
- expect(page).to have_no_text 'email sent - waiting for confirmation'
+ expect(page).not_to have_text 'email sent - waiting for confirmation'
end
context 'with a waiting request pending' do
diff --git a/spec/features/admin/menu_item_traversal_spec.rb b/spec/features/admin/menu_item_traversal_spec.rb
index e38ea49ebd1..2d57d936c58 100644
--- a/spec/features/admin/menu_item_traversal_spec.rb
+++ b/spec/features/admin/menu_item_traversal_spec.rb
@@ -45,7 +45,7 @@ describe 'Menu item traversal' do
# using `controller_name` in `menu_controller.rb` has broken this example,
# due to the plugin controller also being named 'admin' thus falling back to 'admin#index' => overview selected
expect(page).to have_selector('.plugin-webhooks-menu-item.selected', text: 'Webhooks', wait: 5)
- expect(page).to have_no_selector('.admin-overview-menu-item.selected')
+ expect(page).not_to have_selector('.admin-overview-menu-item.selected')
end
end
@@ -71,7 +71,7 @@ describe 'Menu item traversal' do
expect(current_url).to include link
expect(page).to have_http_status(:ok)
- expect(page).to have_no_text(I18n.t(:notice_not_authorized))
+ expect(page).not_to have_text(I18n.t(:notice_not_authorized))
expect(page).to have_selector '#menu-sidebar .selected'
}
end
diff --git a/spec/features/admin/oauth/oauth_applications_management_spec.rb b/spec/features/admin/oauth/oauth_applications_management_spec.rb
index ec8499e3a67..1ae84c24abd 100644
--- a/spec/features/admin/oauth/oauth_applications_management_spec.rb
+++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb
@@ -85,8 +85,8 @@ describe 'OAuth applications management', js: true do
SeleniumHubWaiter.wait
find('td a', text: 'My API application').click
- expect(page).to have_no_selector('.attributes-key-value--key', text: 'Client secret')
- expect(page).to have_no_selector('.attributes-key-value--value code')
+ expect(page).not_to have_selector('.attributes-key-value--key', text: 'Client secret')
+ expect(page).not_to have_selector('.attributes-key-value--value code')
expect(page).to have_selector('.attributes-key-value--key', text: 'Client ID')
expect(page).to have_selector('.attributes-key-value--value', text: "urn:ietf:wg:oauth:2.0:oob")
diff --git a/spec/features/admin/test_mail_notification_spec.rb b/spec/features/admin/test_mail_notification_spec.rb
index d0b9eac5aba..a8bab53b18d 100644
--- a/spec/features/admin/test_mail_notification_spec.rb
+++ b/spec/features/admin/test_mail_notification_spec.rb
@@ -45,6 +45,6 @@ describe 'Test mail notification', js: true do
expected = "An error occurred while sending mail (#{error_message})"
expect(page).to have_selector('.flash.error', text: expected)
- expect(page).to have_no_selector('.flash.error strong')
+ expect(page).not_to have_selector('.flash.error strong')
end
end
diff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rb
index 647e25624b7..ac39d871c7a 100644
--- a/spec/features/auth/consent_auth_stage_spec.rb
+++ b/spec/features/auth/consent_auth_stage_spec.rb
@@ -60,7 +60,7 @@ describe 'Authentication Stages' do
def expect_not_logged_in
visit my_account_path
- expect(page).to have_no_selector('.form--field-container', text: user.login)
+ expect(page).not_to have_selector('.form--field-container', text: user.login)
end
context 'when disabled' do
@@ -68,7 +68,7 @@ describe 'Authentication Stages' do
it 'does not show consent' do
login_with user.login, user_password
- expect(page).to have_no_selector('.account-consent')
+ expect(page).not_to have_selector('.account-consent')
expect_logged_in
end
@@ -77,7 +77,7 @@ describe 'Authentication Stages' do
expect(Setting::Autologin.enabled?).to be true
login_with user.login, user_password, autologin: true
- expect(page).to have_no_selector('.account-consent')
+ expect(page).not_to have_selector('.account-consent')
expect_logged_in
cookies = Capybara.current_session.driver.request.cookies
@@ -95,7 +95,7 @@ describe 'Authentication Stages' do
.at_least(:once)
.with('Instance is configured to require consent, but no consent_info has been set.')
login_with user.login, user_password
- expect(page).to have_no_selector('.account-consent')
+ expect(page).not_to have_selector('.account-consent')
expect_logged_in
end
end
@@ -155,7 +155,7 @@ describe 'Authentication Stages' do
# Update consent date
visit admin_settings_users_path
- find("#toggle_consent_time").set(true)
+ find_by_id('toggle_consent_time').set(true)
click_on 'Save'
expect(page).to have_selector('.flash.notice')
diff --git a/spec/features/categories/delete_spec.rb b/spec/features/categories/delete_spec.rb
index 19531f452f4..14a404aab2b 100644
--- a/spec/features/categories/delete_spec.rb
+++ b/spec/features/categories/delete_spec.rb
@@ -55,7 +55,7 @@ describe 'Deletion', js: true do
shared_examples_for 'deleted category' do
it { expect(page).to have_selector('div.generic-table--no-results-container') }
- it { expect(page).to have_no_selector(delete_button) }
+ it { expect(page).not_to have_selector(delete_button) }
end
describe 'w/o work package' do
diff --git a/spec/features/custom_fields/custom_fields_page.rb b/spec/features/custom_fields/custom_fields_page.rb
index da13fe3f6be..a776552e2cf 100644
--- a/spec/features/custom_fields/custom_fields_page.rb
+++ b/spec/features/custom_fields/custom_fields_page.rb
@@ -36,7 +36,7 @@ class CustomFieldsPage
end
def name_attribute
- find '#custom_field_name'
+ find_by_id 'custom_field_name'
end
def default_value_attributes
diff --git a/spec/features/custom_fields/multi_user_custom_field_spec.rb b/spec/features/custom_fields/multi_user_custom_field_spec.rb
index 1f763a688cc..03dc654f92f 100644
--- a/spec/features/custom_fields/multi_user_custom_field_spec.rb
+++ b/spec/features/custom_fields/multi_user_custom_field_spec.rb
@@ -88,7 +88,7 @@ describe "multi select custom values", js: true do
expect(page).to have_text "groupfoo"
expect(page).to have_text "PLACEHOLDER"
- expect(page).to have_no_text "Da Real"
+ expect(page).not_to have_text "Da Real"
work_package.reload
cvs = work_package
diff --git a/spec/features/errors/errors_handler_spec.rb b/spec/features/errors/errors_handler_spec.rb
index f307d5e2a60..b89477e7e21 100644
--- a/spec/features/errors/errors_handler_spec.rb
+++ b/spec/features/errors/errors_handler_spec.rb
@@ -7,7 +7,7 @@ describe 'Errors handling' do
visit '/500'
expect(page).to have_current_path '/500'
expect(page).to have_text "An error occurred on the page you were trying to access."
- expect(page).to have_no_text "Oh no, this is an internal error!"
+ expect(page).not_to have_text "Oh no, this is an internal error!"
end
it 'renders the not found page' do
diff --git a/spec/features/global_roles/global_create_project_spec.rb b/spec/features/global_roles/global_create_project_spec.rb
index 09d56d2a14f..53b06663429 100644
--- a/spec/features/global_roles/global_create_project_spec.rb
+++ b/spec/features/global_roles/global_create_project_spec.rb
@@ -46,7 +46,7 @@ describe 'Global role: Global Create project', js: true do
it 'does not show the global permission' do
visit edit_role_path(role)
expect(page).to have_selector('.form--label-with-check-box', text: 'Edit project')
- expect(page).to have_no_selector('.form--label-with-check-box', text: 'Create project')
+ expect(page).not_to have_selector('.form--label-with-check-box', text: 'Create project')
end
end
@@ -59,7 +59,7 @@ describe 'Global role: Global Create project', js: true do
it 'does show the global permission' do
visit edit_role_path(role)
- expect(page).to have_no_selector('.form--label-with-check-box', text: 'Edit project')
+ expect(page).not_to have_selector('.form--label-with-check-box', text: 'Edit project')
expect(page).to have_selector('.form--label-with-check-box', text: 'Create project')
end
end
@@ -104,7 +104,7 @@ describe 'Global role: Global Create project', js: true do
# And I go to the overall projects page
visit projects_path
# Then I should not see "Project" within ".toolbar-items"
- expect(page).to have_no_selector('.button.-alt-highlight', text: 'Project')
+ expect(page).not_to have_selector('.button.-alt-highlight', text: 'Project')
end
end
end
diff --git a/spec/features/global_roles/global_role_assignment_spec.rb b/spec/features/global_roles/global_role_assignment_spec.rb
index 59cd80f48d4..caa89e1079f 100644
--- a/spec/features/global_roles/global_role_assignment_spec.rb
+++ b/spec/features/global_roles/global_role_assignment_spec.rb
@@ -61,7 +61,7 @@ describe 'Global role: Global role assignment', js: true do
# And I should not see "global_role1" within "#available_principal_roles"
# And I should see "global_role2" within "#available_principal_roles"
page.within('#available_principal_roles') do
- expect(page).to have_no_text 'global_role1'
+ expect(page).not_to have_text 'global_role1'
expect(page).to have_text 'global_role2'
end
@@ -80,8 +80,8 @@ describe 'Global role: Global role assignment', js: true do
# Then I should see "global_role" within "#table_principal_roles"
page.within('#available_principal_roles') do
- expect(page).to have_no_text 'global_role1'
- expect(page).to have_no_text 'global_role2'
+ expect(page).not_to have_text 'global_role1'
+ expect(page).not_to have_text 'global_role2'
end
# And I delete the assigned role "global_role"
@@ -92,13 +92,13 @@ describe 'Global role: Global role assignment', js: true do
# Then I should see "global_role" within "#table_principal_roles"
page.within('#available_principal_roles') do
- expect(page).to have_no_text 'global_role2'
+ expect(page).not_to have_text 'global_role2'
expect(page).to have_text 'global_role1'
end
# And I should not see "global_role" within "#available_principal_roles"
# And I should see "There is currently nothing to display"
page.within('#table_principal_roles') do
- expect(page).to have_no_text 'global_role1'
+ expect(page).not_to have_text 'global_role1'
expect(page).to have_text 'global_role2'
end
end
diff --git a/spec/features/global_roles/global_role_crud_spec.rb b/spec/features/global_roles/global_role_crud_spec.rb
index d5a359c8bd1..edd222910f4 100644
--- a/spec/features/global_roles/global_role_crud_spec.rb
+++ b/spec/features/global_roles/global_role_crud_spec.rb
@@ -44,7 +44,7 @@ describe 'Global role: Global role CRUD', js: true do
# When I go to the new page of "Role"
visit new_role_path
# Then I should not see block with "#global_permissions"
- expect(page).to have_no_selector('#global_permissions', visible: true)
+ expect(page).not_to have_selector('#global_permissions', visible: true)
# When I check "Global Role"
check 'Global Role'
# Then I should see block with "#global_permissions"
@@ -54,7 +54,7 @@ describe 'Global role: Global role CRUD', js: true do
# And I should see "Glob test"
expect(page).to have_text 'Permission Glob Test'
# And I should not see "Issues can be assigned to this role"
- expect(page).to have_no_text 'Issues can be assigned to this role'
+ expect(page).not_to have_text 'Issues can be assigned to this role'
# When I fill in "Name" with "Manager"
fill_in 'Name', with: 'Manager'
# And I click on "Create"
diff --git a/spec/features/global_roles/no_module_spec.rb b/spec/features/global_roles/no_module_spec.rb
index 3b643bce647..48c0ee1b514 100644
--- a/spec/features/global_roles/no_module_spec.rb
+++ b/spec/features/global_roles/no_module_spec.rb
@@ -52,6 +52,6 @@ describe 'Global role: No module', js: true do
visit project_settings_modules_path(project)
expect(page).to have_text 'Activity'
- expect(page).to have_no_text 'Foo'
+ expect(page).not_to have_text 'Foo'
end
end
diff --git a/spec/features/groups/group_show_spec.rb b/spec/features/groups/group_show_spec.rb
index 2acbf5854ec..23f4c6fd51f 100644
--- a/spec/features/groups/group_show_spec.rb
+++ b/spec/features/groups/group_show_spec.rb
@@ -54,8 +54,8 @@ describe 'group show page' do
it 'I can visit the group page' do
visit show_group_path(group)
expect(page).to have_selector('h2', text: "Bob's Team")
- expect(page).to have_no_selector('.toolbar-item')
- expect(page).to have_no_selector('li', text: member.name)
+ expect(page).not_to have_selector('.toolbar-item')
+ expect(page).not_to have_selector('li', text: member.name)
end
end
end
diff --git a/spec/features/localization_spec.rb b/spec/features/localization_spec.rb
index 31adf1770b6..158578410b6 100644
--- a/spec/features/localization_spec.rb
+++ b/spec/features/localization_spec.rb
@@ -29,8 +29,8 @@
require 'spec_helper'
describe 'Localization', with_settings: { login_required?: false,
- available_languages: %i[de en],
- default_language: 'en' } do
+ available_languages: %i[de en],
+ default_language: 'en' } do
it 'set localization' do
Capybara.current_session.driver.header('Accept-Language', 'de,de-de;q=0.8,en-us;q=0.5,en;q=0.3')
diff --git a/spec/features/members/invitation_spec.rb b/spec/features/members/invitation_spec.rb
index c48e8dc0ed0..6825c629f0c 100644
--- a/spec/features/members/invitation_spec.rb
+++ b/spec/features/members/invitation_spec.rb
@@ -86,7 +86,7 @@ describe 'invite user via email', js: true do
retry_block do
click_on 'Add member'
- find('#members_add_form')
+ find_by_id('members_add_form')
end
members_page.search_and_select_principal! '[email protected]',
diff --git a/spec/features/members/membership_filter_spec.rb b/spec/features/members/membership_filter_spec.rb
index 2c289f0f312..6d7465b9d97 100644
--- a/spec/features/members/membership_filter_spec.rb
+++ b/spec/features/members/membership_filter_spec.rb
@@ -65,19 +65,19 @@ describe 'group memberships through groups page', js: true do
members_page.search_for_name 'pan'
members_page.find_user 'Pan Hannibal'
- expect(page).to have_no_selector('td.mail', text: hannibal.mail)
+ expect(page).not_to have_selector('td.mail', text: hannibal.mail)
members_page.find_user 'Peter Pan'
members_page.find_mail peter.mail
members_page.search_for_name '@example'
members_page.find_user 'Pan Hannibal'
- expect(page).to have_no_selector('td.mail', text: hannibal.mail)
+ expect(page).not_to have_selector('td.mail', text: hannibal.mail)
members_page.find_user 'Peter Pan'
members_page.find_mail peter.mail
members_page.search_for_name '@example.org'
members_page.find_user 'Peter Pan'
members_page.find_mail peter.mail
- expect(page).to have_no_selector('td.mail', text: hannibal.mail)
+ expect(page).not_to have_selector('td.mail', text: hannibal.mail)
end
end
diff --git a/spec/features/members/membership_spec.rb b/spec/features/members/membership_spec.rb
index c66e8942ab1..70b072ff7ca 100644
--- a/spec/features/members/membership_spec.rb
+++ b/spec/features/members/membership_spec.rb
@@ -109,8 +109,8 @@ describe 'Administrating memberships via the project settings', js: true do
expect(members_page.contents('status', raw: true)).to eq %w(invited active active)
# Cannot sort by group, roles or status
- expect(page).to have_no_selector('.generic-table--sort-header a', text: 'ROLES')
- expect(page).to have_no_selector('.generic-table--sort-header a', text: 'GROUP')
+ expect(page).not_to have_selector('.generic-table--sort-header a', text: 'ROLES')
+ expect(page).not_to have_selector('.generic-table--sort-header a', text: 'GROUP')
end
end
diff --git a/spec/features/menu_items/help_menu_spec.rb b/spec/features/menu_items/help_menu_spec.rb
index bd7f9ec0ef8..6d7fdba7932 100644
--- a/spec/features/menu_items/help_menu_spec.rb
+++ b/spec/features/menu_items/help_menu_spec.rb
@@ -58,7 +58,7 @@ describe 'Help menu items' do
visit home_path
expect(help_item[:href]).to eq(custom_url)
- expect(page).to have_no_selector('.op-app-help .op-app-menu--dropdown', visible: false)
+ expect(page).not_to have_selector('.op-app-help .op-app-menu--dropdown', visible: false)
end
end
end
diff --git a/spec/features/menu_items/top_menu_item_spec.rb b/spec/features/menu_items/top_menu_item_spec.rb
index 9aea8a7e362..f14733a0cb5 100644
--- a/spec/features/menu_items/top_menu_item_spec.rb
+++ b/spec/features/menu_items/top_menu_item_spec.rb
@@ -138,7 +138,7 @@ describe 'Top menu items', js: true, selenium: true do
it 'does not display new_project' do
expect(page).to have_selector('a.button', exact_text: all_projects)
- expect(page).to have_no_selector('a.button', exact_text: add_project)
+ expect(page).not_to have_selector('a.button', exact_text: add_project)
end
end
@@ -147,7 +147,7 @@ describe 'Top menu items', js: true, selenium: true do
let(:open_menu) { false }
it 'does not show the menu' do
- expect(page).to have_no_selector('#projects-menu')
+ expect(page).not_to have_selector('#projects-menu')
end
end
end
diff --git a/spec/features/menu_items/wiki_menu_item_spec.rb b/spec/features/menu_items/wiki_menu_item_spec.rb
index 2bdbaf7992d..3d156c01ac7 100644
--- a/spec/features/menu_items/wiki_menu_item_spec.rb
+++ b/spec/features/menu_items/wiki_menu_item_spec.rb
@@ -150,7 +150,7 @@ describe 'Wiki menu items' do
find('.main-menu--arrow-left-to-project').click
expect(page)
- .to have_no_selector('.main-item-wrapper', text: 'Custom page name')
+ .not_to have_selector('.main-item-wrapper', text: 'Custom page name')
# deleting the page will remove the menu item
visit project_wiki_path(project, wiki_page)
@@ -183,7 +183,7 @@ describe 'Wiki menu items' do
click_button 'Save'
expect(page)
- .to have_no_selector('.main-menu--children-menu-header', text: other_wiki_page.title)
+ .not_to have_selector('.main-menu--children-menu-header', text: other_wiki_page.title)
expect(page)
.to have_selector('.main-menu--children-menu-header', text: another_wiki_page.title)
diff --git a/spec/features/oauth/authorization_code_flow_spec.rb b/spec/features/oauth/authorization_code_flow_spec.rb
index 557c9ca1da4..6fdddbcea26 100644
--- a/spec/features/oauth/authorization_code_flow_spec.rb
+++ b/spec/features/oauth/authorization_code_flow_spec.rb
@@ -77,7 +77,7 @@ describe 'OAuth authorization code flow',
find('input.button[value="Authorize"]').click
# Expect auth token
- code = find('#authorization_code').text
+ code = find_by_id('authorization_code').text
# And also have a grant for this application
user.oauth_grants.reload
@@ -103,7 +103,7 @@ describe 'OAuth authorization code flow',
# Should be back on access_token path
expect(page).to have_selector('.flash.notice')
- expect(page).to have_no_selector("[id^=oauth-application-grant]")
+ expect(page).not_to have_selector("[id^=oauth-application-grant]")
expect(page).to have_current_path /\/my\/access_token/
diff --git a/spec/features/oauth/pkce_spec.rb b/spec/features/oauth/pkce_spec.rb
index 1224eb0567b..ff860e7d681 100644
--- a/spec/features/oauth/pkce_spec.rb
+++ b/spec/features/oauth/pkce_spec.rb
@@ -94,7 +94,7 @@ describe 'OAuth authorization code flow with PKCE',
find('input.button[value="Authorize"]').click
# Expect auth token
- code = find('#authorization_code').text
+ code = find_by_id('authorization_code').text
# And also have a grant for this application
user.oauth_grants.reload
diff --git a/spec/features/onboarding/onboarding_tour_spec.rb b/spec/features/onboarding/onboarding_tour_spec.rb
index 97a2a40e281..67bf8b07e5e 100644
--- a/spec/features/onboarding/onboarding_tour_spec.rb
+++ b/spec/features/onboarding/onboarding_tour_spec.rb
@@ -74,8 +74,8 @@ describe 'onboarding tour for new users', js: true do
end
it 'when the welcome block does not include the demo projects' do
- expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_no_selector '.enjoyhint_next_btn'
+ expect(page).not_to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
+ expect(page).not_to have_selector '.enjoyhint_next_btn'
end
end
@@ -133,14 +133,14 @@ describe 'onboarding tour for new users', js: true do
find('.enjoyhint_skip_btn').click
# The tutorial disappears
- expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_no_selector '.enjoyhint_next_btn'
+ expect(page).not_to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
+ expect(page).not_to have_selector '.enjoyhint_next_btn'
page.driver.browser.navigate.refresh
# The tutorial did not start again
- expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_no_selector '.enjoyhint_next_btn'
+ expect(page).not_to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
+ expect(page).not_to have_selector '.enjoyhint_next_btn'
end
it 'and I continue the tutorial' do
diff --git a/spec/features/principals/shared_memberships_examples.rb b/spec/features/principals/shared_memberships_examples.rb
index b79d3b0ab8d..8e8a8935a11 100644
--- a/spec/features/principals/shared_memberships_examples.rb
+++ b/spec/features/principals/shared_memberships_examples.rb
@@ -73,8 +73,8 @@ shared_examples 'global user principal membership management flows' do |permissi
principal_page.visit!
principal_page.open_projects_tab!
- expect(page).to have_no_selector('#membership_project_id option', text: project.name, visible: :all)
- expect(page).to have_no_selector('#membership_project_id option', text: project2.name, visible: :all)
+ expect(page).not_to have_selector('#membership_project_id option', text: project.name, visible: :all)
+ expect(page).not_to have_selector('#membership_project_id option', text: project2.name, visible: :all)
end
it 'does not show the membership' do
@@ -87,10 +87,10 @@ shared_examples 'global user principal membership management flows' do |permissi
principal_page.visit!
principal_page.open_projects_tab!
- expect(page).to have_no_selector('tr.member')
+ expect(page).not_to have_selector('tr.member')
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).to have_no_text project2.name
- expect(page).to have_no_text project2.name
+ expect(page).not_to have_text project2.name
+ expect(page).not_to have_text project2.name
end
end
end
@@ -107,10 +107,10 @@ shared_examples 'global user principal membership management flows' do |permissi
principal_page.visit!
principal_page.open_projects_tab!
- expect(page).to have_no_selector('tr.member')
+ expect(page).not_to have_selector('tr.member')
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).to have_no_text project.name
- expect(page).to have_no_text project2.name
+ expect(page).not_to have_text project.name
+ expect(page).not_to have_text project2.name
end
end
@@ -120,7 +120,7 @@ shared_examples 'global user principal membership management flows' do |permissi
it 'returns an error' do
principal_page.visit!
expect(page).to have_text 'You are not authorized to access this page.'
- expect(page).to have_no_text principal.name
+ expect(page).not_to have_text principal.name
end
end
end
diff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rb
index 1915a1d6ba1..fe9a506a59d 100644
--- a/spec/features/projects/create_spec.rb
+++ b/spec/features/projects/create_spec.rb
@@ -120,7 +120,7 @@ describe 'Projects', 'creation', js: true do
within('.op-fieldset') do
expect(page).to have_text 'Optional Foo'
- expect(page).to have_no_text 'Required Foo'
+ expect(page).not_to have_text 'Required Foo'
end
end
end
diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rb
index f287035c81a..6ea9af29837 100644
--- a/spec/features/projects/edit_settings_spec.rb
+++ b/spec/features/projects/edit_settings_spec.rb
@@ -46,8 +46,8 @@ describe 'Projects', 'editing settings', js: true do
it 'hides the field whose functionality is presented otherwise' do
visit project_settings_general_path(project.id)
- expect(page).to have_no_text :all, 'Active'
- expect(page).to have_no_text :all, 'Identifier'
+ expect(page).not_to have_text :all, 'Active'
+ expect(page).not_to have_text :all, 'Identifier'
end
describe 'identifier edit', js: false do
diff --git a/spec/features/projects/export_spec.rb b/spec/features/projects/export_spec.rb
index a1adcf7782e..548ae88c180 100644
--- a/spec/features/projects/export_spec.rb
+++ b/spec/features/projects/export_spec.rb
@@ -100,7 +100,7 @@ describe 'project export', js: true do
click_on 'Apply'
expect(page).to have_text(important_project.name)
- expect(page).to have_no_text(party_project.name)
+ expect(page).not_to have_text(party_project.name)
export!
diff --git a/spec/features/projects/project_autocomplete_spec.rb b/spec/features/projects/project_autocomplete_spec.rb
index e547aa328d1..39f0f52264e 100644
--- a/spec/features/projects/project_autocomplete_spec.rb
+++ b/spec/features/projects/project_autocomplete_spec.rb
@@ -66,7 +66,7 @@ describe 'Projects autocomplete page', js: true do
]
names.map do |name|
- identifier = name.gsub(/[ \-]+/, "-").downcase
+ identifier = name.gsub(/[ -]+/, "-").downcase
create(:project, name:, identifier:)
end
@@ -111,7 +111,7 @@ describe 'Projects autocomplete page', js: true do
# Expect highlights
within(top_menu.search_results) do
expect(page).to have_selector('.op-search-highlight', text: '<strong')
- expect(page).to have_no_selector('strong')
+ expect(page).not_to have_selector('strong')
end
# Expect fuzzy matches for plain
diff --git a/spec/features/projects/projects_custom_fields_spec.rb b/spec/features/projects/projects_custom_fields_spec.rb
index b512ad3babe..e33db0bb3ee 100644
--- a/spec/features/projects/projects_custom_fields_spec.rb
+++ b/spec/features/projects/projects_custom_fields_spec.rb
@@ -227,9 +227,9 @@ describe 'Projects custom fields', js: true do
let(:modal) do
Components::Users::InviteUserModal.new project:,
- principal: invisible_user,
- role:,
- invite_message: 'you are invited'
+ principal: invisible_user,
+ role:,
+ invite_message: 'you are invited'
end
it 'allows setting a visible user CF (regression #26313)' do
diff --git a/spec/features/projects/projects_portfolio_spec.rb b/spec/features/projects/projects_portfolio_spec.rb
index 3d2baf9b433..644cb1de1ef 100644
--- a/spec/features/projects/projects_portfolio_spec.rb
+++ b/spec/features/projects/projects_portfolio_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
describe 'Projects index page',
- with_ee: %i[custom_fields_in_projects_list],
- js: true,
- with_settings: { login_required?: false } do
+ js: true, with_ee: %i[custom_fields_in_projects_list], with_settings: { login_required?: false } do
shared_let(:admin) { create(:admin) }
let(:modal) { Components::WorkPackages::TableConfigurationModal.new }
diff --git a/spec/features/repositories/checkout_instructions_spec.rb b/spec/features/repositories/checkout_instructions_spec.rb
index 1abd9e2286e..3d6e60b478e 100644
--- a/spec/features/repositories/checkout_instructions_spec.rb
+++ b/spec/features/repositories/checkout_instructions_spec.rb
@@ -68,7 +68,7 @@ describe 'Create repository', js: true do
expect(page).to have_selector('#repository--checkout-instructions')
- button = find('#repository--checkout-instructions-toggle')
+ button = find_by_id('repository--checkout-instructions-toggle')
button.click
expect(page).not_to have_selector('#repository--checkout-instructions')
diff --git a/spec/features/repositories/create_repository_spec.rb b/spec/features/repositories/create_repository_spec.rb
index 0115311d097..32c9d96eadb 100644
--- a/spec/features/repositories/create_repository_spec.rb
+++ b/spec/features/repositories/create_repository_spec.rb
@@ -134,7 +134,7 @@ describe 'Create repository', js: true, selenium: true do
expect(content[:style]).not_to match("display: none")
find('input[type="radio"][value="managed"]').set(true)
- content = find('#attributes-group--content-managed')
+ content = find_by_id('attributes-group--content-managed')
expect(content).not_to be_nil
expect(content[:hidden]).to eql 'false'
content = find("##{vendor}-managed", visible: false)
diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb
index 02f1926b52f..63a26510078 100644
--- a/spec/features/search_spec.rb
+++ b/spec/features/search_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-describe 'Search', js: true, with_settings: { per_page_options: '5' }, with_mail: false do
+describe 'Search', js: true, with_mail: false, with_settings: { per_page_options: '5' } do
include Components::Autocompleter::NgSelectAutocompleteHelpers
shared_let(:admin) { create(:admin) }
@@ -263,12 +263,12 @@ describe 'Search', js: true, with_settings: { per_page_options: '5' }, with_mail
'subject')
table.expect_work_package_listed(work_packages.last)
filters.remove_filter('subject')
- page.find('#filter-by-text-input').set(work_packages[5].subject)
+ page.find_by_id('filter-by-text-input').set(work_packages[5].subject)
table.expect_work_package_subject(work_packages[5].subject)
table.ensure_work_package_not_listed!(work_packages.last)
# clearing the text filter and searching by a just a custom field works
- page.find('#filter-by-text-input').set('')
+ page.find_by_id('filter-by-text-input').set('')
filters.add_filter_by(custom_field_string.name,
'is',
[custom_field_string_value],
@@ -402,7 +402,7 @@ describe 'Search', js: true, with_settings: { per_page_options: '5' }, with_mail
.to have_link(searched_for_project.name)
expect(page)
- .to have_no_link(other_project.name)
+ .not_to have_link(other_project.name)
end
end
end
diff --git a/spec/features/support/components/attribute_help_text_modal.rb b/spec/features/support/components/attribute_help_text_modal.rb
index 99aec2ac045..2142d121d4c 100644
--- a/spec/features/support/components/attribute_help_text_modal.rb
+++ b/spec/features/support/components/attribute_help_text_modal.rb
@@ -62,14 +62,14 @@ module Components
page.find('.spot-modal-overlay').tap do |element|
element.click(x: -((element.native.size.width / 2) - 10), y: -((element.native.size.height / 2) - 10))
end
- expect(page).to have_no_selector('[data-qa-selector="attribute-help-text--header"]', text: help_text.attribute_caption)
+ expect(page).not_to have_selector('[data-qa-selector="attribute-help-text--header"]', text: help_text.attribute_caption)
end
def expect_edit(admin:)
if admin
expect(page).to have_selector('.help-text--edit-button')
else
- expect(page).to have_no_selector('.help-text--edit-button')
+ expect(page).not_to have_selector('.help-text--edit-button')
end
end
diff --git a/spec/features/types/form_configuration_query_spec.rb b/spec/features/types/form_configuration_query_spec.rb
index a0205eda80f..83b3bf76129 100644
--- a/spec/features/types/form_configuration_query_spec.rb
+++ b/spec/features/types/form_configuration_query_spec.rb
@@ -98,7 +98,7 @@ describe 'form query configuration', js: true do
type_bug.reload
query_group = type_bug.attribute_groups.detect { |x| x.is_a?(Type::QueryGroup) }
- expect(query_group.attributes).to be_kind_of(Query)
+ expect(query_group.attributes).to be_a(Query)
expect(query_group.key).to eq('Empty test')
end
@@ -138,7 +138,7 @@ describe 'form query configuration', js: true do
visit new_project_work_packages_path(project)
wp_page.expect_no_group 'Subtasks'
- expect(page).to have_no_text 'Subtasks'
+ expect(page).not_to have_text 'Subtasks'
end
end
@@ -274,7 +274,7 @@ describe 'form query configuration', js: true do
results_selector: '.ng-dropdown-panel-items'
expect(results).to have_text "Unrelated task"
- expect(results).to have_no_text "Bug ##{unrelated_task.id} Unrelated bug"
+ expect(results).not_to have_text "Bug ##{unrelated_task.id} Unrelated bug"
# Cancel that referencing
page.find('.wp-create-relation--cancel').click
diff --git a/spec/features/types/form_configuration_spec.rb b/spec/features/types/form_configuration_spec.rb
index 07cdc87fc30..3ec0eba32d4 100644
--- a/spec/features/types/form_configuration_spec.rb
+++ b/spec/features/types/form_configuration_spec.rb
@@ -82,7 +82,7 @@ describe 'form configuration', js: true do
# Wait for page reload
sleep 1
- expect(page).to have_no_selector('.group-head', text: 'WHATEVER')
+ expect(page).not_to have_selector('.group-head', text: 'WHATEVER')
form.expect_group('details', 'Details')
form.expect_attribute(key: :assignee)
end
@@ -162,7 +162,7 @@ describe 'form configuration', js: true do
input.set('FOOBAR')
input.send_keys(:escape)
expect(page).to have_selector('.group-edit-handler', text: 'COOL STUFF')
- expect(page).to have_no_selector('.group-edit-handler', text: 'FOOBAR')
+ expect(page).not_to have_selector('.group-edit-handler', text: 'FOOBAR')
# Create new group
form.add_attribute_group('New Group')
@@ -240,7 +240,7 @@ describe 'form configuration', js: true do
expect(page).to have_selector('.inline-edit--container.estimatedTime')
end
- find('#work-packages--edit-actions-cancel').click
+ find_by_id('work-packages--edit-actions-cancel').click
expect(wp_page).not_to have_alert_dialog
loading_indicator_saveguard
end
diff --git a/spec/features/types/reset_form_configuration_spec.rb b/spec/features/types/reset_form_configuration_spec.rb
index a6b26bca0bd..9612ae0e964 100644
--- a/spec/features/types/reset_form_configuration_spec.rb
+++ b/spec/features/types/reset_form_configuration_spec.rb
@@ -71,8 +71,8 @@ describe 'Reset form configuration', js: true do
# Wait for page reload
SeleniumHubWaiter.wait
- expect(page).to have_no_selector('.group-head', text: 'NEW GROUP')
- expect(page).to have_no_selector('.group-head', text: 'OTHER')
+ expect(page).not_to have_selector('.group-head', text: 'NEW GROUP')
+ expect(page).not_to have_selector('.group-head', text: 'OTHER')
type.reload
expect(type.custom_field_ids).to be_empty
diff --git a/spec/features/users/edit_users_spec.rb b/spec/features/users/edit_users_spec.rb
index 039fa75b35d..f10f297c172 100644
--- a/spec/features/users/edit_users_spec.rb
+++ b/spec/features/users/edit_users_spec.rb
@@ -91,12 +91,12 @@ describe 'edit users', js: true do
it 'can too edit the user' do
visit edit_user_path(user)
- expect(page).to have_no_selector('.admin-overview-menu-item', text: 'Overview')
- expect(page).to have_no_selector('.users-and-permissions-menu-item', text: 'Users and permissions')
+ expect(page).not_to have_selector('.admin-overview-menu-item', text: 'Overview')
+ expect(page).not_to have_selector('.users-and-permissions-menu-item', text: 'Users and permissions')
expect(page).to have_selector('.users-menu-item.selected', text: 'Users')
expect(page).to have_selector 'select#user_auth_source_id'
- expect(page).to have_no_selector 'input#user_password'
+ expect(page).not_to have_selector 'input#user_password'
expect(page).to have_selector '#user_login'
expect(page).to have_selector '#user_firstname'
diff --git a/spec/features/users/invite_user_modal/custom_fields_spec.rb b/spec/features/users/invite_user_modal/custom_fields_spec.rb
index 50f3188fea5..f7181243b64 100644
--- a/spec/features/users/invite_user_modal/custom_fields_spec.rb
+++ b/spec/features/users/invite_user_modal/custom_fields_spec.rb
@@ -36,8 +36,8 @@ describe 'Invite user modal custom fields', js: true do
let(:principal) { build(:invited_user) }
let(:modal) do
Components::Users::InviteUserModal.new project:,
- principal:,
- role:
+ principal:,
+ role:
end
let!(:role) do
create(:role,
@@ -101,7 +101,7 @@ describe 'Invite user modal custom fields', js: true do
expect(page).to have_text "Multi list can't be blank."
# Does not show the non req field
- expect(page).to have_no_text non_req_cf.name
+ expect(page).not_to have_text non_req_cf.name
end
# Fill all fields
diff --git a/spec/features/users/invite_user_modal/invite_user_modal_spec.rb b/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
index b47f0137980..0072199cf19 100644
--- a/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
+++ b/spec/features/users/invite_user_modal/invite_user_modal_spec.rb
@@ -36,9 +36,9 @@ describe 'Invite user modal', js: true do
let(:global_permissions) { %i[] }
let(:modal) do
Components::Users::InviteUserModal.new project:,
- principal:,
- role:,
- invite_message:
+ principal:,
+ role:,
+ invite_message:
end
let!(:role) do
create(:role,
@@ -217,7 +217,7 @@ describe 'Invite user modal', js: true do
it 'disables projects for which you do not have rights' do
ngselect = modal.open_select_in_step '.ng-select-container'
- expect(ngselect).to have_no_text archived_project
+ expect(ngselect).not_to have_text archived_project
end
end
end
@@ -297,7 +297,7 @@ describe 'Invite user modal', js: true do
it 'cannot add an existing user to the project' do
assignee_field.activate!
- expect(page).to have_no_selector('.ng-dropdown-footer', text: 'Invite')
+ expect(page).not_to have_selector('.ng-dropdown-footer', text: 'Invite')
end
end
end
diff --git a/spec/features/users/invite_user_modal/permission_lacking_current_project_spec.rb b/spec/features/users/invite_user_modal/permission_lacking_current_project_spec.rb
index 8487c7ed12c..0ac9aedc124 100644
--- a/spec/features/users/invite_user_modal/permission_lacking_current_project_spec.rb
+++ b/spec/features/users/invite_user_modal/permission_lacking_current_project_spec.rb
@@ -31,8 +31,8 @@ require 'spec_helper'
describe 'Inviting user in project the current user is lacking permission in', js: true do
let(:modal) do
Components::Users::InviteUserModal.new project: invite_project,
- principal: other_user,
- role: view_role
+ principal: other_user,
+ role: view_role
end
let(:quick_add) { Components::QuickAddMenu.new }
diff --git a/spec/features/users/invite_user_modal/subproject_invite_spec.rb b/spec/features/users/invite_user_modal/subproject_invite_spec.rb
index c8a6108404f..32239b4a1e6 100644
--- a/spec/features/users/invite_user_modal/subproject_invite_spec.rb
+++ b/spec/features/users/invite_user_modal/subproject_invite_spec.rb
@@ -38,8 +38,8 @@ describe 'Invite user modal subprojects', js: true do
let(:global_permissions) { %i[] }
let(:modal) do
Components::Users::InviteUserModal.new project: subproject,
- principal: invitable_user,
- role:
+ principal: invitable_user,
+ role:
end
let!(:role) do
create(:role,
@@ -90,7 +90,7 @@ describe 'Invite user modal subprojects', js: true do
expect(page).to have_selector '.ng-dropdown-panel'
- expect(page).to have_no_selector('.ng-dropdown-footer button', text: 'Invite')
+ expect(page).not_to have_selector('.ng-dropdown-footer button', text: 'Invite')
end
end
end
diff --git a/spec/features/users/my_spec.rb b/spec/features/users/my_spec.rb
index 59fce10cc7e..d620924933a 100644
--- a/spec/features/users/my_spec.rb
+++ b/spec/features/users/my_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
describe 'my',
- with_config: { session_store: :active_record_store },
- js: true do
+ js: true, with_config: { session_store: :active_record_store } do
let(:user_password) { 'bob' * 4 }
let(:user) do
create(:user,
diff --git a/spec/features/users/password_change_spec.rb b/spec/features/users/password_change_spec.rb
index 3e222c2bde1..031df3ff9ea 100644
--- a/spec/features/users/password_change_spec.rb
+++ b/spec/features/users/password_change_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
describe 'random password generation',
- with_config: { session_store: :active_record_store },
- js: true do
+ js: true, with_config: { session_store: :active_record_store } do
shared_let(:admin) { create(:admin) }
let(:auth_source) { build(:dummy_auth_source) }
@@ -131,10 +130,10 @@ describe 'random password generation',
find('.form--check-box[value=special]').set true
# Set min length to 4
- find('#settings_password_min_length').set 4
+ find_by_id('settings_password_min_length').set 4
# Set min classes to 3
- find('#settings_password_min_adhered_rules').set 3
+ find_by_id('settings_password_min_adhered_rules').set 3
scroll_to_and_click(find('.button', text: 'Save'))
expect(page).to have_selector('.flash.notice', text: I18n.t(:notice_successful_update))
@@ -181,12 +180,11 @@ describe 'random password generation',
end
context 'with 2 of lowercase, uppercase, and numeric characters',
- with_settings: {
+ js: true, with_settings: {
password_active_rules: %w(lowercase uppercase numeric),
password_min_adhered_rules: 2,
password_min_length: 4
- },
- js: true do
+ } do
it 'enforces those rules' do
# Change to valid password according to spec
user_page.change_password(old_password, 'password')
diff --git a/spec/features/wiki/adding_editing_history_spec.rb b/spec/features/wiki/adding_editing_history_spec.rb
index 7851ad9d3c3..577d1e4543d 100644
--- a/spec/features/wiki/adding_editing_history_spec.rb
+++ b/spec/features/wiki/adding_editing_history_spec.rb
@@ -70,7 +70,7 @@ describe 'wiki pages', js: true, with_settings: { journal_aggregation_time_minut
it 'adding, editing and history' do
visit project_settings_modules_path(project)
- expect(page).to have_no_selector('.menu-sidebar .main-item-wrapper', text: 'Wiki')
+ expect(page).not_to have_selector('.menu-sidebar .main-item-wrapper', text: 'Wiki')
within '#content' do
check 'Wiki'
diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rb
index 47d2ef71b51..eaafe1091ac 100644
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@ -132,7 +132,7 @@ describe 'Upload attachment to work package', js: true do
sleep 2
- scroll_to_and_click find('#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.'
@@ -152,7 +152,7 @@ describe 'Upload attachment to work package', js: true do
subject = new_page.edit_field :subject
subject.set_value 'A second task'
- scroll_to_and_click find('#work-packages--edit-actions-save')
+ scroll_to_and_click find_by_id('work-packages--edit-actions-save')
new_page.expect_toast(
message: 'Successful creation.'
@@ -200,7 +200,7 @@ describe 'Upload attachment to work package', js: true do
sleep 2
- scroll_to_and_click find('#work-packages--edit-actions-save')
+ scroll_to_and_click find_by_id('work-packages--edit-actions-save')
wp_page.expect_toast(
message: 'Successful creation.'
@@ -274,7 +274,7 @@ describe 'Upload attachment to work package', js: true do
##
# Attach file manually
- expect(page).to have_no_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]')
attachments.attach_file_on_input(image_fixture.path)
expect(page).not_to have_selector('op-toasters-upload-progress')
expect(page).to have_selector('[data-qa-selector="op-files-tab--file-list-item-title"]', text: 'image.png', wait: 5)
diff --git a/spec/features/work_packages/cancel_editing_spec.rb b/spec/features/work_packages/cancel_editing_spec.rb
index 74f24d15972..a56a90bea71 100644
--- a/spec/features/work_packages/cancel_editing_spec.rb
+++ b/spec/features/work_packages/cancel_editing_spec.rb
@@ -57,7 +57,7 @@ describe 'Cancel editing work package', js: true do
end
def expect_subject(val)
- subject = page.find('#wp-new-inline-edit--field-subject')
+ subject = page.find_by_id('wp-new-inline-edit--field-subject')
expect(subject.value).to eq(val)
end
@@ -122,7 +122,7 @@ describe 'Cancel editing work package', js: true do
it 'cancels the editing when clicking the button' do
paths.each do |path|
expect_active_edit(path)
- find('#work-packages--edit-actions-cancel').click
+ find_by_id('work-packages--edit-actions-cancel').click
expect(wp_page).not_to have_alert_dialog
end
@@ -132,7 +132,7 @@ describe 'Cancel editing work package', js: true do
# Start creating on split view
expect_active_edit(new_split_work_packages_path)
- find('#wp-new-inline-edit--field-subject').set 'foobar'
+ find_by_id('wp-new-inline-edit--field-subject').set 'foobar'
# Expect editing works when moving to full screen
find('.work-packages-show-view-button').click
@@ -149,7 +149,7 @@ describe 'Cancel editing work package', js: true do
expect_subject('foobar')
# Cancel edition
- find('#work-packages--edit-actions-cancel').click
+ find_by_id('work-packages--edit-actions-cancel').click
expect(wp_page).not_to have_alert_dialog
# Visiting another page does not create alert
@@ -193,7 +193,7 @@ describe 'Cancel editing work package', js: true do
wp_table.open_split_view(work_package2)
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_no_selector('#wp-new-inline-edit--field-subject')
+ expect(page).not_to have_selector('#wp-new-inline-edit--field-subject')
expect(page).to have_selector('.work-packages--details--subject', text: work_package2.subject)
# Moving somewhere else
diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
index 57162da8f81..b41be5446d5 100644
--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require 'support/edit_fields/edit_field'
describe 'Datepicker modal logic test cases (WP #43539)',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true do
+ js: true, with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:user) { create(:admin) }
shared_let(:type_bug) { create(:type_bug) }
diff --git a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
index 359aa1be7b8..1061aec8b16 100644
--- a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require 'support/edit_fields/edit_field'
describe 'Datepicker logic on parents',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true do
+ js: true, with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:user) { create(:admin) }
# assume sat+sun are non working days
diff --git a/spec/features/work_packages/details/markdown/activity_comments_spec.rb b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
index c9ee766ce11..fe9b590f0c3 100644
--- a/spec/features/work_packages/details/markdown/activity_comments_spec.rb
+++ b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
@@ -42,7 +42,7 @@ describe 'activity comments', js: true, with_mail: false do
comment_field.click_and_type_slowly 'this is a comment'
comment_field.submit_by_enter
- expect(page).to have_no_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).not_to have_selector('.user-comment .message', text: 'this is a comment')
end
it 'submits with click' do
@@ -95,7 +95,7 @@ describe 'activity comments', js: true, with_mail: false do
wp_page.expect_comment text: 'this is my fifth comment!1'
# Expect no activity details
- expect(page).to have_no_selector('.work-package-details-activities-messages li')
+ expect(page).not_to have_selector('.work-package-details-activities-messages li')
end
end
@@ -108,13 +108,13 @@ describe 'activity comments', js: true, with_mail: false do
comment_field.cancel_by_escape
expect(comment_field.editing?).to be true
- expect(page).to have_no_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).not_to have_selector('.user-comment .message', text: 'this is a comment')
# Click should cancel the editing
comment_field.cancel_by_click
expect(comment_field.editing?).to be false
- expect(page).to have_no_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).not_to have_selector('.user-comment .message', text: 'this is a comment')
end
end
@@ -154,7 +154,7 @@ describe 'activity comments', js: true, with_mail: false do
wp_page.expect_comment text: 'bold text', subselector: 'strong'
# Hover the new activity
- activity = page.find('#activity-2')
+ activity = page.find_by_id('activity-2')
page.driver.browser.action.move_to(activity.native).perform
# Check the edit textarea
@@ -209,7 +209,7 @@ describe 'activity comments', js: true, with_mail: false do
comment_field.submit_by_click
# Scroll to the activity
- scroll_to_element(page.find('#activity-2'))
+ scroll_to_element(page.find_by_id('activity-2'))
wp_page.expect_comment text: 'this is a bold remark'
wp_page.expect_comment count: 2
@@ -293,7 +293,7 @@ describe 'activity comments', js: true, with_mail: false do
end
it 'does not show the field' do
- expect(page).to have_no_selector(selector, visible: true)
+ expect(page).not_to have_selector(selector, visible: true)
end
end
end
diff --git a/spec/features/work_packages/details/markdown/description_editor_spec.rb b/spec/features/work_packages/details/markdown/description_editor_spec.rb
index 34fbacf9204..72da66f09ad 100644
--- a/spec/features/work_packages/details/markdown/description_editor_spec.rb
+++ b/spec/features/work_packages/details/markdown/description_editor_spec.rb
@@ -110,7 +110,7 @@ describe 'description inplace editor', js: true, selenium: true do
let(:role) { create(:role, permissions: %i(view_work_packages)) }
it 'does not show the field' do
- expect(page).to have_no_selector('.inline-edit--display-field.description.-editable')
+ expect(page).not_to have_selector('.inline-edit--display-field.description.-editable')
field.display_element.click
field.expect_inactive!
diff --git a/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb b/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
index 352078295a2..e46cb109f2c 100644
--- a/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
+++ b/spec/features/work_packages/details/query_groups/relation_query_group_spec.rb
@@ -178,8 +178,8 @@ describe 'Work package with relation query group', js: true, selenium: true do
full_wp.ensure_page_loaded
# Will first try to load the query, and then hide it.
- expect(page).to have_no_selector('.attributes-group--header-text', text: query_text, wait: 20)
- expect(page).to have_no_selector('.work-packages-embedded-view--container .op-toast.-error')
+ expect(page).not_to have_selector('.attributes-group--header-text', text: query_text, wait: 20)
+ expect(page).not_to have_selector('.work-packages-embedded-view--container .op-toast.-error')
end
end
end
diff --git a/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb b/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
index 2e897802f37..995d86bc2bb 100644
--- a/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_custom_fields_spec.rb
@@ -67,7 +67,7 @@ describe 'creating a child directly after the wp itself was created', js: true d
scroll_to_and_click relations_tab
find('[data-qa-selector="op-wp-inline-create"]').click
fill_in 'wp-new-inline-edit--field-subject', with: 'A child WP'
- find('#wp-new-inline-edit--field-subject').native.send_keys(:return)
+ find_by_id('wp-new-inline-edit--field-subject').native.send_keys(:return)
# Expect CF value to be still visible
wp_page.expect_and_dismiss_toaster(message: 'Successful creation.')
diff --git a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
index 84c01023a0d..0d9f22232d3 100644
--- a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
@@ -50,9 +50,9 @@ describe 'work package hierarchies for milestones', js: true, selenium: true do
it 'does not provide links to add children or existing children (Regression #28745)' do
within('.wp-relations--children') do
- expect(page).to have_no_text('Add existing child')
- expect(page).to have_no_text('Create new child')
- expect(page).to have_no_selector('wp-inline-create--add-link')
+ expect(page).not_to have_text('Add existing child')
+ expect(page).not_to have_text('Create new child')
+ expect(page).not_to have_selector('wp-inline-create--add-link')
end
end
end
diff --git a/spec/features/work_packages/details/relations/hierarchy_spec.rb b/spec/features/work_packages/details/relations/hierarchy_spec.rb
index cd34e708dc3..f071d4dbdaf 100644
--- a/spec/features/work_packages/details/relations/hierarchy_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_spec.rb
@@ -207,17 +207,17 @@ shared_examples 'work package relations tab', js: true, selenium: true do
it 'shows no links to create relations' do
# No create buttons should exist
- expect(page).to have_no_selector('.wp-relations-create-button')
+ expect(page).not_to have_selector('.wp-relations-create-button')
# Test for add relation
- expect(page).to have_no_selector('#relation--add-relation')
+ expect(page).not_to have_selector('#relation--add-relation')
# Test for add parent
- expect(page).to have_no_selector('.wp-relation--parent-change')
+ expect(page).not_to have_selector('.wp-relation--parent-change')
# Test for add children
- expect(page).to have_no_selector('#hierarchy--add-existing-child')
- expect(page).to have_no_selector('#hierarchy--add-new-child')
+ expect(page).not_to have_selector('#hierarchy--add-existing-child')
+ expect(page).not_to have_selector('#hierarchy--add-new-child')
# But it should show the linked parent
expect(page).to have_selector('[data-qa-selector="op-wp-breadcrumb-parent"]', text: parent.subject)
diff --git a/spec/features/work_packages/details/relations/relations_spec.rb b/spec/features/work_packages/details/relations/relations_spec.rb
index 8dd62459c96..588a98da1d0 100644
--- a/spec/features/work_packages/details/relations/relations_spec.rb
+++ b/spec/features/work_packages/details/relations/relations_spec.rb
@@ -163,10 +163,10 @@ describe 'Work package relations tab', js: true, selenium: true do
it 'shows no links to create relations' do
# No create buttons should exist
- expect(page).to have_no_selector('.wp-relations-create-button')
+ expect(page).not_to have_selector('.wp-relations-create-button')
# Test for add relation
- expect(page).to have_no_selector('#relation--add-relation')
+ expect(page).not_to have_selector('#relation--add-relation')
end
end
@@ -184,7 +184,7 @@ describe 'Work package relations tab', js: true, selenium: true do
tabs.expect_counter(relations_tab, 1)
relations.remove_relation(relatable)
- expect(page).to have_no_selector('.relation-group--header', text: 'FOLLOWS')
+ expect(page).not_to have_selector('.relation-group--header', text: 'FOLLOWS')
# If there are no relations, the counter badge should not be displayed
tabs.expect_no_counter(relations_tab)
@@ -204,15 +204,15 @@ describe 'Work package relations tab', js: true, selenium: true do
# Expect to have row
relations.hover_action(relatable, :delete)
- expect(page).to have_no_selector('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_no_selector('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).not_to have_selector('.relation-group--header', text: 'FOLLOWS')
+ expect(page).not_to have_selector('.wp-relations--subject-field', text: relatable.subject)
# Back to split view
page.execute_script('window.history.back()')
work_packages_page.expect_subject
- expect(page).to have_no_selector('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_no_selector('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).not_to have_selector('.relation-group--header', text: 'FOLLOWS')
+ expect(page).not_to have_selector('.wp-relations--subject-field', text: relatable.subject)
end
it 'follows the relation links (Regression #26794)' do
@@ -274,7 +274,7 @@ describe 'Work package relations tab', js: true, selenium: true do
# Toggle to close
relations.hover_action(relatable, :info)
- expect(created_row).to have_no_selector('.wp-relation--description-read-value')
+ expect(created_row).not_to have_selector('.wp-relation--description-read-value')
end
end
end
diff --git a/spec/features/work_packages/details/workdays_spec.rb b/spec/features/work_packages/details/workdays_spec.rb
index 17e3d589c8f..5ea15cfc954 100644
--- a/spec/features/work_packages/details/workdays_spec.rb
+++ b/spec/features/work_packages/details/workdays_spec.rb
@@ -34,8 +34,7 @@ require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
describe 'Work packages datepicker workdays',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true do
+ js: true, with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:project) { create(:project_with_types, public: true) }
shared_let(:work_package) { create(:work_package, project:, start_date: Date.parse('2022-01-01')) }
shared_let(:user) { create(:admin) }
diff --git a/spec/features/work_packages/display_representations/switch_display_representations_spec.rb b/spec/features/work_packages/display_representations/switch_display_representations_spec.rb
index e1dff76e05d..c5a2a3ee697 100644
--- a/spec/features/work_packages/display_representations/switch_display_representations_spec.rb
+++ b/spec/features/work_packages/display_representations/switch_display_representations_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
describe 'Switching work package view',
- with_ee: %i[conditional_highlighting],
- js: true do
+ js: true, with_ee: %i[conditional_highlighting] do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
diff --git a/spec/features/work_packages/highlighting_spec.rb b/spec/features/work_packages/highlighting_spec.rb
index c6d693a7226..bbd6ea99fa4 100644
--- a/spec/features/work_packages/highlighting_spec.rb
+++ b/spec/features/work_packages/highlighting_spec.rb
@@ -1,8 +1,7 @@
require 'spec_helper'
describe 'Work Package highlighting fields',
- with_ee: %i[conditional_highlighting],
- js: true do
+ js: true, with_ee: %i[conditional_highlighting] do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -138,9 +137,9 @@ describe 'Work Package highlighting fields',
expect(query.highlighting_mode).to eq(:status)
## This disables any inline styles
- expect(page).to have_no_selector('[class*="__hl_inline_status"]')
- expect(page).to have_no_selector('[class*="__hl_inline_priority"]')
- expect(page).to have_no_selector('[class*="__hl_date"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_status"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_priority"]')
+ expect(page).not_to have_selector('[class*="__hl_date"]')
# Highlight entire row by priority
highlighting.switch_entire_row_highlight 'Priority'
@@ -159,9 +158,9 @@ describe 'Work Package highlighting fields',
page.driver.refresh
expect(page).to have_selector("#{wp_table.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
expect(page).to have_selector("#{wp_table.row_selector(wp_2)}.__hl_background_priority_#{priority_no_color.id}")
- expect(page).to have_no_selector('[class*="__hl_inline_status"]')
- expect(page).to have_no_selector('[class*="__hl_inline_priority"]')
- expect(page).to have_no_selector('[class*="__hl_date"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_status"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_priority"]')
+ expect(page).not_to have_selector('[class*="__hl_date"]')
# Save query
wp_table.save
@@ -170,16 +169,16 @@ describe 'Work Package highlighting fields',
expect(query.highlighting_mode).to eq(:priority)
## This disables any inline styles
- expect(page).to have_no_selector('[class*="__hl_inline_status"]')
- expect(page).to have_no_selector('[class*="__hl_inline_priority"]')
- expect(page).to have_no_selector('[class*="__hl_date"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_status"]')
+ expect(page).not_to have_selector('[class*="__hl_inline_priority"]')
+ expect(page).not_to have_selector('[class*="__hl_date"]')
# No highlighting
highlighting.switch_highlighting_mode 'No highlighting'
- expect(page).to have_no_selector('[class*="__hl_background"]')
- expect(page).to have_no_selector('[class*="__hl_background_status"]')
- expect(page).to have_no_selector('[class*="__hl_background_priority"]')
- expect(page).to have_no_selector('[class*="__hl_date"]')
+ expect(page).not_to have_selector('[class*="__hl_background"]')
+ expect(page).not_to have_selector('[class*="__hl_background_status"]')
+ expect(page).not_to have_selector('[class*="__hl_background_priority"]')
+ expect(page).not_to have_selector('[class*="__hl_date"]')
# Save query
wp_table.save
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index 43ca95fb290..379fdc0b53c 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -173,7 +173,7 @@ describe 'Work package navigation', js: true, selenium: true do
work_package.save!
visit search_path(q: 'Foo', work_packages: 1, scope: :all)
- table = Pages::EmbeddedWorkPackagesTable.new page.find('#content')
+ table = Pages::EmbeddedWorkPackagesTable.new page.find_by_id('content')
table.expect_work_package_listed work_package
full_page = table.open_full_screen_by_doubleclick work_package
diff --git a/spec/features/work_packages/new/new_work_package_datepicker_spec.rb b/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
index 74b0e2e05cc..5ace7b56154 100644
--- a/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_datepicker_spec.rb
@@ -34,8 +34,7 @@ require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
describe 'New work package datepicker',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true, selenium: true do
+ js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
let(:project) { create(:project_with_types, public: true) }
let(:user) { create(:admin) }
diff --git a/spec/features/work_packages/new/new_work_package_spec.rb b/spec/features/work_packages/new/new_work_package_spec.rb
index eeaf02794c9..17d02362a0d 100644
--- a/spec/features/work_packages/new/new_work_package_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_spec.rb
@@ -38,7 +38,7 @@ describe 'new work package', js: true do
end
def save_work_package!(expect_success = true)
- scroll_to_and_click find('#work-packages--edit-actions-save')
+ scroll_to_and_click find_by_id('work-packages--edit-actions-save')
if expect_success
toaster.expect_success('Successful creation.')
@@ -242,7 +242,7 @@ describe 'new work package', js: true do
end
it 'reloads the table and selects the new work package' do
- expect(page).to have_no_selector('.wp--row')
+ expect(page).not_to have_selector('.wp--row')
create_work_package(type_task)
expect(page).to have_selector(safeguard_selector, wait: 10)
@@ -327,7 +327,7 @@ describe 'new work package', js: true do
click_on 'Cancel'
wp_page.click_create_wp_button type_bug
- expect(page).to have_no_selector('.ng-value', text: project.name)
+ expect(page).not_to have_selector('.ng-value', text: project.name)
project_field.openSelectField
project_field.set_value project.name
@@ -390,7 +390,7 @@ describe 'new work package', js: true do
project_field.openSelectField
expect(page).to have_selector('.ng-dropdown-panel .ng-option', text: project.name)
- expect(page).to have_no_selector('.ng-dropdown-panel .ng-option', text: project_without_bug.name)
+ expect(page).not_to have_selector('.ng-dropdown-panel .ng-option', text: project_without_bug.name)
end
end
end
diff --git a/spec/features/work_packages/new/work_package_default_description_spec.rb b/spec/features/work_packages/new/work_package_default_description_spec.rb
index ba71de0637c..acc28bb2c8d 100644
--- a/spec/features/work_packages/new/work_package_default_description_spec.rb
+++ b/spec/features/work_packages/new/work_package_default_description_spec.rb
@@ -58,7 +58,7 @@ describe 'new work package', js: true, with_mail: false do
sleep 1
end
- scroll_to_and_click find('#work-packages--edit-actions-save')
+ scroll_to_and_click find_by_id('work-packages--edit-actions-save')
wp_page.expect_toast message: 'Successful creation.'
expect(page).to have_selector('.inline-edit--display-field.description', text: 'Something different than the default.')
diff --git a/spec/features/work_packages/project_context_switch_spec.rb b/spec/features/work_packages/project_context_switch_spec.rb
index 4b069053108..904593831cb 100644
--- a/spec/features/work_packages/project_context_switch_spec.rb
+++ b/spec/features/work_packages/project_context_switch_spec.rb
@@ -28,6 +28,6 @@ describe 'Project context switching spec', js: true do
link.click
wp_page.ensure_page_loaded
- expect(page).to have_no_selector('.attributes-group.-project-context')
+ expect(page).not_to have_selector('.attributes-group.-project-context')
end
end
diff --git a/spec/features/work_packages/project_include/project_include_shared_examples.rb b/spec/features/work_packages/project_include/project_include_shared_examples.rb
index 596ff448ddf..921dece5cef 100644
--- a/spec/features/work_packages/project_include/project_include_shared_examples.rb
+++ b/spec/features/work_packages/project_include/project_include_shared_examples.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-shared_examples 'has a project include dropdown', type: :feature, js: true do
+shared_examples 'has a project include dropdown', js: true, type: :feature do
let(:dropdown) { Components::ProjectIncludeComponent.new }
shared_let(:project) do
@@ -459,6 +459,6 @@ shared_examples 'has a project include dropdown', type: :feature, js: true do
dropdown.toggle!
dropdown.expect_open
dropdown.search 'Nonexistent'
- expect(page).to have_no_selector("[data-qa-selector='op-project-include--loading']")
+ expect(page).not_to have_selector("[data-qa-selector='op-project-include--loading']")
end
end
diff --git a/spec/features/work_packages/select/select_work_package_row_spec.rb b/spec/features/work_packages/select/select_work_package_row_spec.rb
index d0f5010c43d..9cb27b527ee 100644
--- a/spec/features/work_packages/select/select_work_package_row_spec.rb
+++ b/spec/features/work_packages/select/select_work_package_row_spec.rb
@@ -105,13 +105,13 @@ describe 'Select work package row', js: true, selenium: true do
def check_all
find('body').send_keys [:control, 'a']
expect_row_checked(1, 2, 3)
- expect(page).to have_no_selector '#work-package-context-menu'
+ expect(page).not_to have_selector '#work-package-context-menu'
end
def uncheck_all
find('body').send_keys [:control, 'd']
expect_row_unchecked(1, 2, 3)
- expect(page).to have_no_selector '#work-package-context-menu'
+ expect(page).not_to have_selector '#work-package-context-menu'
end
it 'handles selection flows' do
@@ -216,12 +216,12 @@ describe 'Select work package row', js: true, selenium: true do
end
it do
- find('#work-packages-details-view-button').click
+ find_by_id('work-packages-details-view-button').click
split_wp = Pages::SplitWorkPackage.new(work_package_2)
split_wp.expect_attributes Subject: work_package_2.subject
- find('#work-packages-details-view-button').click
- expect(page).to have_no_selector('.work-packages--details')
+ find_by_id('work-packages-details-view-button').click
+ expect(page).not_to have_selector('.work-packages--details')
end
end
end
diff --git a/spec/features/work_packages/select/select_wp_card_spec.rb b/spec/features/work_packages/select/select_wp_card_spec.rb
index 4e123838b8f..3dab2cfd0ec 100644
--- a/spec/features/work_packages/select/select_wp_card_spec.rb
+++ b/spec/features/work_packages/select/select_wp_card_spec.rb
@@ -60,12 +60,12 @@ describe 'Select work package card', js: true, selenium: true do
it 'the split screen of the selected WP' do
wp_card_view.select_work_package(work_package_2)
- find('#work-packages-details-view-button').click
+ find_by_id('work-packages-details-view-button').click
split_wp = Pages::SplitWorkPackage.new(work_package_2)
split_wp.expect_attributes Subject: work_package_2.subject
- find('#work-packages-details-view-button').click
- expect(page).to have_no_selector('.work-packages--details')
+ find_by_id('work-packages-details-view-button').click
+ expect(page).not_to have_selector('.work-packages--details')
end
end
end
diff --git a/spec/features/work_packages/sorting/manual_sorting_spec.rb b/spec/features/work_packages/sorting/manual_sorting_spec.rb
index 36ecff917a1..49212bf410f 100644
--- a/spec/features/work_packages/sorting/manual_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/manual_sorting_spec.rb
@@ -227,7 +227,7 @@ describe 'Manual sorting of WP table', js: true do
expect(page).to have_selector('.group--value', text: 'Task (1)')
expect(page).to have_selector('.group--value', text: 'Bug (3)')
- expect(page).to have_no_selector '.op-toast.error'
+ expect(page).not_to have_selector '.op-toast.error'
end
end
end
diff --git a/spec/features/work_packages/table/configuration_modal/column_spec.rb b/spec/features/work_packages/table/configuration_modal/column_spec.rb
index 0dcf288e7f5..c97d4ed7692 100644
--- a/spec/features/work_packages/table/configuration_modal/column_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/column_spec.rb
@@ -39,7 +39,7 @@ describe 'Work Package table configuration modal columns spec', js: true do
expect(page).to have_selector('.wp-table--table-header', text: 'ID')
expect(page).to have_selector('.wp-table--table-header', text: 'PROJECT')
- expect(page).to have_no_selector('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).not_to have_selector('.wp-table--table-header', text: 'SUBJECT')
end
end
diff --git a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
index 5b2ad8fd539..6fd79836811 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_shared_examples.rb
@@ -53,8 +53,8 @@ shared_examples_for 'provides a single WP context menu' do
expect(page).to have_selector('.inline-edit--container.subject input')
expect(current_url).to match(/.*\/create_new\?.*(&)*parent_id=#{work_package.id}/)
- find('#work-packages--edit-actions-cancel').click
- expect(page).to have_no_selector('.inline-edit--container.subject input')
+ find_by_id('work-packages--edit-actions-cancel').click
+ expect(page).not_to have_selector('.inline-edit--container.subject input')
# Timeline actions only shown when open
wp_timeline.expect_timeline!(open: false)
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
index d93e2398dbc..1246e6ae17e 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb
@@ -162,7 +162,7 @@ describe 'Work Package table hierarchy parent below', js: true do
relations.remove_child(child)
loading_indicator_saveguard
- expect(page).to have_no_selector('.wp-table--hierarchy-indicator-icon')
+ expect(page).not_to have_selector('.wp-table--hierarchy-indicator-icon')
end
end
end
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
index c0660ab4c73..926841ab37b 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
@@ -136,7 +136,7 @@ describe 'Work Package table hierarchy', js: true do
hierarchy.enable_hierarchy
# Should not be marked as additional row (grey)
- expect(page).to have_no_selector('.wp-table--hierarchy-aditional-row')
+ expect(page).not_to have_selector('.wp-table--hierarchy-aditional-row')
hierarchy.expect_hierarchy_at(wp_root, wp_inter)
hierarchy.expect_leaf_at(wp_leaf)
diff --git a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
index 4fc5f055f24..7532d0d6810 100644
--- a/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
+++ b/spec/features/work_packages/table/inline_create/create_work_packages_spec.rb
@@ -77,7 +77,7 @@ describe 'inline create work package', js: true do
)
# Expect no inline create open
- expect(page).to have_no_selector('.wp-inline-create-row')
+ expect(page).not_to have_selector('.wp-inline-create-row')
end
end
diff --git a/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb b/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
index 858dae7149c..d6aa765fec1 100644
--- a/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
+++ b/spec/features/work_packages/table/inline_create/parallel_creation_spec.rb
@@ -59,7 +59,7 @@ describe 'Parallel work package creation spec', js: true do
# There should be one row, and no open inline create row
expect(page).to have_selector('.wp--row', count: 1)
- expect(page).to have_no_selector('.wp-inline-create-row')
+ expect(page).not_to have_selector('.wp-inline-create-row')
wp_table.expect_toast(
message: 'Successful creation. Click here to open this work package in fullscreen view.'
@@ -97,7 +97,7 @@ describe 'Parallel work package creation spec', js: true do
)
wp_table.dismiss_toaster!
expect(page).to have_selector('.wp--row', count: 2)
- expect(page).to have_no_selector('.wp-inline-create-row')
+ expect(page).not_to have_selector('.wp-inline-create-row')
# Get the last work package
wp2 = WorkPackage.last
diff --git a/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb b/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
index 339801bea2f..9a3a97429ec 100644
--- a/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
+++ b/spec/features/work_packages/table/queries/query_menu_refresh_spec.rb
@@ -51,7 +51,7 @@ describe 'Refreshing query menu item', js: true do
# Publish query
wp_table.click_setting_item I18n.t('js.toolbar.settings.visibility_settings')
- find('#show-in-menu').set true
+ find_by_id('show-in-menu').set true
find('.button', text: 'Save').click
last_query = Query.last
diff --git a/spec/features/work_packages/table/queries/query_menu_spec.rb b/spec/features/work_packages/table/queries/query_menu_spec.rb
index 875319401b7..36684677375 100644
--- a/spec/features/work_packages/table/queries/query_menu_spec.rb
+++ b/spec/features/work_packages/table/queries/query_menu_spec.rb
@@ -95,8 +95,8 @@ describe 'Query menu item', js: true do
wp_table.click_setting_item 'Save as'
fill_in 'save-query-name', with: 'Some query name'
- find('#show-in-menu').set true
- find('#show-public').set true
+ find_by_id('show-in-menu').set true
+ find_by_id('show-public').set true
find('.button', text: 'Save').click
@@ -140,7 +140,7 @@ describe 'Query menu item', js: true do
# Publish query
wp_table.click_setting_item I18n.t('js.label_visibility_settings')
- find('#show-in-menu').set true
+ find_by_id('show-in-menu').set true
find('.button', text: 'Save').click
wp_table.visit!
diff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rb
index 64832767d8b..a1aefa5fda6 100644
--- a/spec/features/work_packages/table/relations_spec.rb
+++ b/spec/features/work_packages/table/relations_spec.rb
@@ -68,8 +68,8 @@ describe 'Work Package table relations', js: true do
expect(wp_from_row).to have_selector(".#{type_column_follows} .wp-table--relation-count", text: '2')
# Expect count for wp_to in both columns to be not rendered
- expect(wp_from_to).to have_no_selector(".#{type_column_id} .wp-table--relation-count")
- expect(wp_from_to).to have_no_selector(".#{type_column_follows} .wp-table--relation-count")
+ expect(wp_from_to).not_to have_selector(".#{type_column_id} .wp-table--relation-count")
+ expect(wp_from_to).not_to have_selector(".#{type_column_follows} .wp-table--relation-count")
# Expand first column
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
@@ -79,7 +79,7 @@ describe 'Work Package table relations', js: true do
# Collapse
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
- expect(page).to have_no_selector(".__relations-expanded-from-#{wp_from.id}")
+ expect(page).not_to have_selector(".__relations-expanded-from-#{wp_from.id}")
# Expand second column
wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
@@ -100,7 +100,7 @@ describe 'Work Package table relations', js: true do
# Collapse
wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
- expect(page).to have_no_selector(".__relations-expanded-from-#{wp_from.id}")
+ expect(page).not_to have_selector(".__relations-expanded-from-#{wp_from.id}")
wp_timeline.expect_row_count(3)
end
diff --git a/spec/features/work_packages/table/switch_types_spec.rb b/spec/features/work_packages/table/switch_types_spec.rb
index 7758d916bfb..fdc7c1b3379 100644
--- a/spec/features/work_packages/table/switch_types_spec.rb
+++ b/spec/features/work_packages/table/switch_types_spec.rb
@@ -122,7 +122,7 @@ describe 'Switching types in work package table', js: true do
message: 'Successful update. Click here to open this work package in fullscreen view.'
)
- expect(page).to have_no_selector "#{req_text_field.selector} #{req_text_field.display_selector}"
+ expect(page).not_to have_selector "#{req_text_field.selector} #{req_text_field.display_selector}"
expect { req_text_field.display_element }.to raise_error(Capybara::ElementNotFound)
end
diff --git a/spec/features/work_packages/tabs/watcher_tab_spec.rb b/spec/features/work_packages/tabs/watcher_tab_spec.rb
index 71486f7b70f..90c910d2708 100644
--- a/spec/features/work_packages/tabs/watcher_tab_spec.rb
+++ b/spec/features/work_packages/tabs/watcher_tab_spec.rb
@@ -15,7 +15,7 @@ describe 'Watcher tab', js: true, selenium: true do
add_work_package_watchers)
end
- let(:watch_button) { find '#watch-button' }
+ let(:watch_button) { find_by_id 'watch-button' }
let(:watchers_tab) { find('.op-tab-row--link_selected', text: 'WATCHERS') }
def expect_button_is_watching
@@ -34,7 +34,7 @@ describe 'Watcher tab', js: true, selenium: true do
it 'watching the WP modifies the watcher list' do
# Expect WP watch button is in not-watched state
expect_button_is_not_watching
- expect(page).to have_no_selector('[data-qa-selector="op-wp-watcher-name"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-wp-watcher-name"]')
watch_button.click
# Expect WP watch button causes watcher list to add user
@@ -44,7 +44,7 @@ describe 'Watcher tab', js: true, selenium: true do
# Expect WP unwatch button causes watcher list to remove user
watch_button.click
expect_button_is_not_watching
- expect(page).to have_no_selector('[data-qa-selector="op-wp-watcher-name"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-wp-watcher-name"]')
end
end
@@ -79,7 +79,7 @@ describe 'Watcher tab', js: true, selenium: true do
tabs.expect_no_counter(watchers_tab)
# Expect the removal of the user to toggle WP watch button
- expect(page).to have_no_selector('[data-qa-selector="op-wp-watcher-name"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-wp-watcher-name"]')
expect_button_is_not_watching
end
@@ -98,7 +98,7 @@ describe 'Watcher tab', js: true, selenium: true do
results_selector: 'body'
expect(target_dropdown).to have_selector(".ng-option", text: html_user.firstname)
- expect(target_dropdown).to have_no_selector(".ng-option em")
+ expect(target_dropdown).not_to have_selector(".ng-option em")
end
end
@@ -158,7 +158,7 @@ describe 'Watcher tab', js: true, selenium: true do
results_selector: 'body'
expect(target_dropdown).to have_selector(".ng-option", text: user.name)
- expect(target_dropdown).to have_no_selector(".ng-option", text: placeholder.name)
+ expect(target_dropdown).not_to have_selector(".ng-option", text: placeholder.name)
end
end
end
diff --git a/spec/features/work_packages/timeline/timeline_dates_spec.rb b/spec/features/work_packages/timeline/timeline_dates_spec.rb
index e7915f23001..44c62f5c03f 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
RSpec.describe 'Work package timeline date formatting',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true,
- selenium: true do
+ js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:type) { create(:type_bug, color: create(:color_green)) }
shared_let(:project) { create(:project, types: [type]) }
shared_let(:start_date) { Date.parse('2020-12-31') }
@@ -137,10 +135,10 @@ RSpec.describe 'Work package timeline date formatting',
expect(page).to have_selector('[data-qa-selector="wp-timeline--non-working-day_2-1-2021"]')
expect(page).to have_selector('[data-qa-selector="wp-timeline--non-working-day_28-12-2020"]')
- expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_29-12-2020"]')
- expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_30-12-2020"]')
- expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_31-12-2020"]')
- expect(page).to have_no_selector('[data-qa-selector="wp-timeline--non-working-day_1-1-2021"]')
+ expect(page).not_to have_selector('[data-qa-selector="wp-timeline--non-working-day_29-12-2020"]')
+ expect(page).not_to have_selector('[data-qa-selector="wp-timeline--non-working-day_30-12-2020"]')
+ expect(page).not_to have_selector('[data-qa-selector="wp-timeline--non-working-day_31-12-2020"]')
+ expect(page).not_to have_selector('[data-qa-selector="wp-timeline--non-working-day_1-1-2021"]')
end
end
end
diff --git a/spec/features/work_packages/timeline/timeline_labels_spec.rb b/spec/features/work_packages/timeline/timeline_labels_spec.rb
index c1ebf4e89b6..277b1278257 100644
--- a/spec/features/work_packages/timeline/timeline_labels_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_labels_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
RSpec.describe 'Work package timeline labels',
- with_settings: { date_format: '%Y-%m-%d' },
- js: true,
- selenium: true do
+ js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
let(:user) { create(:admin) }
let(:today) { Time.zone.today }
let(:tomorrow) { Time.zone.tomorrow }
diff --git a/spec/features/work_packages/work_packages_page.rb b/spec/features/work_packages/work_packages_page.rb
index e322c3c46df..88a6d4572fa 100644
--- a/spec/features/work_packages/work_packages_page.rb
+++ b/spec/features/work_packages/work_packages_page.rb
@@ -83,9 +83,9 @@ class WorkPackagesPage
def find_subject_field(text = nil)
if text
- find('#inplace-edit--write-value--subject', text:)
+ find_by_id('inplace-edit--write-value--subject', text:)
else
- find('#inplace-edit--write-value--subject')
+ find_by_id('inplace-edit--write-value--subject')
end
end
diff --git a/spec/features/work_packages/zen_mode_spec.rb b/spec/features/work_packages/zen_mode_spec.rb
index 560f6847deb..f9fd0f3fb85 100644
--- a/spec/features/work_packages/zen_mode_spec.rb
+++ b/spec/features/work_packages/zen_mode_spec.rb
@@ -37,11 +37,11 @@ describe 'Zen mode', js: true do
it 'hides menus' do
wp_page.expect_no_zen_mode
- wp_page.page.find('#work-packages-zen-mode-toggle-button').click
+ wp_page.page.find_by_id('work-packages-zen-mode-toggle-button').click
wp_page.expect_zen_mode
wp_page.go_back
wp_page.expect_zen_mode
- wp_page.page.find('#work-packages-zen-mode-toggle-button').click
+ wp_page.page.find_by_id('work-packages-zen-mode-toggle-button').click
wp_page.expect_no_zen_mode
end
end
diff --git a/spec/features/wysiwyg/html_encoding_spec.rb b/spec/features/wysiwyg/html_encoding_spec.rb
index 7c7c21e0d04..d81acbbcb74 100644
--- a/spec/features/wysiwyg/html_encoding_spec.rb
+++ b/spec/features/wysiwyg/html_encoding_spec.rb
@@ -45,8 +45,8 @@ describe 'Wysiwyg escaping HTML entities (Regression #28906)',
:enter,
'\<u>foo\</u>'
- expect(editable).to have_no_selector('node')
- expect(editable).to have_no_selector('u')
+ expect(editable).not_to have_selector('node')
+ expect(editable).not_to have_selector('u')
end
# Save wiki page
@@ -56,8 +56,8 @@ describe 'Wysiwyg escaping HTML entities (Regression #28906)',
within('#content') do
expect(page).to have_selector('p', text: '<node foo="bar" />')
- expect(page).to have_no_selector('u')
- expect(page).to have_no_selector('node')
+ expect(page).not_to have_selector('u')
+ expect(page).not_to have_selector('node')
end
text = WikiContent.last.text
diff --git a/spec/features/wysiwyg/macros/work_package_button_spec.rb b/spec/features/wysiwyg/macros/work_package_button_spec.rb
index 978dff5523e..42f9dbcb637 100644
--- a/spec/features/wysiwyg/macros/work_package_button_spec.rb
+++ b/spec/features/wysiwyg/macros/work_package_button_spec.rb
@@ -63,7 +63,7 @@ describe 'Wysiwyg work package button spec',
# Cancel editing
find('.spot-modal--cancel-button').click
- expect(editable).to have_no_selector('.macro.-create_work_package_link')
+ expect(editable).not_to have_selector('.macro.-create_work_package_link')
editor.insert_macro 'Insert create work package button'
select 'MyTaskName', from: 'selected-type'
diff --git a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
index 85294469ac8..d53b4daf290 100644
--- a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
+++ b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
@@ -61,7 +61,7 @@ describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)',
it 'shows the list correctly' do
editor.in_editor do |_container, editable|
expect(editable).to have_selector('ol li', count: 3)
- expect(editable).to have_no_selector('ol li p')
+ expect(editable).not_to have_selector('ol li p')
end
end
end
diff --git a/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb b/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb
index e35c650f2c4..bb07c3e10c6 100644
--- a/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb
+++ b/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb
@@ -159,21 +159,21 @@ describe API::V3::Projects::ProjectSqlRepresenter, 'rendering' do
it 'renders correctly' do
expect(json)
.to be_json_eql(
- {
- _links: {
- ancestors: [
- {
- href: "/foobar/api/v3/projects/#{grandparent.id}",
- title: grandparent.name
- },
- {
- href: API::V3::URN_UNDISCLOSED,
- title: I18n.t(:'api_v3.undisclosed.ancestor')
- }
- ]
+ {
+ _links: {
+ ancestors: [
+ {
+ href: "/foobar/api/v3/projects/#{grandparent.id}",
+ title: grandparent.name
+ },
+ {
+ href: API::V3::URN_UNDISCLOSED,
+ title: I18n.t(:'api_v3.undisclosed.ancestor')
}
- }.to_json
- )
+ ]
+ }
+ }.to_json
+ )
end
end
diff --git a/spec/lib/i18n/pluralization_spec.rb b/spec/lib/i18n/pluralization_spec.rb
index 2d66a853f00..40d4465f83f 100644
--- a/spec/lib/i18n/pluralization_spec.rb
+++ b/spec/lib/i18n/pluralization_spec.rb
@@ -39,7 +39,7 @@ describe I18n, 'pluralization', type: :helper do
allow(I18n.backend)
.to(receive(:lookup))
.with(:sl, :label_x_projects, any_args)
- .and_return({ one: "1 projekt", other: "%{count} projektov", zero: "Brez projektov" })
+ .and_return({ one: "1 projekt", other: "%<count>s projektov", zero: "Brez projektov" })
end
it 'allows to pluralize without exceptions (Regression #37607)', :aggregate_failures do
diff --git a/spec/lib/open_project/configuration_spec.rb b/spec/lib/open_project/configuration_spec.rb
index ede87db2cff..6b418c8b306 100644
--- a/spec/lib/open_project/configuration_spec.rb
+++ b/spec/lib/open_project/configuration_spec.rb
@@ -59,7 +59,6 @@ describe OpenProject::Configuration, :settings_reset do
subject { described_class.cache_store_configuration }
context 'without cache store already set' do
-
context 'with additional cache store configuration', with_config: { 'rails_cache_store' => 'bar' } do
it 'changes the cache store' do
expect(subject).to eq([:bar])
diff --git a/spec/lib/open_project/content_type_detector_spec.rb b/spec/lib/open_project/content_type_detector_spec.rb
index 46100cfec84..ff3377cfd41 100644
--- a/spec/lib/open_project/content_type_detector_spec.rb
+++ b/spec/lib/open_project/content_type_detector_spec.rb
@@ -58,12 +58,12 @@ require 'spec_helper'
describe OpenProject::ContentTypeDetector do
it 'gives a sensible default when the name is empty' do
- assert_equal 'application/binary', OpenProject::ContentTypeDetector.new('').detect
+ expect(OpenProject::ContentTypeDetector.new('').detect).to eq('application/binary')
end
it 'returns the empty content type when the file is empty' do
tempfile = Tempfile.new('empty')
- assert_equal 'inode/x-empty', OpenProject::ContentTypeDetector.new(tempfile.path).detect
+ expect(OpenProject::ContentTypeDetector.new(tempfile.path).detect).to eq('inode/x-empty')
tempfile.close
end
@@ -72,7 +72,7 @@ describe OpenProject::ContentTypeDetector do
MIME::Type.new('audio/mp4')])
allow(Open3).to receive(:capture2).and_return(['video/mp4', 0])
@filename = 'my_file.mp4'
- assert_equal 'video/mp4', OpenProject::ContentTypeDetector.new(@filename).detect
+ expect(OpenProject::ContentTypeDetector.new(@filename).detect).to eq('video/mp4')
end
it 'returns the default when exitcode > 0' do
@@ -80,7 +80,7 @@ describe OpenProject::ContentTypeDetector do
MIME::Type.new('audio/mp4')])
allow(Open3).to receive(:capture2).and_return(['', 1])
@filename = 'my_file.mp4'
- assert_equal 'application/binary', OpenProject::ContentTypeDetector.new(@filename).detect
+ expect(OpenProject::ContentTypeDetector.new(@filename).detect).to eq('application/binary')
end
it 'finds the right type in the list via the file command' do
@@ -88,19 +88,19 @@ describe OpenProject::ContentTypeDetector do
File.open(@filename, 'w+') do |file|
file.puts 'This is a text file.'
file.rewind
- assert_equal 'text/plain', OpenProject::ContentTypeDetector.new(file.path).detect
+ expect(OpenProject::ContentTypeDetector.new(file.path).detect).to eq('text/plain')
end
FileUtils.rm @filename
end
it 'returns a sensible default if something is wrong, like the file is gone' do
@filename = '/path/to/nothing'
- assert_equal 'application/binary', OpenProject::ContentTypeDetector.new(@filename).detect
+ expect(OpenProject::ContentTypeDetector.new(@filename).detect).to eq('application/binary')
end
it 'returns a sensible default when the file command is missing' do
allow(Open3).to receive(:capture2).and_raise 'o noes!'
@filename = '/path/to/something'
- assert_equal 'application/binary', OpenProject::ContentTypeDetector.new(@filename).detect
+ expect(OpenProject::ContentTypeDetector.new(@filename).detect).to eq('application/binary')
end
end
diff --git a/spec/lib/open_project/file_command_content_type_detector_spec.rb b/spec/lib/open_project/file_command_content_type_detector_spec.rb
index 12ba1f8303c..65f5e887a8a 100644
--- a/spec/lib/open_project/file_command_content_type_detector_spec.rb
+++ b/spec/lib/open_project/file_command_content_type_detector_spec.rb
@@ -62,7 +62,7 @@ describe OpenProject::FileCommandContentTypeDetector do
tempfile.write('This is a file.')
tempfile.rewind
- assert_equal 'text/plain', OpenProject::FileCommandContentTypeDetector.new(tempfile.path).detect
+ expect(OpenProject::FileCommandContentTypeDetector.new(tempfile.path).detect).to eq('text/plain')
tempfile.close
end
@@ -70,13 +70,11 @@ describe OpenProject::FileCommandContentTypeDetector do
it 'returns a sensible default when the file command is missing' do
allow(Open3).to receive(:capture2).and_raise 'o noes!'
@filename = '/path/to/something'
- assert_equal 'application/binary',
- OpenProject::FileCommandContentTypeDetector.new(@filename).detect
+ expect(OpenProject::FileCommandContentTypeDetector.new(@filename).detect).to eq('application/binary')
end
it 'returns a sensible default on the odd chance that run returns nil' do
allow(Open3).to receive(:capture2).and_return [nil, 0]
- assert_equal 'application/binary',
- OpenProject::FileCommandContentTypeDetector.new('windows').detect
+ expect(OpenProject::FileCommandContentTypeDetector.new('windows').detect).to eq('application/binary')
end
end
diff --git a/spec/lib/open_project/hook_spec.rb b/spec/lib/open_project/hook_spec.rb
index bd517be2aa4..e8673efafe5 100644
--- a/spec/lib/open_project/hook_spec.rb
+++ b/spec/lib/open_project/hook_spec.rb
@@ -263,7 +263,7 @@ describe OpenProject::Hook do
WorkPackageMailer.watcher_changed(work_package, user, author, :added).deliver_now
mail2 = ActionMailer::Base.deliveries.last
- assert_equal comparison_mail.text_part.body.encoded, mail2.text_part.body.encoded
+ expect(comparison_mail.text_part.body.encoded).to eq(mail2.text_part.body.encoded)
end
end
end
diff --git a/spec/lib/open_project/scm/adapters/git_adapter_spec.rb b/spec/lib/open_project/scm/adapters/git_adapter_spec.rb
index 1acd2044ead..ea7a8ed173a 100644
--- a/spec/lib/open_project/scm/adapters/git_adapter_spec.rb
+++ b/spec/lib/open_project/scm/adapters/git_adapter_spec.rb
@@ -430,7 +430,7 @@ describe OpenProject::SCM::Adapters::Git do
describe '.annotate' do
it 'annotates a regular file' do
annotate = adapter.annotate('sources/watchers_controller.rb')
- expect(annotate).to be_kind_of(OpenProject::SCM::Adapters::Annotate)
+ expect(annotate).to be_a(OpenProject::SCM::Adapters::Annotate)
expect(annotate.lines.length).to eq(41)
expect(annotate.lines[4].strip).to eq('# This program is free software; ' \
'you can redistribute it and/or')
diff --git a/spec/lib/open_project/storage_spec.rb b/spec/lib/open_project/storage_spec.rb
index c250364c2cc..cd19ad20554 100644
--- a/spec/lib/open_project/storage_spec.rb
+++ b/spec/lib/open_project/storage_spec.rb
@@ -67,7 +67,7 @@ describe OpenProject::Storage do
entry = subject.values.first
expect(entry[:labels]).to eq(['this is foobar'])
expect(entry[:data]).not_to be_nil
- expect(entry[:data][:free]).to be_kind_of(Integer)
+ expect(entry[:data][:free]).to be_a(Integer)
end
end
end
diff --git a/spec/lib/open_project/text_formatting/plain_spec.rb b/spec/lib/open_project/text_formatting/plain_spec.rb
index 26571e6f636..b959d6d1164 100644
--- a/spec/lib/open_project/text_formatting/plain_spec.rb
+++ b/spec/lib/open_project/text_formatting/plain_spec.rb
@@ -45,8 +45,8 @@ describe OpenProject::TextFormatting::Formats::Plain::Formatter do
def assert_html_output(to_test, expect_paragraph = true)
to_test.each do |text, expected|
- assert_equal((expect_paragraph ? "<p>#{expected}</p>" : expected), subject.to_html(text),
- "Formatting the following text failed:\n===\n#{text}\n===\n")
+ expect((expect_paragraph ? "<p>#{expected}</p>" : expected)).to(eq(subject.to_html(text)),
+ "Formatting the following text failed:\n===\n#{text}\n===\n")
end
end
diff --git a/spec/lib/open_project/text_formatting/text_formatting_spec.rb b/spec/lib/open_project/text_formatting/text_formatting_spec.rb
index d4dbec30b74..b3f25efdae1 100644
--- a/spec/lib/open_project/text_formatting/text_formatting_spec.rb
+++ b/spec/lib/open_project/text_formatting/text_formatting_spec.rb
@@ -51,8 +51,10 @@ describe OpenProject::TextFormatting do
and an email address <a href="mailto:[email protected]">[email protected]</a></p>
EXPECTED
- assert_equal expected.gsub(%r{[\r\n\t]}, ''),
- OpenProject::TextFormatting::Formats::Plain::Formatter.new({}).to_html(raw).gsub(%r{[\r\n\t]}, '')
+ expect(expected.gsub(%r{[\r\n\t]},
+ '')).to eq(OpenProject::TextFormatting::Formats::Plain::Formatter.new({}).to_html(raw).gsub(
+ %r{[\r\n\t]}, ''
+ ))
end
describe 'options' do
diff --git a/spec/models/changeset_spec.rb b/spec/models/changeset_spec.rb
index dffe448c3f7..c44d2a485c0 100644
--- a/spec/models/changeset_spec.rb
+++ b/spec/models/changeset_spec.rb
@@ -64,7 +64,7 @@ describe Changeset do
expect(changeset.comments).to eq ''
if changeset.comments.respond_to?(:force_encoding)
- assert_equal 'UTF-8', changeset.comments.encoding.to_s
+ expect(changeset.comments.encoding.to_s).to eq('UTF-8')
end
end
@@ -74,7 +74,7 @@ describe Changeset do
expect(changeset.comments).to eq ''
if changeset.comments.respond_to?(:force_encoding)
- assert_equal 'UTF-8', changeset.comments.encoding.to_s
+ expect(changeset.comments.encoding.to_s).to eq('UTF-8')
end
end
end
@@ -237,9 +237,9 @@ describe Changeset do
expect(c.work_package_ids).to eq [work_package.id]
time = TimeEntry.order(Arel.sql('id DESC')).first
- assert_equal work_package.id, time.work_package_id
- assert_equal work_package.project_id, time.project_id
- assert_equal user.id, time.user_id
+ expect(work_package.id).to eq(time.work_package_id)
+ expect(work_package.project_id).to eq(time.project_id)
+ expect(user.id).to eq(time.user_id)
expect(time.hours).to eq expected_hours
expect(time.spent_on).to eq Date.yesterday
diff --git a/spec/models/custom_value_spec.rb b/spec/models/custom_value_spec.rb
index d6f3f0b3f35..2a3ac60e5d2 100644
--- a/spec/models/custom_value_spec.rb
+++ b/spec/models/custom_value_spec.rb
@@ -103,7 +103,7 @@ describe CustomValue do
it 'returns an empty placeholder' do
expect(subject.custom_field).to be_nil
- expect(subject.send(:strategy)).to be_kind_of CustomValue::EmptyStrategy
+ expect(subject.send(:strategy)).to be_a CustomValue::EmptyStrategy
expect(subject.typed_value).to eq 'my value not found'
expect(subject.formatted_value).to eq 'my value not found'
end
diff --git a/spec/models/ldap_auth_source_spec.rb b/spec/models/ldap_auth_source_spec.rb
index 4d944cc766a..eb96d0af3d1 100644
--- a/spec/models/ldap_auth_source_spec.rb
+++ b/spec/models/ldap_auth_source_spec.rb
@@ -31,14 +31,14 @@ require 'spec_helper'
describe LdapAuthSource do
it 'creates' do
a = described_class.new(name: 'My LDAP', host: 'ldap.example.net', port: 389, base_dn: 'dc=example,dc=net',
- attr_login: 'sAMAccountName')
+ attr_login: 'sAMAccountName')
expect(a.save).to be true
end
it 'strips ldap attributes' do
a = described_class.new(name: 'My LDAP', host: 'ldap.example.net', port: 389,
base_dn: 'dc=example,dc=net', attr_login: 'sAMAccountName',
- attr_firstname: 'givenName ')
+ attr_firstname: 'givenName ')
expect(a.save).to be true
expect(a.reload.attr_firstname).to eq 'givenName'
end
@@ -253,13 +253,13 @@ describe LdapAuthSource do
it 'maps for the admin user in ldap', :aggregate_failures do
admin_attributes = ldap.find_user('ldap_admin')
- expect(admin_attributes).to be_kind_of Hash
+ expect(admin_attributes).to be_a Hash
expect(admin_attributes[:firstname]).to eq 'LDAP'
expect(admin_attributes[:lastname]).to eq 'Adminuser'
expect(admin_attributes[:admin]).to eq true
admin_attributes = ldap.find_user('bb459')
- expect(admin_attributes).to be_kind_of Hash
+ expect(admin_attributes).to be_a Hash
expect(admin_attributes[:firstname]).to eq 'Belle'
expect(admin_attributes[:lastname]).to eq 'Baldwin'
expect(admin_attributes[:admin]).to eq false
@@ -271,7 +271,7 @@ describe LdapAuthSource do
context 'with a valid LDAP user' do
it 'returns the user attributes' do
attributes = ldap.authenticate('bb459', 'niwdlab')
- expect(attributes).to be_kind_of Hash
+ expect(attributes).to be_a Hash
expect(attributes[:firstname]).to eq 'Belle'
expect(attributes[:lastname]).to eq 'Baldwin'
expect(attributes[:mail]).to eq '[email protected]'
diff --git a/spec/models/queries/days/day_query_spec.rb b/spec/models/queries/days/day_query_spec.rb
index 294c98519d0..b5e19a5df74 100644
--- a/spec/models/queries/days/day_query_spec.rb
+++ b/spec/models/queries/days/day_query_spec.rb
@@ -67,8 +67,8 @@ describe Queries::Days::DayQuery do
it 'is the same as handwriting the query' do
# Expectation has to be weirdly specific to the logic of Queries::Operators::DateRangeClauses
expected_scope = base_scope.where("days.date > ? AND days.date <= ?",
- (from - 1.day).end_of_day,
- to.end_of_day)
+ (from - 1.day).end_of_day,
+ to.end_of_day)
unless working.nil?
expected_scope = expected_scope.where("days.working IN ('#{working}')")
diff --git a/spec/models/repository/subversion_spec.rb b/spec/models/repository/subversion_spec.rb
index c8554d85319..d0e893f00d2 100644
--- a/spec/models/repository/subversion_spec.rb
+++ b/spec/models/repository/subversion_spec.rb
@@ -191,8 +191,8 @@ describe Repository::Subversion do
# with limit
changesets = instance.latest_changesets('', nil, 2)
- assert_equal 2, changesets.size
- assert_equal instance.latest_changesets('', nil).to_a.slice(0, 2), changesets
+ expect(changesets.size).to eq(2)
+ expect(instance.latest_changesets('', nil).to_a.slice(0, 2)).to eq(changesets)
# with path
changesets = instance.latest_changesets('subversion_test/folder', nil)
@@ -272,7 +272,7 @@ describe Repository::Subversion do
if s1.respond_to?(:force_encoding)
s1.force_encoding('ISO-8859-1')
s2.force_encoding('UTF-8')
- assert_equal s1.encode('UTF-8'), s2
+ expect(s1.encode('UTF-8')).to eq(s2)
end
c = Changeset.new(repository: instance,
comments: s2,
diff --git a/spec/models/token/base_token_spec.rb b/spec/models/token/base_token_spec.rb
index 4ab08537f82..8bb4882fe46 100644
--- a/spec/models/token/base_token_spec.rb
+++ b/spec/models/token/base_token_spec.rb
@@ -35,7 +35,7 @@ describe Token::Base do
it 'creates' do
subject.save!
- assert_equal 64, subject.value.length
+ expect(subject.value.length).to eq(64)
end
it 'create_should_remove_existing_tokenses' do
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 733943e085a..a8ea76c7918 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -429,7 +429,7 @@ describe User do
it {
expect(user.errors[:password]).to include I18n.t('activerecord.errors.messages.too_short',
- count: Setting.password_min_length.to_i)
+ count: Setting.password_min_length.to_i)
}
end
diff --git a/spec/models/work_package/aggregate_ancestors_spec.rb b/spec/models/work_package/aggregate_ancestors_spec.rb
index 57b87922a17..85b70087336 100644
--- a/spec/models/work_package/aggregate_ancestors_spec.rb
+++ b/spec/models/work_package/aggregate_ancestors_spec.rb
@@ -97,7 +97,7 @@ describe WorkPackage::Ancestors do
let(:ids) { leaf_ids }
it 'returns ancestors for the leaf in project 1' do
- expect(subject).to be_kind_of(Hash)
+ expect(subject).to be_a(Hash)
expect(subject.keys.length).to eq(2)
expect(subject[leaf.id]).to eq([root_work_package, intermediate])
@@ -109,7 +109,7 @@ describe WorkPackage::Ancestors do
let(:ids) { intermediate_ids }
it 'returns all ancestors in project 1' do
- expect(subject).to be_kind_of(Hash)
+ expect(subject).to be_a(Hash)
expect(subject.keys.length).to eq(2)
expect(subject[intermediate.id]).to eq([root_work_package])
@@ -129,7 +129,7 @@ describe WorkPackage::Ancestors do
let(:ids) { leaf_ids }
it 'returns all ancestors' do
- expect(subject).to be_kind_of(Hash)
+ expect(subject).to be_a(Hash)
expect(subject.keys.length).to eq(2)
expect(subject[leaf.id]).to eq([root_work_package, intermediate])
@@ -151,7 +151,7 @@ describe WorkPackage::Ancestors do
let(:ids) { leaf_ids }
it 'returns no results for all ids' do
- expect(subject).to be_kind_of(Hash)
+ expect(subject).to be_a(Hash)
expect(subject.keys.length).to eq(0)
end
end
diff --git a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb
index 52a71fa813c..d4e1562b9ee 100644
--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb
+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb
@@ -186,7 +186,7 @@ shared_examples 'it supports direct uploads' do
end
end
-shared_examples 'an APIv3 attachment resource', type: :request, content_type: :json do |include_by_container = true|
+shared_examples 'an APIv3 attachment resource', content_type: :json, type: :request do |include_by_container = true|
include Rack::Test::Methods
include API::V3::Utilities::PathHelper
include FileHelpers
diff --git a/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb
index 7a21cb575d5..bb9e49890ad 100644
--- a/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb
+++ b/spec/requests/api/v3/projects/copy/copy_form_resource_spec.rb
@@ -55,8 +55,7 @@ describe API::V3::Projects::Copy::CreateFormAPI, content_type: :json do
let(:path) { api_v3_paths.project_copy_form(source_project.id) }
let(:params) do
- {
- }
+ {}
end
before do
diff --git a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb
index 0f8d5a9f862..3b1311de384 100644
--- a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb
+++ b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb
@@ -59,8 +59,7 @@ describe API::V3::Projects::Copy::CopyAPI, content_type: :json do
let(:path) { api_v3_paths.project_copy(source_project.id) }
let(:params) do
- {
- }
+ {}
end
before do
diff --git a/spec/requests/api/v3/projects/create_form_resource_spec.rb b/spec/requests/api/v3/projects/create_form_resource_spec.rb
index c9e473eaffa..4c7f67a23b9 100644
--- a/spec/requests/api/v3/projects/create_form_resource_spec.rb
+++ b/spec/requests/api/v3/projects/create_form_resource_spec.rb
@@ -54,8 +54,7 @@ describe API::V3::Projects::CreateFormAPI, content_type: :json do
let(:permissions) { [:add_project] }
let(:path) { api_v3_paths.create_project_form }
let(:params) do
- {
- }
+ {}
end
before do
diff --git a/spec/requests/api/v3/projects/update_form_resource_spec.rb b/spec/requests/api/v3/projects/update_form_resource_spec.rb
index be960d7899f..565d459de9b 100644
--- a/spec/requests/api/v3/projects/update_form_resource_spec.rb
+++ b/spec/requests/api/v3/projects/update_form_resource_spec.rb
@@ -63,8 +63,7 @@ describe API::V3::Projects::UpdateFormAPI, content_type: :json do
let(:parent_project_permissions) { [:add_subprojects] }
let(:path) { api_v3_paths.project_form(project.id) }
let(:params) do
- {
- }
+ {}
end
before do
diff --git a/spec/requests/api/v3/queries/create_form_api_spec.rb b/spec/requests/api/v3/queries/create_form_api_spec.rb
index 01fc067a6c4..ebf8be19c19 100644
--- a/spec/requests/api/v3/queries/create_form_api_spec.rb
+++ b/spec/requests/api/v3/queries/create_form_api_spec.rb
@@ -32,13 +32,9 @@ describe "POST /api/v3/queries/form" do
include API::V3::Utilities::PathHelper
let(:path) { api_v3_paths.create_query_form }
- shared_let(:user) { create(:admin) }
- shared_let(:project) { create(:project_with_types) }
-
let(:parameters) { {} }
let(:override_params) { {} }
let(:form) { JSON.parse last_response.body }
-
let(:static_columns_json) do
%w(id project assignee author
category createdAt dueDate estimatedTime
@@ -51,7 +47,6 @@ describe "POST /api/v3/queries/form" do
}
end
end
-
let(:custom_field_columns_json) do
[
{
@@ -60,7 +55,6 @@ describe "POST /api/v3/queries/form" do
}
]
end
-
let(:relation_to_type_columns_json) do
project.types.map do |type|
{
@@ -69,7 +63,6 @@ describe "POST /api/v3/queries/form" do
}
end
end
-
let(:relation_of_type_columns_json) do
Relation::TYPES.map do |_, value|
{
@@ -78,7 +71,6 @@ describe "POST /api/v3/queries/form" do
}
end
end
-
let(:non_project_type_relation_column_json) do
[
{
@@ -87,7 +79,6 @@ describe "POST /api/v3/queries/form" do
}
]
end
-
let(:additional_setup) {}
let(:perform_request) do
->(*) {
@@ -95,6 +86,9 @@ describe "POST /api/v3/queries/form" do
}
end
+ shared_let(:user) { create(:admin) }
+ shared_let(:project) { create(:project_with_types) }
+
before do
login_as(user)
diff --git a/spec/requests/api/v3/types/types_by_project_resource_spec.rb b/spec/requests/api/v3/types/types_by_project_resource_spec.rb
index 7d99fe0ebce..bb6183605cb 100644
--- a/spec/requests/api/v3/types/types_by_project_resource_spec.rb
+++ b/spec/requests/api/v3/types/types_by_project_resource_spec.rb
@@ -73,7 +73,7 @@ describe '/api/v3/projects/:id/types' do
# N.B. this test depends on order, while this is not strictly necessary
it 'only contains expected types' do
- (0..3).each do |i|
+ 4.times do |i|
expected_id = expected_types[i].id.to_json
expect(subject.body).to be_json_eql(expected_id).at_path("_embedded/elements/#{i}/id")
end
diff --git a/spec/requests/api/v3/work_packages/available_relation_candidates_resource_spec.rb b/spec/requests/api/v3/work_packages/available_relation_candidates_resource_spec.rb
index 5bdd48b6539..30448e6c51d 100644
--- a/spec/requests/api/v3/work_packages/available_relation_candidates_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/available_relation_candidates_resource_spec.rb
@@ -33,7 +33,6 @@ describe API::V3::WorkPackages::AvailableRelationCandidatesAPI do
shared_let(:project1) { create(:project) }
- # rubocop:disable Naming/VariableNumber
shared_let(:wp1) { create(:work_package, project: project1, subject: "WP 1") }
shared_let(:wp1_1) do
@@ -57,8 +56,6 @@ describe API::V3::WorkPackages::AvailableRelationCandidatesAPI do
shared_let(:relation_wp2_1_to_wp2_2) do
create(:relation, from: wp2_1, to: wp2_2, relation_type: "relates")
end
- # rubocop:enable Naming/VariableNumber
-
let(:href) { "/api/v3/work_packages/#{wp1.id}/available_relation_candidates?query=WP" }
let(:request) { get href }
let(:result) do
@@ -145,7 +142,6 @@ describe API::V3::WorkPackages::AvailableRelationCandidatesAPI do
end
describe 'with an already existing relationship from the work package' do
- # rubocop:disable Naming/VariableNumber
shared_let(:relation_wp2_to_wp2_2) do
create(:relation, from: wp2, to: wp2_2, relation_type: "follows")
end
@@ -153,8 +149,6 @@ describe API::V3::WorkPackages::AvailableRelationCandidatesAPI do
shared_let(:relation_wp1_1_to_wp2) do
create(:relation, from: wp1_1, to: wp2, relation_type: "follows")
end
- # rubocop:enable Naming/VariableNumber
-
context 'for a follows relationship' do
it 'does not contain the work packages already related in the opposite direction nor the parent' do
expect(subjects).to match_array ["WP 1.2", "WP 1.2.1", "WP 2.1"]
diff --git a/spec/requests/api/v3/work_packages/index_resource_spec.rb b/spec/requests/api/v3/work_packages/index_resource_spec.rb
index 57beb039c4f..2dadc06b543 100644
--- a/spec/requests/api/v3/work_packages/index_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/index_resource_spec.rb
@@ -121,6 +121,7 @@ describe 'API v3 Work package resource',
context 'with the user not allowed to see work packages in general' do
let(:non_member_permissions) { [] }
+
before { get path }
it_behaves_like 'unauthorized access'
diff --git a/spec/requests/oauth_clients/callback_flow_spec.rb b/spec/requests/oauth_clients/callback_flow_spec.rb
index 60c3ce33edd..0f5aea183f2 100644
--- a/spec/requests/oauth_clients/callback_flow_spec.rb
+++ b/spec/requests/oauth_clients/callback_flow_spec.rb
@@ -67,7 +67,7 @@ describe 'OAuthClient callback endpoint' do
.to receive(:access_token!).with(:body)
.and_return(
Rack::OAuth2::AccessToken::Bearer.new(access_token: 'xyzaccesstoken',
- refresh_token: 'xyzrefreshtoken')
+ refresh_token: 'xyzrefreshtoken')
)
allow(rack_oauth2_client).to receive(:authorization_code=)
set_cookie "oauth_state_asdf1234=#{redirect_uri}"
diff --git a/spec/services/authorization/enterprise_service_spec.rb b/spec/services/authorization/enterprise_service_spec.rb
index 1f65d74bd76..98c2aad020a 100644
--- a/spec/services/authorization/enterprise_service_spec.rb
+++ b/spec/services/authorization/enterprise_service_spec.rb
@@ -58,7 +58,7 @@ describe Authorization::EnterpriseService do
let(:expired) { true }
it 'returns a false result' do
- expect(result).to be_kind_of ServiceResult
+ expect(result).to be_a ServiceResult
expect(result.result).to be_falsey
expect(result.success?).to be_falsey
end
@@ -83,7 +83,7 @@ describe Authorization::EnterpriseService do
let(:action) { guarded_action }
it 'returns a true result' do
- expect(result).to be_kind_of ServiceResult
+ expect(result).to be_a ServiceResult
expect(result.result).to be_truthy
expect(result.success?).to be_truthy
end
diff --git a/spec/services/base/base_callable_spec.rb b/spec/services/base/base_callable_spec.rb
index c77352cf1d6..61d37717f0e 100644
--- a/spec/services/base/base_callable_spec.rb
+++ b/spec/services/base/base_callable_spec.rb
@@ -55,16 +55,16 @@ describe BaseServices::BaseCallable, type: :model do
let(:result_state) { subject.state }
it 'is returned from the call', :aggregate_failures do
- expect(result_state).to be_kind_of(Shared::ServiceState)
+ expect(result_state).to be_a(Shared::ServiceState)
expect(result_state.test).to eq 'foo'
- expect(subject).to be_kind_of ServiceResult
+ expect(subject).to be_a ServiceResult
end
describe 'with state already passed into the service' do
let(:instance) { test_service.new.with_state(bar: 'some value') }
it 'keeps that value', :aggregate_failures do
- expect(result_state).to be_kind_of(Shared::ServiceState)
+ expect(result_state).to be_a(Shared::ServiceState)
expect(result_state.test).to eq 'foo'
expect(result_state.bar).to eq 'some value'
end
diff --git a/spec/services/ldap/synchronize_users_service_integration_spec.rb b/spec/services/ldap/synchronize_users_service_integration_spec.rb
index 4c6eb134e5e..675bd043512 100644
--- a/spec/services/ldap/synchronize_users_service_integration_spec.rb
+++ b/spec/services/ldap/synchronize_users_service_integration_spec.rb
@@ -25,7 +25,6 @@ describe Ldap::SynchronizeUsersService do
context 'when user sync status is enabled',
with_config: { ldap_users_sync_status: true } do
-
it 'updates the attributes of those users' do
subject
@@ -156,5 +155,4 @@ describe Ldap::SynchronizeUsersService do
end
end
end
-
end
diff --git a/spec/services/projects/copy_service_integration_spec.rb b/spec/services/projects/copy_service_integration_spec.rb
index 4855330662e..dfd74e53846 100644
--- a/spec/services/projects/copy_service_integration_spec.rb
+++ b/spec/services/projects/copy_service_integration_spec.rb
@@ -766,7 +766,7 @@ describe Projects::CopyService, 'integration', type: :model do
expect(subject).to be_success
cv = project_copy.custom_values.reload.where(custom_field: list_custom_field).to_a
- expect(cv).to be_kind_of Array
+ expect(cv).to be_a Array
expect(cv.count).to eq 2
expect(cv.map(&:formatted_value)).to contain_exactly('A', 'B')
end
diff --git a/spec/services/projects/set_attributes_service_spec.rb b/spec/services/projects/set_attributes_service_spec.rb
index 268899c8ab0..18b4dfce9b4 100644
--- a/spec/services/projects/set_attributes_service_spec.rb
+++ b/spec/services/projects/set_attributes_service_spec.rb
@@ -60,8 +60,7 @@ describe Projects::SetAttributesService, type: :model do
describe 'call' do
let(:call_attributes) do
- {
- }
+ {}
end
before do
diff --git a/spec/services/scm/repository_factory_service_spec.rb b/spec/services/scm/repository_factory_service_spec.rb
index 737c161ae8c..5d89172f2da 100644
--- a/spec/services/scm/repository_factory_service_spec.rb
+++ b/spec/services/scm/repository_factory_service_spec.rb
@@ -127,7 +127,7 @@ describe SCM::RepositoryFactoryService do
it 'allows to persist a repository without URL' do
expect(service.build_and_save).to be true
- expect(service.repository).to be_kind_of(Repository::Subversion)
+ expect(service.repository).to be_a(Repository::Subversion)
end
end
end
diff --git a/spec/support/components/admin/type_configuration_form.rb b/spec/support/components/admin/type_configuration_form.rb
index 53a5a3f770b..13da6970b98 100644
--- a/spec/support/components/admin/type_configuration_form.rb
+++ b/spec/support/components/admin/type_configuration_form.rb
@@ -50,7 +50,7 @@ module Components
end
def inactive_group
- page.find '#type-form-conf-inactive-group'
+ page.find_by_id 'type-form-conf-inactive-group'
end
def inactive_drop
@@ -58,7 +58,7 @@ module Components
end
def expect_empty
- expect(page).to have_no_selector('#draggable-groups .group-head')
+ expect(page).not_to have_selector('#draggable-groups .group-head')
end
def find_group(name)
@@ -206,7 +206,7 @@ module Components
container.find('.delete-group').click
- expect(page).to have_no_selector('.group-head', text: name.upcase)
+ expect(page).not_to have_selector('.group-head', text: name.upcase)
end
def expect_no_attribute(attribute, group)
diff --git a/spec/support/components/common/sidemenu.rb b/spec/support/components/common/sidemenu.rb
index 697d80a83a3..5a3b4e753f2 100644
--- a/spec/support/components/common/sidemenu.rb
+++ b/spec/support/components/common/sidemenu.rb
@@ -38,7 +38,7 @@ module Components
end
def expect_item_not_visible(item)
- expect(page).to have_no_selector(item_selector, text: item)
+ expect(page).not_to have_selector(item_selector, text: item)
end
def expect_item_with_count(item, count)
@@ -60,7 +60,7 @@ module Components
end
def finished_loading
- expect(page).to have_no_selector('[data-qa-selector="op-ian-center--loading-indicator"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-ian-center--loading-indicator"]')
end
private
@@ -70,7 +70,7 @@ module Components
end
def expect_no_count
- expect(page).to have_no_selector('.op-bubble')
+ expect(page).not_to have_selector('.op-bubble')
end
def item_action_selector(item)
diff --git a/spec/support/components/global_search.rb b/spec/support/components/global_search.rb
index 5b826d64c39..9a989cd2f52 100644
--- a/spec/support/components/global_search.rb
+++ b/spec/support/components/global_search.rb
@@ -76,7 +76,7 @@ module Components
def expect_no_work_package_option(wp)
expect(page)
- .to have_no_selector('.global-search--option', text: wp.subject.to_s)
+ .not_to have_selector('.global-search--option', text: wp.subject.to_s)
end
def click_work_package(wp)
diff --git a/spec/support/components/grids/grid_area.rb b/spec/support/components/grids/grid_area.rb
index eb0fd9725bb..bd0922502d0 100644
--- a/spec/support/components/grids/grid_area.rb
+++ b/spec/support/components/grids/grid_area.rb
@@ -89,7 +89,7 @@ module Components
def expect_not_resizable
within area do
expect(page)
- .to have_no_selector('.grid--area.-widgeted resizer')
+ .not_to have_selector('.grid--area.-widgeted resizer')
end
end
@@ -98,7 +98,7 @@ module Components
within area do
expect(page)
- .to have_no_selector(".grid--area-drag-handle")
+ .not_to have_selector(".grid--area-drag-handle")
end
end
@@ -114,7 +114,7 @@ module Components
within area do
expect(page)
- .to have_no_selector(".icon-show-more-horizontal")
+ .not_to have_selector(".icon-show-more-horizontal")
end
end
@@ -150,7 +150,7 @@ module Components
page.find('.op-toast--close').click
end
- expect(page).to have_no_selector('.op-toast')
+ expect(page).not_to have_selector('.op-toast')
end
end
end
diff --git a/spec/support/components/menu/dropdown.rb b/spec/support/components/menu/dropdown.rb
index 5cf7ad3c8e6..9fca9ac3e8d 100644
--- a/spec/support/components/menu/dropdown.rb
+++ b/spec/support/components/menu/dropdown.rb
@@ -37,7 +37,7 @@ module Components
end
def expect_closed
- expect(page).to have_no_selector('.op-app-menu--dropdown')
+ expect(page).not_to have_selector('.op-app-menu--dropdown')
end
def expect_open
diff --git a/spec/support/components/menu/quick_add_menu.rb b/spec/support/components/menu/quick_add_menu.rb
index 018041d8efd..2ad221c4dea 100644
--- a/spec/support/components/menu/quick_add_menu.rb
+++ b/spec/support/components/menu/quick_add_menu.rb
@@ -57,7 +57,7 @@ module Components
def expect_no_work_package_types
within_dropdown do
- expect(page).to have_no_text 'Work packages'
+ expect(page).not_to have_text 'Work packages'
end
end
@@ -72,7 +72,7 @@ module Components
if present
expect(page).to have_link matcher
else
- expect(page).to have_no_link matcher
+ expect(page).not_to have_link matcher
end
end
end
diff --git a/spec/support/components/password_confirmation_dialog.rb b/spec/support/components/password_confirmation_dialog.rb
index aa02c9fac47..46513de93f1 100644
--- a/spec/support/components/password_confirmation_dialog.rb
+++ b/spec/support/components/password_confirmation_dialog.rb
@@ -47,7 +47,7 @@ module Components
end
def expect_closed
- expect(page).to have_no_selector(selector)
+ expect(page).not_to have_selector(selector)
end
def submit_button
@@ -71,7 +71,7 @@ module Components
expect(page).to have_selector('.flash.error',
text: I18n.t(:notice_password_confirmation_failed))
else
- expect(page).to have_no_selector('.flash.error')
+ expect(page).not_to have_selector('.flash.error')
end
end
end
diff --git a/spec/support/components/project_include_component.rb b/spec/support/components/project_include_component.rb
index 6813fbb1fd1..4786709dfa8 100644
--- a/spec/support/components/project_include_component.rb
+++ b/spec/support/components/project_include_component.rb
@@ -89,7 +89,7 @@ module Components
end
def expect_closed
- expect(page).to have_no_selector("[data-qa-selector='project-include-list']")
+ expect(page).not_to have_selector("[data-qa-selector='project-include-list']")
end
def click_button(text)
@@ -115,7 +115,7 @@ module Components
end
def no_loading_indicator
- expect(page).to have_no_selector("[data-qa-selector='op-project-include--loading']")
+ expect(page).not_to have_selector("[data-qa-selector='op-project-include--loading']")
end
end
end
diff --git a/spec/support/components/projects/top_menu.rb b/spec/support/components/projects/top_menu.rb
index 8c443b1f29d..b17b8660dba 100644
--- a/spec/support/components/projects/top_menu.rb
+++ b/spec/support/components/projects/top_menu.rb
@@ -44,7 +44,7 @@ module Components
end
def expect_current_project(name)
- page.find('#projects-menu', text: name)
+ page.find_by_id('projects-menu', text: name)
end
def expect_open
@@ -91,7 +91,7 @@ module Components
def expect_no_result(name)
within search_results do
- expect(page).to have_no_selector(autocompleter_item_title_selector, text: name)
+ expect(page).not_to have_selector(autocompleter_item_title_selector, text: name)
end
end
diff --git a/spec/support/components/table_pagination.rb b/spec/support/components/table_pagination.rb
index 4aa1307ff0f..0c0fcbe272a 100644
--- a/spec/support/components/table_pagination.rb
+++ b/spec/support/components/table_pagination.rb
@@ -42,7 +42,7 @@ module Components
def expect_no_per_page_options
within_pagination do
expect(page)
- .to have_no_selector('.op-pagination--options')
+ .not_to have_selector('.op-pagination--options')
end
end
diff --git a/spec/support/components/timelines/timeline_row.rb b/spec/support/components/timelines/timeline_row.rb
index f85686a0689..aaed9073dff 100644
--- a/spec/support/components/timelines/timeline_row.rb
+++ b/spec/support/components/timelines/timeline_row.rb
@@ -66,7 +66,7 @@ module Components
}.each do |className, text|
if text.nil?
expect(container).to have_selector(".#{className}", visible: :all)
- expect(container).to have_no_selector(".#{className}.not-empty", wait: 0)
+ expect(container).not_to have_selector(".#{className}.not-empty", wait: 0)
else
expect(container).to have_selector(".#{className}.not-empty", text:)
end
diff --git a/spec/support/components/work_packages/columns.rb b/spec/support/components/work_packages/columns.rb
index c864fd1aa5d..0bd96c03110 100644
--- a/spec/support/components/work_packages/columns.rb
+++ b/spec/support/components/work_packages/columns.rb
@@ -58,7 +58,7 @@ module Components
modal_open? or open_modal
column_autocompleter.click
- expect(page).to have_no_selector('.ng-option', text: name, visible: :all)
+ expect(page).not_to have_selector('.ng-option', text: name, visible: :all)
close_autocompleter
end
@@ -110,7 +110,7 @@ module Components
def expect_unchecked(name)
within_modal do
- expect(page).to have_no_selector('.op-draggable-autocomplete--item', text: name)
+ expect(page).not_to have_selector('.op-draggable-autocomplete--item', text: name)
end
end
diff --git a/spec/support/components/work_packages/context_menu.rb b/spec/support/components/work_packages/context_menu.rb
index f42a33d406d..3c25b0855f6 100644
--- a/spec/support/components/work_packages/context_menu.rb
+++ b/spec/support/components/work_packages/context_menu.rb
@@ -52,7 +52,7 @@ module Components
end
def expect_closed
- expect(page).to have_no_selector(selector)
+ expect(page).not_to have_selector(selector)
end
def choose(target)
@@ -62,7 +62,7 @@ module Components
def expect_no_options(*options)
expect_open
options.each do |text|
- expect(page).to have_no_selector("#{selector} .menu-item", text:)
+ expect(page).not_to have_selector("#{selector} .menu-item", text:)
end
end
diff --git a/spec/support/components/work_packages/display_representation.rb b/spec/support/components/work_packages/display_representation.rb
index 35da374889d..ae9aca16330 100644
--- a/spec/support/components/work_packages/display_representation.rb
+++ b/spec/support/components/work_packages/display_representation.rb
@@ -56,7 +56,7 @@ module Components
def expect_button(forbidden_text)
expect(page).to have_button('wp-view-toggle-button', disabled: false)
- expect(page).to have_no_selector('#wp-view-toggle-button', text: forbidden_text)
+ expect(page).not_to have_selector('#wp-view-toggle-button', text: forbidden_text)
end
def select_view(view_name)
diff --git a/spec/support/components/work_packages/filters.rb b/spec/support/components/work_packages/filters.rb
index 708b76cd14d..48c1f87c0f4 100644
--- a/spec/support/components/work_packages/filters.rb
+++ b/spec/support/components/work_packages/filters.rb
@@ -64,7 +64,7 @@ module Components
end
def quick_filter(text)
- input = page.find('#filter-by-text-input')
+ input = page.find_by_id('filter-by-text-input')
input.hover
input.click
SeleniumHubWaiter.wait
diff --git a/spec/support/components/work_packages/group_by.rb b/spec/support/components/work_packages/group_by.rb
index a1694a76108..7a0a571bd57 100644
--- a/spec/support/components/work_packages/group_by.rb
+++ b/spec/support/components/work_packages/group_by.rb
@@ -64,7 +64,7 @@ module Components
end
def expect_no_groups
- expect(page).to have_no_selector('[data-qa-selector="op-group--value"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-group--value"]')
end
def expect_not_grouped_by(name)
diff --git a/spec/support/components/work_packages/hierarchies.rb b/spec/support/components/work_packages/hierarchies.rb
index fb1cf4aaac4..39aa74416d0 100644
--- a/spec/support/components/work_packages/hierarchies.rb
+++ b/spec/support/components/work_packages/hierarchies.rb
@@ -62,7 +62,7 @@ module Components
end
def expect_no_hierarchies
- expect(page).to have_no_selector('.wp-table--hierarchy-span')
+ expect(page).not_to have_selector('.wp-table--hierarchy-span')
end
alias_method :expect_mode_disabled, :expect_no_hierarchies
@@ -113,7 +113,7 @@ module Components
expect(page).to have_selector("#{selector}#{collapsed_sel}")
else
expect(page).to have_selector(selector)
- expect(page).to have_no_selector("#{selector}#{collapsed_sel}")
+ expect(page).not_to have_selector("#{selector}#{collapsed_sel}")
end
end
end
diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rb
index a79de4f5525..23359c83cf2 100644
--- a/spec/support/components/work_packages/relations.rb
+++ b/spec/support/components/work_packages/relations.rb
@@ -90,7 +90,7 @@ module Components
def add_relation(type:, to:)
# Open create form
SeleniumHubWaiter.wait
- find('#relation--add-relation').click
+ find_by_id('relation--add-relation').click
# Select relation type
container = find('.wp-relations-create--form', wait: 10)
@@ -131,7 +131,7 @@ module Components
end
def expect_no_relation(relatable)
- expect(page).to have_no_selector('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).not_to have_selector('.wp-relations--subject-field', text: relatable.subject)
end
def add_parent(query, work_package)
@@ -155,7 +155,7 @@ module Components
end
def expect_no_parent
- expect(page).to have_no_selector '[data-qa-selector="op-wp-breadcrumb-parent"]', wait: 10
+ expect(page).not_to have_selector '[data-qa-selector="op-wp-breadcrumb-parent"]', wait: 10
end
def remove_parent
@@ -206,7 +206,7 @@ module Components
page.within('wp-relations-tab .work-packages-embedded-view--container') do
row = ".wp-row-#{work_package.id}-table"
- expect(page).to have_no_selector(row)
+ expect(page).not_to have_selector(row)
end
end
diff --git a/spec/support/components/work_packages/table_configuration_modal.rb b/spec/support/components/work_packages/table_configuration_modal.rb
index 66ac004ec5d..593ae517981 100644
--- a/spec/support/components/work_packages/table_configuration_modal.rb
+++ b/spec/support/components/work_packages/table_configuration_modal.rb
@@ -94,7 +94,7 @@ module Components
end
def expect_closed
- expect(page).to have_no_selector(selector)
+ expect(page).not_to have_selector(selector)
end
def expect_disabled_tab(name)
diff --git a/spec/support/components/work_packages/tabs_counter.rb b/spec/support/components/work_packages/tabs_counter.rb
index f8f489da4ec..df0e13d454a 100644
--- a/spec/support/components/work_packages/tabs_counter.rb
+++ b/spec/support/components/work_packages/tabs_counter.rb
@@ -20,7 +20,7 @@ module Components
# Counter should not be displayed, if there are no relations or watchers
def expect_no_counter(tab)
- expect(tab).to have_no_selector('[data-qa-selector="tab-count"]', wait: 10)
+ expect(tab).not_to have_selector('[data-qa-selector="tab-count"]', wait: 10)
end
end
end
diff --git a/spec/support/components/wysiwyg/wysiwyg_editor.rb b/spec/support/components/wysiwyg/wysiwyg_editor.rb
index 4ec1c4129e7..4f9cd0eb0d6 100644
--- a/spec/support/components/wysiwyg/wysiwyg_editor.rb
+++ b/spec/support/components/wysiwyg/wysiwyg_editor.rb
@@ -51,7 +51,7 @@ module Components
end
def expect_no_button(label)
- expect(container).to have_no_selector('.ck-button', visible: :all, text: label)
+ expect(container).not_to have_selector('.ck-button', visible: :all, text: label)
end
def expect_value(value)
@@ -60,7 +60,7 @@ module Components
def expect_supports_no_macros
expect(container)
- .to have_no_selector('.ck-button', visible: :all, text: 'Macros')
+ .not_to have_selector('.ck-button', visible: :all, text: 'Macros')
end
def within_enabled_preview
@@ -94,7 +94,7 @@ module Components
expect(page)
.to have_selector('img[src^="/api/v3/attachments/"]', count: images.length + 1, wait: 10)
- expect(page).to have_no_selector('op-toasters-upload-progress', wait: 5)
+ expect(page).not_to have_selector('op-toasters-upload-progress', wait: 5)
# Get the image uploaded last. As there is no way to distinguish between
# two uploaded images, from the perspective of the user, we do it by getting
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index 5e630f8c5ed..46e47334a0b 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -115,7 +115,7 @@ class DateEditField < EditField
def expect_inactive!
expect(context).to have_selector(display_selector, wait: 10)
- expect(page).to have_no_selector("#{modal_selector} #{input_selector}")
+ expect(page).not_to have_selector("#{modal_selector} #{input_selector}")
end
def expect_calendar
diff --git a/spec/support/edit_fields/spent_time_edit_field.rb b/spec/support/edit_fields/spent_time_edit_field.rb
index e9328753444..fb0664cd283 100644
--- a/spec/support/edit_fields/spent_time_edit_field.rb
+++ b/spec/support/edit_fields/spent_time_edit_field.rb
@@ -5,7 +5,7 @@ class SpentTimeEditField < EditField
if visible
expect(page).to have_selector("#{@selector} #{display_selector} #{icon}")
else
- expect(page).to have_no_selector("#{@selector} #{display_selector} #{icon}")
+ expect(page).not_to have_selector("#{@selector} #{display_selector} #{icon}")
end
end
diff --git a/spec/support/edit_fields/text_area_field.rb b/spec/support/edit_fields/text_area_field.rb
index 5516c573122..17b72b301c9 100644
--- a/spec/support/edit_fields/text_area_field.rb
+++ b/spec/support/edit_fields/text_area_field.rb
@@ -7,7 +7,7 @@ class TextAreaField < EditField
def expect_save_button(enabled: true)
if enabled
- expect(field_container).to have_no_selector("#{control_link}[disabled]")
+ expect(field_container).not_to have_selector("#{control_link}[disabled]")
else
expect(field_container).to have_selector("#{control_link}[disabled]")
end
diff --git a/spec/support/edit_fields/text_editor_field.rb b/spec/support/edit_fields/text_editor_field.rb
index 03fbcf9549c..18992649002 100644
--- a/spec/support/edit_fields/text_editor_field.rb
+++ b/spec/support/edit_fields/text_editor_field.rb
@@ -11,7 +11,7 @@ class TextEditorField < EditField
def expect_save_button(enabled: true)
if enabled
- expect(field_container).to have_no_selector("#{control_link}[disabled]")
+ expect(field_container).not_to have_selector("#{control_link}[disabled]")
else
expect(field_container).to have_selector("#{control_link}[disabled]")
end
diff --git a/spec/support/edit_fields/work_package_status_field.rb b/spec/support/edit_fields/work_package_status_field.rb
index 98b85fbed3f..4a702eaca31 100644
--- a/spec/support/edit_fields/work_package_status_field.rb
+++ b/spec/support/edit_fields/work_package_status_field.rb
@@ -51,6 +51,6 @@ class WorkPackageStatusField < EditField
end
def expect_inactive!
- expect(page).to have_no_selector(input_selector)
+ expect(page).not_to have_selector(input_selector)
end
end
diff --git a/spec/support/pages/admin/individual_principals/edit.rb b/spec/support/pages/admin/individual_principals/edit.rb
index 61bd0203e6b..ada205f7ae4 100644
--- a/spec/support/pages/admin/individual_principals/edit.rb
+++ b/spec/support/pages/admin/individual_principals/edit.rb
@@ -85,7 +85,7 @@ module Pages
end
def expect_no_membership(project_name)
- expect(page).to have_no_selector('tr', text: project_name)
+ expect(page).not_to have_selector('tr', text: project_name)
end
def expect_roles(project_name, roles)
diff --git a/spec/support/pages/admin/placeholder_users/index.rb b/spec/support/pages/admin/placeholder_users/index.rb
index 61b99369602..98146db402e 100644
--- a/spec/support/pages/admin/placeholder_users/index.rb
+++ b/spec/support/pages/admin/placeholder_users/index.rb
@@ -53,7 +53,7 @@ module Pages
def expect_non_listed
expect(page)
- .to have_no_selector('tr.placeholder-user')
+ .not_to have_selector('tr.placeholder-user')
expect(page)
.to have_selector('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
diff --git a/spec/support/pages/admin/users/edit.rb b/spec/support/pages/admin/users/edit.rb
index bb441d0dea9..f7f445e452c 100644
--- a/spec/support/pages/admin/users/edit.rb
+++ b/spec/support/pages/admin/users/edit.rb
@@ -81,7 +81,7 @@ module Pages
end
def expect_no_membership(project_name)
- expect(page).to have_no_selector('tr', text: project_name)
+ expect(page).not_to have_selector('tr', text: project_name)
end
def expect_roles(project_name, roles)
diff --git a/spec/support/pages/admin/users/index.rb b/spec/support/pages/admin/users/index.rb
index 23f61c7b0db..f02e38e89ef 100644
--- a/spec/support/pages/admin/users/index.rb
+++ b/spec/support/pages/admin/users/index.rb
@@ -48,7 +48,7 @@ module Pages
def expect_non_listed
expect(page)
- .to have_no_selector('tr.user')
+ .not_to have_selector('tr.user')
expect(page)
.to have_selector('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
diff --git a/spec/support/pages/custom_fields.rb b/spec/support/pages/custom_fields.rb
index c5a839871fc..845f6119cd6 100644
--- a/spec/support/pages/custom_fields.rb
+++ b/spec/support/pages/custom_fields.rb
@@ -46,7 +46,7 @@ module Pages
end
def set_name(name)
- find("#custom_field_name").set name
+ find_by_id('custom_field_name').set name
end
def set_default_value(value)
@@ -54,7 +54,7 @@ module Pages
end
def set_all_projects(value)
- find('#custom_field_is_for_all').set value
+ find_by_id('custom_field_is_for_all').set value
end
def has_form_element?(name)
diff --git a/spec/support/pages/members.rb b/spec/support/pages/members.rb
index af18d8fe4de..017da59c02e 100644
--- a/spec/support/pages/members.rb
+++ b/spec/support/pages/members.rb
@@ -55,7 +55,7 @@ module Pages
end
def open_filters!
- find('#filter-member-button').click
+ find_by_id('filter-member-button').click
end
def search_for_name(name)
diff --git a/spec/support/pages/messages/show.rb b/spec/support/pages/messages/show.rb
index 339ab5fe93b..152a7ed90d8 100644
--- a/spec/support/pages/messages/show.rb
+++ b/spec/support/pages/messages/show.rb
@@ -82,7 +82,7 @@ module Pages::Messages
# For some reason, capybara will click on
# the button to add another attachment when being told to click on "Submit".
# Therefor, submitting by enter key.
- subject_field = find('#reply_subject')
+ subject_field = find_by_id('reply_subject')
subject_field.native.send_keys(:return)
Message.last
diff --git a/spec/support/pages/notifications/center.rb b/spec/support/pages/notifications/center.rb
index 215c10a20a3..98d5a5c6fdb 100644
--- a/spec/support/pages/notifications/center.rb
+++ b/spec/support/pages/notifications/center.rb
@@ -72,7 +72,7 @@ module Pages
def expect_no_item(*notifications)
notifications.each do |notification|
expect(page)
- .to have_no_selector("[data-qa-selector='op-ian-notification-item-#{notification.id}']")
+ .not_to have_selector("[data-qa-selector='op-ian-notification-item-#{notification.id}']")
end
end
@@ -102,7 +102,7 @@ module Pages
end
def expect_closed
- expect(page).to have_no_selector('op-in-app-notification-center')
+ expect(page).not_to have_selector('op-in-app-notification-center')
end
def expect_open
@@ -115,7 +115,7 @@ module Pages
def expect_number_of_notifications(count)
if count == 0
- expect(page).to have_no_selector('[data-qa-selector^="op-ian-notification-item-"]')
+ expect(page).not_to have_selector('[data-qa-selector^="op-ian-notification-item-"]')
else
expect(page).to have_selector('[data-qa-selector^="op-ian-notification-item-"]', count:, wait: 10)
end
@@ -123,7 +123,7 @@ module Pages
def expect_bell_count(count)
if count == 0
- expect(page).to have_no_selector('[data-qa-selector="op-ian-notifications-count"]')
+ expect(page).not_to have_selector('[data-qa-selector="op-ian-notifications-count"]')
else
expect(page).to have_selector('[data-qa-selector="op-ian-notifications-count"]', text: count, wait: 10)
end
@@ -134,7 +134,7 @@ module Pages
end
def expect_no_toaster
- expect(page).to have_no_selector('.op-toast.-info', wait: 10)
+ expect(page).not_to have_selector('.op-toast.-info', wait: 10)
end
def expect_toast
diff --git a/spec/support/pages/page.rb b/spec/support/pages/page.rb
index a83b9981dcd..962a4a2c232 100644
--- a/spec/support/pages/page.rb
+++ b/spec/support/pages/page.rb
@@ -114,9 +114,9 @@ module Pages
def expect_no_toaster(type: :success, message: nil)
if type.nil?
- expect(page).to have_no_selector(".op-toast")
+ expect(page).not_to have_selector(".op-toast")
else
- expect(page).to have_no_selector(".op-toast.-#{type}", text: message)
+ expect(page).not_to have_selector(".op-toast.-#{type}", text: message)
end
end
diff --git a/spec/support/pages/reminders/settings.rb b/spec/support/pages/reminders/settings.rb
index b254ea64aba..0c05d425afc 100644
--- a/spec/support/pages/reminders/settings.rb
+++ b/spec/support/pages/reminders/settings.rb
@@ -112,7 +112,7 @@ module Pages
if paused
expect(page).to have_checked_field 'Temporarily pause daily email reminders'
else
- expect(page).to have_no_checked_field 'Temporarily pause daily email reminders'
+ expect(page).not_to have_checked_field 'Temporarily pause daily email reminders'
end
if first && last
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index 25db78e608e..7da079828d5 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -77,7 +77,7 @@ module Pages
def expect_hidden_field(attribute)
page.within(container) do
- expect(page).to have_no_selector(".inline-edit--display-field.#{attribute}")
+ expect(page).not_to have_selector(".inline-edit--display-field.#{attribute}")
end
end
@@ -88,7 +88,7 @@ module Pages
end
def open_in_split_view
- find('#work-packages-details-view-button').click
+ find_by_id('work-packages-details-view-button').click
end
def ensure_page_loaded
@@ -113,7 +113,7 @@ module Pages
end
def expect_no_group(name)
- expect(page).to have_no_selector('.attributes-group--header-text', text: name.upcase)
+ expect(page).not_to have_selector('.attributes-group--header-text', text: name.upcase)
end
def expect_attributes(attribute_expectations)
@@ -174,7 +174,7 @@ module Pages
def expect_no_custom_action(name)
expect(page)
- .to have_no_selector('.custom-action', text: name)
+ .not_to have_selector('.custom-action', text: name)
end
def expect_custom_action_order(*names)
diff --git a/spec/support/pages/work_packages/concerns/work_package_by_button_creator.rb b/spec/support/pages/work_packages/concerns/work_package_by_button_creator.rb
index 99c122276ab..d074b4ac877 100644
--- a/spec/support/pages/work_packages/concerns/work_package_by_button_creator.rb
+++ b/spec/support/pages/work_packages/concerns/work_package_by_button_creator.rb
@@ -63,7 +63,7 @@ module Pages
click_wp_create_button
expect(page)
- .to have_no_selector('#types-context-menu .menu-item', text: type.name.upcase)
+ .not_to have_selector('#types-context-menu .menu-item', text: type.name.upcase)
end
private
diff --git a/spec/support/pages/work_packages/split_work_package.rb b/spec/support/pages/work_packages/split_work_package.rb
index 8ff4da9ab9e..dd8653777d4 100644
--- a/spec/support/pages/work_packages/split_work_package.rb
+++ b/spec/support/pages/work_packages/split_work_package.rb
@@ -44,7 +44,7 @@ module Pages
end
def expect_closed
- expect(page).to have_no_selector(@selector)
+ expect(page).not_to have_selector(@selector)
end
def expect_open
diff --git a/spec/support/pages/work_packages/work_package_cards.rb b/spec/support/pages/work_packages/work_package_cards.rb
index 6ad0b40b993..7424e1cac9c 100644
--- a/spec/support/pages/work_packages/work_package_cards.rb
+++ b/spec/support/pages/work_packages/work_package_cards.rb
@@ -118,12 +118,12 @@ module Pages
def select_all_work_packages
find('body').send_keys [:control, 'a']
- expect(page).to have_no_selector '#work-package-context-menu'
+ expect(page).not_to have_selector '#work-package-context-menu'
end
def deselect_all_work_packages
find('body').send_keys [:control, 'd']
- expect(page).to have_no_selector '#work-package-context-menu'
+ expect(page).not_to have_selector '#work-package-context-menu'
end
def card(work_package)
diff --git a/spec/support/pages/work_packages/work_packages_timeline.rb b/spec/support/pages/work_packages/work_packages_timeline.rb
index 540c1c4e198..9d8d1ac4651 100644
--- a/spec/support/pages/work_packages/work_packages_timeline.rb
+++ b/spec/support/pages/work_packages/work_packages_timeline.rb
@@ -67,7 +67,7 @@ module Pages
if page.has_selector?('#wp-view-toggle-button', text: 'Gantt')
within(timeline_container) do
work_packages.each do |wp|
- expect(page).to have_no_selector(".wp-row-#{wp.id}-timeline", visible: true)
+ expect(page).not_to have_selector(".wp-row-#{wp.id}-timeline", visible: true)
end
end
end
@@ -88,8 +88,8 @@ module Pages
expect(page).to have_selector('#wp-view-toggle-button', text: 'Gantt')
expect(page).to have_selector('.wp-table-timeline--container .wp-timeline-cell')
else
- expect(page).to have_no_selector('#wp-view-toggle-button', text: 'Gantt')
- expect(page).to have_no_selector('.wp-table-timeline--container .wp-timeline-cell', visible: true)
+ expect(page).not_to have_selector('#wp-view-toggle-button', text: 'Gantt')
+ expect(page).not_to have_selector('.wp-table-timeline--container .wp-timeline-cell', visible: true)
end
end
@@ -98,7 +98,7 @@ module Pages
end
def zoom_in_button
- page.find('#work-packages-timeline-zoom-in-button')
+ page.find_by_id('work-packages-timeline-zoom-in-button')
end
def zoom_in
@@ -110,11 +110,11 @@ module Pages
end
def zoom_out_button
- page.find('#work-packages-timeline-zoom-out-button')
+ page.find_by_id('work-packages-timeline-zoom-out-button')
end
def autozoom
- page.find('#work-packages-timeline-zoom-auto-button').click
+ page.find_by_id('work-packages-timeline-zoom-auto-button').click
end
def expect_zoom_at(value)
@@ -138,13 +138,13 @@ module Pages
def expect_no_timeline_relation(from, to)
within(timeline_container) do
- expect(page).to have_no_selector(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}")
+ expect(page).not_to have_selector(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}")
end
end
def expect_no_relations
within(timeline_container) do
- expect(page).to have_no_selector(".relation-line")
+ expect(page).not_to have_selector(".relation-line")
end
end
diff --git a/spec/support/request_with_header.rb b/spec/support/request_with_header.rb
index d696b7528e8..017781151e4 100644
--- a/spec/support/request_with_header.rb
+++ b/spec/support/request_with_header.rb
@@ -7,7 +7,7 @@ RSpec.configure do |c|
end
end
- c.before(:each, type: :request, content_type: :json) do |_ex|
+ c.before(:each, content_type: :json, type: :request) do |_ex|
header('Content-Type', 'application/json')
end
end
diff --git a/spec/support/shared/loading_indicator_saveguard.rb b/spec/support/shared/loading_indicator_saveguard.rb
index 880f6f1272a..390acac9150 100644
--- a/spec/support/shared/loading_indicator_saveguard.rb
+++ b/spec/support/shared/loading_indicator_saveguard.rb
@@ -34,5 +34,5 @@
#
def loading_indicator_saveguard
- expect(page).to have_no_selector('.loading-indicator')
+ expect(page).not_to have_selector('.loading-indicator')
end
diff --git a/spec/support/system_test.rb b/spec/support/system_test.rb
index ce1d933f57b..ef5bb4b97ad 100644
--- a/spec/support/system_test.rb
+++ b/spec/support/system_test.rb
@@ -7,7 +7,7 @@ RSpec.configure do |config|
##
# Use selenium-backed firefox driver for JS tests
- config.before(:each, type: :system, js: true) do
+ config.before(:each, js: true, type: :system) do
driven_by :selenium
end
end