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

Run `rubocop --autocorrect` on all files

Christophe Bliard8fa85845385d
diff --git a/app/components/members/user_filter_component.rb b/app/components/members/user_filter_component.rb
index 98203f91f81..3dc96333fc0 100644
--- a/app/components/members/user_filter_component.rb
+++ b/app/components/members/user_filter_component.rb
@@ -64,7 +64,7 @@ module Members
def status_members_query(status)
params = {
project_id: project.id,
- status:,
+ status:
}
self.class.filter(params)
diff --git a/app/components/oauth/applications/row_component.rb b/app/components/oauth/applications/row_component.rb
index b36ba9c0ccb..33bfc1e631d 100644
--- a/app/components/oauth/applications/row_component.rb
+++ b/app/components/oauth/applications/row_component.rb
@@ -31,7 +31,6 @@
module OAuth
module Applications
class RowComponent < ::RowComponent
-
property :confidential
def application
diff --git a/app/components/users/auto_login_tokens/row_component.rb b/app/components/users/auto_login_tokens/row_component.rb
index 33b2808d37a..784205909c9 100644
--- a/app/components/users/auto_login_tokens/row_component.rb
+++ b/app/components/users/auto_login_tokens/row_component.rb
@@ -37,9 +37,7 @@ module Users
model
end
- def token_data
- token.data
- end
+ delegate :data, to: :token, prefix: true
def current?
token == current_token
diff --git a/app/contracts/model_contract.rb b/app/contracts/model_contract.rb
index 35979f861da..4c482f3cbdf 100644
--- a/app/contracts/model_contract.rb
+++ b/app/contracts/model_contract.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './base_contract'
+require_relative 'base_contract'
##
# Model contract for AR records that
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 07f139f7c5f..b055a92dbe0 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -203,12 +203,10 @@ class AccountController < ApplicationController
else
flash[:error] = I18n.t(:notice_activation_failed)
end
+ elsif user.active?
+ flash[:notice] = I18n.t(:notice_account_already_activated)
else
- if user.active?
- flash[:notice] = I18n.t(:notice_account_already_activated)
- else
- flash[:error] = I18n.t(:notice_activation_failed)
- end
+ flash[:error] = I18n.t(:notice_activation_failed)
end
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 39a82824868..91dd292afc9 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -105,7 +105,7 @@ class AdminController < ApplicationController
private
def hidden_admin_menu_items
- (OpenProject::Configuration.hidden_menu_items[:admin_menu.to_s] || [])
+ OpenProject::Configuration.hidden_menu_items[:admin_menu.to_s] || []
end
def plaintext_extraction_checks
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index a4f381b8f82..9aa5ae8ee0c 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -263,7 +263,7 @@ class ApplicationController < ActionController::Base
end
def authorize_in_model(ctrl = params[:controller], action = params[:action])
- model = instance_variable_get("@#{model_object.to_s.underscore}")
+ model = instance_variable_get(:"@#{model_object.to_s.underscore}")
allowed = User.current.allowed_in_entity?({ controller: ctrl, action: }, model, model_object)
@@ -377,7 +377,7 @@ class ApplicationController < ActionController::Base
model = self.class._model_object
if model
@object = model.find(params[object_id])
- instance_variable_set("@#{controller_name.singularize}", @object) if @object
+ instance_variable_set(:"@#{controller_name.singularize}", @object) if @object
end
rescue ActiveRecord::RecordNotFound
render_404
@@ -388,7 +388,7 @@ class ApplicationController < ActionController::Base
model_object = self.class._model_object
instance = model_object.find(params[object_id])
@project = instance.project
- instance_variable_set("@#{model_object.to_s.underscore}", instance)
+ instance_variable_set(:"@#{model_object.to_s.underscore}", instance)
else
@project = Project.find(params[:project_id])
end
diff --git a/app/controllers/concerns/accounts/current_user.rb b/app/controllers/concerns/accounts/current_user.rb
index 47caaf98f16..ef2b81a36f5 100644
--- a/app/controllers/concerns/accounts/current_user.rb
+++ b/app/controllers/concerns/accounts/current_user.rb
@@ -113,6 +113,7 @@ module Accounts::CurrentUser
def current_api_key_user
return unless Setting.rest_api_enabled? && api_request?
+
key = api_key_from_request
if key && accept_key_auth_actions.include?(params[:action])
diff --git a/app/controllers/concerns/member_helper.rb b/app/controllers/concerns/member_helper.rb
index 2a1dc038b25..93f15002b4e 100644
--- a/app/controllers/concerns/member_helper.rb
+++ b/app/controllers/concerns/member_helper.rb
@@ -79,10 +79,8 @@ module MemberHelper
!OpenProject::Enterprise.user_limit_reached? || !OpenProject::Enterprise.fail_fast?
end
- def each_comma_separated(array, &block)
- array.map do |e|
- block.call(e)
- end.flatten
+ def each_comma_separated(array, &)
+ array.map(&).flatten
end
def transform_array_of_comma_separated_ids(array)
diff --git a/app/controllers/concerns/op_turbo/component_stream.rb b/app/controllers/concerns/op_turbo/component_stream.rb
index f88302e9057..6d8c2ed136a 100644
--- a/app/controllers/concerns/op_turbo/component_stream.rb
+++ b/app/controllers/concerns/op_turbo/component_stream.rb
@@ -36,7 +36,7 @@ module OpTurbo
render turbo_stream: turbo_streams, status:
end
- format_block.call(format) if block_given?
+ yield(format) if format_block
end
end
alias_method :respond_with_turbo_streams, :respond_to_with_turbo_streams
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index bf5208a0387..d67db8c46e1 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -8,7 +8,7 @@ class ErrorsController < ActionController::Base
end
def unacceptable
- render file: "#{Rails.root}/public/422.html",
+ render file: "#{Rails.public_path.join('422.html')}",
status: :unacceptable,
layout: false
end
diff --git a/app/controllers/members/menus_controller.rb b/app/controllers/members/menus_controller.rb
index 9caa40f2212..6d0aeca4cc6 100644
--- a/app/controllers/members/menus_controller.rb
+++ b/app/controllers/members/menus_controller.rb
@@ -65,8 +65,6 @@ module Members
]
end
- private
-
def project_roles_entries
ProjectRole
.where(id: MemberRole.where(member_id: @project.members.select(:id)).select(:role_id))
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 68a66f190d3..24937ec8899 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -114,7 +114,7 @@ class MessagesController < ApplicationController
if call.success?
flash[:notice] = t(:notice_successful_update)
@message.reload
- redirect_to topic_path(@message.root, r: (@message.parent_id && @message.id))
+ redirect_to topic_path(@message.root, r: @message.parent_id && @message.id)
else
render action: 'edit'
end
diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb
index f976ba70785..c71ef05ecbd 100644
--- a/app/controllers/search_controller.rb
+++ b/app/controllers/search_controller.rb
@@ -151,7 +151,7 @@ class SearchController < ApplicationController
# don't search projects
types.delete('projects')
# only show what the user is allowed to view
- types = types.select { |o| User.current.allowed_in_project?("view_#{o}".to_sym, projects_to_search) }
+ types = types.select { |o| User.current.allowed_in_project?(:"view_#{o}", projects_to_search) }
end
types
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 7ac971a8973..0babd91d5d3 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -336,7 +336,7 @@ class WikiController < ApplicationController
default_item = default_menu_item(page)
return unless default_item
- "no-menu-item-#{default_item.menu_identifier}".to_sym
+ :"no-menu-item-#{default_item.menu_identifier}"
end
private
diff --git a/app/controllers/wiki_menu_items_controller.rb b/app/controllers/wiki_menu_items_controller.rb
index 8f2fac35a84..b3dcb8d8735 100644
--- a/app/controllers/wiki_menu_items_controller.rb
+++ b/app/controllers/wiki_menu_items_controller.rb
@@ -52,7 +52,7 @@ class WikiMenuItemsController < ApplicationController
menu_item = controller.default_menu_item(page)
return unless menu_item
- "no-menu-item-#{menu_item.menu_identifier}".to_sym
+ :"no-menu-item-#{menu_item.menu_identifier}"
end
before_action :find_project_by_project_id
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb
index 619fc733970..4c62e7e928b 100644
--- a/app/helpers/admin_helper.rb
+++ b/app/helpers/admin_helper.rb
@@ -34,7 +34,7 @@ module AdminHelper
def linked_sha_reference(sha, url)
if sha && url
- link_to sha, url, target: '_blank'
+ link_to sha, url, target: '_blank', rel: 'noopener'
else
sha
end
diff --git a/app/helpers/error_message_helper.rb b/app/helpers/error_message_helper.rb
index 67f4de9983f..6b3205e4f3a 100644
--- a/app/helpers/error_message_helper.rb
+++ b/app/helpers/error_message_helper.rb
@@ -30,7 +30,7 @@ module ErrorMessageHelper
include ActionView::Helpers::OutputSafetyHelper
def error_messages_for(object)
- object = instance_variable_get("@#{object}") unless object.respond_to?(:to_model)
+ object = instance_variable_get(:"@#{object}") unless object.respond_to?(:to_model)
object = convert_to_model(object)
return unless object
diff --git a/app/helpers/individual_principal_hooks_helper.rb b/app/helpers/individual_principal_hooks_helper.rb
index 5cde7180e7f..07080e5681a 100644
--- a/app/helpers/individual_principal_hooks_helper.rb
+++ b/app/helpers/individual_principal_hooks_helper.rb
@@ -29,7 +29,7 @@
module IndividualPrincipalHooksHelper
def call_individual_principals_memberships_hook(individual_principal, suffix, context = {})
call_context = { individual_principal_key(individual_principal) => individual_principal }.merge(context)
- call_hook("view_#{individual_principal.class.name.underscore.pluralize}_memberships_table_#{suffix}".to_sym, call_context)
+ call_hook(:"view_#{individual_principal.class.name.underscore.pluralize}_memberships_table_#{suffix}", call_context)
end
def individual_principal_key(individual_principal)
diff --git a/app/helpers/mail_layout_helper.rb b/app/helpers/mail_layout_helper.rb
index 50c9d8c372a..3ca91ed4817 100644
--- a/app/helpers/mail_layout_helper.rb
+++ b/app/helpers/mail_layout_helper.rb
@@ -61,10 +61,10 @@ module MailLayoutHelper
def placeholder_cell(number, vertical:)
style = if vertical
- "max-width:#{number}; min-width:#{number}; width:#{number}"
- else
- "line-height:#{number}; max-width:0; min-width:0; height:#{number}; width:0; font-size:#{number}"
- end
+ "max-width:#{number}; min-width:#{number}; width:#{number}"
+ else
+ "line-height:#{number}; max-width:0; min-width:0; height:#{number}; width:0; font-size:#{number}"
+ end
content_tag('td', '&nbsp;'.html_safe, style:)
end
diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb
index 254fa2519eb..a2896d9f195 100644
--- a/app/helpers/reports_helper.rb
+++ b/app/helpers/reports_helper.rb
@@ -41,8 +41,8 @@ module ReportsHelper
end || 0
end
- def aggregate_link(data, criteria, *args)
+ def aggregate_link(data, criteria, *)
a = aggregate data, criteria
- a.positive? ? link_to(h(a), *args) : '-'
+ a.positive? ? link_to(h(a), *) : '-'
end
end
diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb
index 30839e3bc0f..151811a6fad 100644
--- a/app/helpers/repositories_helper.rb
+++ b/app/helpers/repositories_helper.rb
@@ -252,7 +252,7 @@ module RepositoriesHelper
action: 'repository-settings#updateSelectedType',
'repository-settings-target': 'scmVendor'
},
- disabled: (repository && !repository.new_record?))
+ disabled: repository && !repository.new_record?)
end
def git_path_encoding_options(repository)
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index ce38b80d093..e8c169e20b3 100644
--- a/app/helpers/settings_helper.rb
+++ b/app/helpers/settings_helper.rb
@@ -169,7 +169,7 @@ module SettingsHelper
hidden +
styled_check_box_tag("settings[#{setting}]",
1,
- Setting.send("#{setting}?"),
+ Setting.send(:"#{setting}?"),
disabled_setting_option(setting).merge(options))
end
end
@@ -199,11 +199,11 @@ module SettingsHelper
private
- def wrap_field_outer(options, &block)
+ def wrap_field_outer(options, &)
if options[:label] == false
- block.call
+ yield
else
- content_tag(:span, class: 'form--field-container', &block)
+ content_tag(:span, class: 'form--field-container', &)
end
end
@@ -216,7 +216,7 @@ module SettingsHelper
hidden_field_tag("settings[#{setting}][]", '') +
I18n.t("setting_#{setting}")
end
- end.join.html_safe # rubocop:disable Rails/OutputSafety
+ end.join.html_safe
end
end
diff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rb
index 449b64fc1ad..e9ade0c7d7e 100644
--- a/app/helpers/sort_helper.rb
+++ b/app/helpers/sort_helper.rb
@@ -124,7 +124,6 @@ module SortHelper
.map { |c, o| [@available_criteria[c], o] }
.reject { |c, _| c.nil? }
.filter_map { |c, o| append_direction(Array(c), o) }
-
end
def to_query_hash
@@ -142,9 +141,9 @@ module SortHelper
normalize!
end
- def add(*args)
+ def add(*)
r = self.class.new.from_param(to_param)
- r.add!(*args)
+ r.add!(*)
r
end
diff --git a/app/mailers/sharing_mailer.rb b/app/mailers/sharing_mailer.rb
index dbbcc4f8d52..31550cb9498 100644
--- a/app/mailers/sharing_mailer.rb
+++ b/app/mailers/sharing_mailer.rb
@@ -50,17 +50,18 @@ class SharingMailer < ApplicationMailer
end
def derive_allowed_work_package_actions(role)
- allowed_actions = case role.builtin
- when Role::BUILTIN_WORK_PACKAGE_EDITOR
- [I18n.t('work_package.sharing.permissions.view'),
- I18n.t('work_package.sharing.permissions.comment'),
- I18n.t('work_package.sharing.permissions.edit')]
- when Role::BUILTIN_WORK_PACKAGE_COMMENTER
- [I18n.t('work_package.sharing.permissions.view'),
- I18n.t('work_package.sharing.permissions.comment')]
- when Role::BUILTIN_WORK_PACKAGE_VIEWER
- [I18n.t('work_package.sharing.permissions.view')]
- end
+ allowed_actions =
+ case role.builtin
+ when Role::BUILTIN_WORK_PACKAGE_EDITOR
+ [I18n.t('work_package.sharing.permissions.view'),
+ I18n.t('work_package.sharing.permissions.comment'),
+ I18n.t('work_package.sharing.permissions.edit')]
+ when Role::BUILTIN_WORK_PACKAGE_COMMENTER
+ [I18n.t('work_package.sharing.permissions.view'),
+ I18n.t('work_package.sharing.permissions.comment')]
+ when Role::BUILTIN_WORK_PACKAGE_VIEWER
+ [I18n.t('work_package.sharing.permissions.view')]
+ end
allowed_actions.map(&:downcase)
end
diff --git a/app/models/activities/base_activity_provider.rb b/app/models/activities/base_activity_provider.rb
index e707198f940..6ce3df6038d 100644
--- a/app/models/activities/base_activity_provider.rb
+++ b/app/models/activities/base_activity_provider.rb
@@ -68,7 +68,7 @@ class Activities::BaseActivityProvider
self.activity_provider_options = {
type: name.underscore.pluralize,
activities: [:activity],
- permission: "view_#{name.underscore.pluralize}".to_sym
+ permission: :"view_#{name.underscore.pluralize}"
}.merge(options)
end
diff --git a/app/models/changeset.rb b/app/models/changeset.rb
index adf39adc177..5aca757d752 100644
--- a/app/models/changeset.rb
+++ b/app/models/changeset.rb
@@ -146,7 +146,7 @@ class Changeset < ApplicationRecord
refs = match[3]
next unless action.present? || ref_keywords_any
- refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/).each do |m|
+ refs.scan(/#(\d+)(\s+@#{TIMELOG_RE})?/o).each do |m|
work_package = find_referenced_work_package_by_id(m[0].to_i)
hours = m[2]
if work_package
diff --git a/app/models/concerns/virtual_attribute.rb b/app/models/concerns/virtual_attribute.rb
index fc55d991868..55558d41e30 100644
--- a/app/models/concerns/virtual_attribute.rb
+++ b/app/models/concerns/virtual_attribute.rb
@@ -56,7 +56,7 @@ module VirtualAttribute
end
def _define_virtual_attribute_setter(attribute)
- define_method "#{attribute}=" do |value|
+ define_method :"#{attribute}=" do |value|
set_virtual_attribute(attribute, value) if send(attribute) != value
instance_variable_set(:"@#{attribute}_set", true)
instance_variable_set(:"@#{attribute}", value)
diff --git a/app/models/custom_actions/conditions/base.rb b/app/models/custom_actions/conditions/base.rb
index 7d08e43aa96..bc63a7abc9d 100644
--- a/app/models/custom_actions/conditions/base.rb
+++ b/app/models/custom_actions/conditions/base.rb
@@ -110,17 +110,17 @@ class CustomActions::Conditions::Base
private_class_method :habtm_table
def self.key_id
- @key_id ||= "#{key}_id".to_sym
+ @key_id ||= :"#{key}_id"
end
private_class_method :key_id
def self.association_key
- "#{key}_conditions".to_sym
+ :"#{key}_conditions"
end
private_class_method :association_key
def self.association_ids
- "#{key}_condition_ids".to_sym
+ :"#{key}_condition_ids"
end
private_class_method :association_ids
end
diff --git a/app/models/custom_style.rb b/app/models/custom_style.rb
index e12ce883900..38d1cbffd23 100644
--- a/app/models/custom_style.rb
+++ b/app/models/custom_style.rb
@@ -23,7 +23,7 @@ class CustomStyle < ApplicationRecord
end
%i(favicon touch_icon export_logo export_cover logo).each do |name|
- define_method "#{name}_path" do
+ define_method :"#{name}_path" do
image = send(name)
if image.readable?
@@ -31,7 +31,7 @@ class CustomStyle < ApplicationRecord
end
end
- define_method "remove_#{name}" do
+ define_method :"remove_#{name}" do
image = send(name)
image&.remove!
diff --git a/app/models/exports/exporter.rb b/app/models/exports/exporter.rb
index a30e7474b1b..1aae11aaa61 100644
--- a/app/models/exports/exporter.rb
+++ b/app/models/exports/exporter.rb
@@ -67,9 +67,9 @@ module Exports
::Exports::Register.formatter_for(model, attribute, export_format)
end
- def format_attribute(object, attribute, export_format, **options)
+ def format_attribute(object, attribute, export_format, **)
formatter = formatter_for(attribute, export_format)
- formatter.format(object, **options)
+ formatter.format(object, **)
end
end
end
diff --git a/app/models/journable/with_historic_attributes.rb b/app/models/journable/with_historic_attributes.rb
index ad28a466186..98ee689f019 100644
--- a/app/models/journable/with_historic_attributes.rb
+++ b/app/models/journable/with_historic_attributes.rb
@@ -235,6 +235,7 @@ class Journable::WithHistoricAttributes < SimpleDelegator
historic_journable = at_timestamp(Timestamp.parse(timestamp))
return unless historic_journable
+
changes = ::Acts::Journalized::JournableDiffer.changes(__getobj__, historic_journable)
# In the other occurrences of JournableDiffer.association_changes calls, we are using the plural
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index db4b00b21e7..74e8515e121 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -297,8 +297,8 @@ class MailHandler < ActionMailer::Base
# Adds To and Cc as watchers of the given object if the sender has the
# appropriate permission
def add_watchers(obj)
- if user.allowed_in_project?("add_#{obj.class.name.underscore}_watchers".to_sym, obj.project) ||
- user.allowed_in_project?("add_#{obj.class.lookup_ancestors.last.name.underscore}_watchers".to_sym, obj.project)
+ if user.allowed_in_project?(:"add_#{obj.class.name.underscore}_watchers", obj.project) ||
+ user.allowed_in_project?(:"add_#{obj.class.lookup_ancestors.last.name.underscore}_watchers", obj.project)
addresses = [email.to, email.cc].flatten.compact.uniq.map { |a| a.strip.downcase }
unless addresses.empty?
User
diff --git a/app/models/menu_items/wiki_menu_item.rb b/app/models/menu_items/wiki_menu_item.rb
index 1321c783816..f480aebc3b3 100644
--- a/app/models/menu_items/wiki_menu_item.rb
+++ b/app/models/menu_items/wiki_menu_item.rb
@@ -44,7 +44,7 @@ class MenuItems::WikiMenuItem < MenuItem
end
def menu_identifier
- "wiki-#{slug}".to_sym
+ :"wiki-#{slug}"
end
def index_page
@@ -68,6 +68,6 @@ class MenuItems::WikiMenuItem < MenuItem
end
def self.add_entry_item_prefix(identifier)
- "entry-item-#{identifier}".to_sym
+ :"entry-item-#{identifier}"
end
end
diff --git a/app/models/news.rb b/app/models/news.rb
index dc18018395f..e4b84568e47 100644
--- a/app/models/news.rb
+++ b/app/models/news.rb
@@ -61,7 +61,7 @@ class News < ApplicationRecord
end
def description=(val)
- super val.presence || ''
+ super(val.presence || '')
end
# returns latest news for projects visible by user
diff --git a/app/models/principals/scopes/status.rb b/app/models/principals/scopes/status.rb
index 9ea1f8196b9..c04a360c985 100644
--- a/app/models/principals/scopes/status.rb
+++ b/app/models/principals/scopes/status.rb
@@ -41,7 +41,7 @@ module Principals::Scopes
not_builtin.where(status: val)
end
- define_singleton_method("not_#{key}") do
+ define_singleton_method(:"not_#{key}") do
not_builtin.where.not(status: val)
end
end
diff --git a/app/models/queries/columns/base.rb b/app/models/queries/columns/base.rb
index 7a4d2de86ef..e56616ea9c4 100644
--- a/app/models/queries/columns/base.rb
+++ b/app/models/queries/columns/base.rb
@@ -54,7 +54,7 @@ class Queries::Columns::Base
association
null_handling
default_order).each do |attribute|
- send("#{attribute}=", options[attribute])
+ send(:"#{attribute}=", options[attribute])
end
end
diff --git a/app/models/queries/filters/base.rb b/app/models/queries/filters/base.rb
index 3bff06524a4..b030df6f5da 100644
--- a/app/models/queries/filters/base.rb
+++ b/app/models/queries/filters/base.rb
@@ -49,7 +49,7 @@ class Queries::Filters::Base
self.context = options[:context]
self.class.filter_params.each do |param_field|
- send("#{param_field}=", options[param_field])
+ send(:"#{param_field}=", options[param_field])
end
end
diff --git a/app/models/queries/filters/not_existing_filter.rb b/app/models/queries/filters/not_existing_filter.rb
index 207405c096d..632ab69c0ef 100644
--- a/app/models/queries/filters/not_existing_filter.rb
+++ b/app/models/queries/filters/not_existing_filter.rb
@@ -56,7 +56,7 @@ module Queries
def to_hash
{
- (name || :non_existent_filter) => {
+ name || :non_existent_filter => {
operator:,
values:
}
diff --git a/app/models/queries/filters/shared/custom_field_filter.rb b/app/models/queries/filters/shared/custom_field_filter.rb
index 3df07a2d873..762234a142f 100644
--- a/app/models/queries/filters/shared/custom_field_filter.rb
+++ b/app/models/queries/filters/shared/custom_field_filter.rb
@@ -60,19 +60,19 @@ module Queries::Filters::Shared::CustomFieldFilter
##
# Create a filter instance for the given custom field accessor
- def create!(name:, **options)
+ def create!(name:, **)
custom_field = find_by_accessor(name)
raise ::Queries::Filters::InvalidError if custom_field.nil?
- from_custom_field!(custom_field:, **options)
+ from_custom_field!(custom_field:, **)
end
##
# Create a filter instance for the given custom field
- def from_custom_field!(custom_field:, **options)
+ def from_custom_field!(custom_field:, **)
constant_name = subfilter_module(custom_field)
clazz = "::Queries::Filters::Shared::CustomFields::#{constant_name}".constantize
- clazz.create!(custom_field:, custom_field_context:, **options)
+ clazz.create!(custom_field:, custom_field_context:, **)
rescue NameError => e
Rails.logger.error "Failed to constantize custom field filter for #{name}. #{e}"
raise ::Queries::Filters::InvalidError
diff --git a/app/models/queries/filters/shared/custom_fields/base.rb b/app/models/queries/filters/shared/custom_fields/base.rb
index ca575c18c8c..7f0faf751aa 100644
--- a/app/models/queries/filters/shared/custom_fields/base.rb
+++ b/app/models/queries/filters/shared/custom_fields/base.rb
@@ -42,8 +42,8 @@ module Queries::Filters::Shared
super(name, options)
end
- def self.create!(custom_field:, custom_field_context:, **options)
- new(custom_field:, custom_field_context:, **options)
+ def self.create!(custom_field:, custom_field_context:, **)
+ new(custom_field:, custom_field_context:, **)
end
def project
diff --git a/app/models/queries/work_packages/columns/manual_sorting_column.rb b/app/models/queries/work_packages/columns/manual_sorting_column.rb
index 0a5e6d19f18..33cae657a48 100644
--- a/app/models/queries/work_packages/columns/manual_sorting_column.rb
+++ b/app/models/queries/work_packages/columns/manual_sorting_column.rb
@@ -30,10 +30,10 @@ class Queries::WorkPackages::Columns::ManualSortingColumn < Queries::WorkPackage
include ::Queries::WorkPackages::Common::ManualSorting
def initialize
- super :manual_sorting,
+ super(:manual_sorting,
default_order: 'asc',
displayable: false,
- sortable: "#{OrderedWorkPackage.table_name}.position NULLS LAST, #{WorkPackage.table_name}.id"
+ sortable: "#{OrderedWorkPackage.table_name}.position NULLS LAST, #{WorkPackage.table_name}.id")
end
def sortable_join_statement(query)
diff --git a/app/models/queries/work_packages/columns/relation_of_type_column.rb b/app/models/queries/work_packages/columns/relation_of_type_column.rb
index 12dd8fa1daa..d9e1055e96c 100644
--- a/app/models/queries/work_packages/columns/relation_of_type_column.rb
+++ b/app/models/queries/work_packages/columns/relation_of_type_column.rb
@@ -34,7 +34,7 @@ class Queries::WorkPackages::Columns::RelationOfTypeColumn < Queries::WorkPackag
end
def name
- "relations_of_type_#{type[:sym]}".to_sym
+ :"relations_of_type_#{type[:sym]}"
end
def sym
diff --git a/app/models/queries/work_packages/columns/relation_to_type_column.rb b/app/models/queries/work_packages/columns/relation_to_type_column.rb
index 1b4776812ab..60a714f92cd 100644
--- a/app/models/queries/work_packages/columns/relation_to_type_column.rb
+++ b/app/models/queries/work_packages/columns/relation_to_type_column.rb
@@ -35,7 +35,7 @@ class Queries::WorkPackages::Columns::RelationToTypeColumn < Queries::WorkPackag
end
def set_name!(type)
- self.name = "relations_to_type_#{type.id}".to_sym
+ self.name = :"relations_to_type_#{type.id}"
end
def caption
diff --git a/app/models/queries/work_packages/filter/category_filter.rb b/app/models/queries/work_packages/filter/category_filter.rb
index ad2f5464329..fede1f83805 100644
--- a/app/models/queries/work_packages/filter/category_filter.rb
+++ b/app/models/queries/work_packages/filter/category_filter.rb
@@ -49,7 +49,6 @@ class Queries::WorkPackages::Filter::CategoryFilter <
values
.filter_map { |category_id| available_categories[category_id.to_i] }
-
end
def ar_object_filter?
diff --git a/app/models/queries/work_packages/filter/group_filter.rb b/app/models/queries/work_packages/filter/group_filter.rb
index d95a6a93d71..9900c0ba25b 100644
--- a/app/models/queries/work_packages/filter/group_filter.rb
+++ b/app/models/queries/work_packages/filter/group_filter.rb
@@ -56,7 +56,6 @@ class Queries::WorkPackages::Filter::GroupFilter < Queries::WorkPackages::Filter
values
.filter_map { |group_id| available_groups[group_id.to_i] }
-
end
def where
diff --git a/app/models/queries/work_packages/filter/priority_filter.rb b/app/models/queries/work_packages/filter/priority_filter.rb
index 28d806c165b..e2cc9836291 100644
--- a/app/models/queries/work_packages/filter/priority_filter.rb
+++ b/app/models/queries/work_packages/filter/priority_filter.rb
@@ -53,7 +53,6 @@ class Queries::WorkPackages::Filter::PriorityFilter <
values
.filter_map { |priority_id| available_priorities[priority_id.to_i] }
-
end
private
diff --git a/app/models/queries/work_packages/filter/status_filter.rb b/app/models/queries/work_packages/filter/status_filter.rb
index 68c8d38b7c3..71e0ce4b9cc 100644
--- a/app/models/queries/work_packages/filter/status_filter.rb
+++ b/app/models/queries/work_packages/filter/status_filter.rb
@@ -54,7 +54,6 @@ class Queries::WorkPackages::Filter::StatusFilter < Queries::WorkPackages::Filte
def value_objects
values
.filter_map { |status_id| all_statuses[status_id.to_i] }
-
end
def allowed_objects
diff --git a/app/models/queries/work_packages/filter/subproject_filter.rb b/app/models/queries/work_packages/filter/subproject_filter.rb
index c90d54ec86d..5be76d0f343 100644
--- a/app/models/queries/work_packages/filter/subproject_filter.rb
+++ b/app/models/queries/work_packages/filter/subproject_filter.rb
@@ -63,7 +63,6 @@ class Queries::WorkPackages::Filter::SubprojectFilter <
values
.filter_map { |subproject_id| available_subprojects[subproject_id.to_i] }
-
end
def where
diff --git a/app/models/queries/work_packages/filter/type_filter.rb b/app/models/queries/work_packages/filter/type_filter.rb
index 5716fd00466..9d1e10beb9e 100644
--- a/app/models/queries/work_packages/filter/type_filter.rb
+++ b/app/models/queries/work_packages/filter/type_filter.rb
@@ -53,7 +53,6 @@ class Queries::WorkPackages::Filter::TypeFilter <
values
.filter_map { |type_id| available_types[type_id.to_i] }
-
end
private
diff --git a/app/models/queries/work_packages/filter/version_filter.rb b/app/models/queries/work_packages/filter/version_filter.rb
index a1b65904e83..7bbce13d97c 100644
--- a/app/models/queries/work_packages/filter/version_filter.rb
+++ b/app/models/queries/work_packages/filter/version_filter.rb
@@ -54,7 +54,6 @@ class Queries::WorkPackages::Filter::VersionFilter <
values
.filter_map { |version_id| available_versions[version_id.to_i] }
-
end
private
diff --git a/app/models/query/results.rb b/app/models/query/results.rb
index cf1f23890a7..d35e834590d 100644
--- a/app/models/query/results.rb
+++ b/app/models/query/results.rb
@@ -136,7 +136,6 @@ class ::Query::Results
query
.sort_criteria_columns
.filter_map { |column, _direction| column.sortable_join_statement(query) }
-
end
def sort_criteria_array
diff --git a/app/models/query/sort_criteria.rb b/app/models/query/sort_criteria.rb
index f8c86dc8a38..52720b582b5 100644
--- a/app/models/query/sort_criteria.rb
+++ b/app/models/query/sort_criteria.rb
@@ -45,7 +45,6 @@ class ::Query::SortCriteria < SortHelper::SortCriteria
.reject { |column, criterion, _| column.nil? || criterion.nil? }
.map { |column, criterion, order| [column, execute_criterion(criterion), order] }
.filter_map { |column, criterion, order| append_order(column, Array(criterion), order) }
-
end
private
diff --git a/app/models/relation.rb b/app/models/relation.rb
index 24299adeca5..cfd1d28845c 100644
--- a/app/models/relation.rb
+++ b/app/models/relation.rb
@@ -154,7 +154,7 @@ class Relation < ApplicationRecord
end
TYPES.each_key do |type|
- define_method "#{type}?" do
+ define_method :"#{type}?" do
canonical_type == self.class.canonical_type(type)
end
end
diff --git a/app/models/setting.rb b/app/models/setting.rb
index acc1d1275df..a72883ab72f 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -116,11 +116,11 @@ class Setting < ApplicationRecord
class_eval src, __FILE__, __LINE__
end
- def method_missing(method, *args, &)
+ def method_missing(method, *, &)
if exists?(accessor_base_name(method))
create_setting_accessors(accessor_base_name(method))
- send(method, *args)
+ send(method, *)
else
super
end
diff --git a/app/models/timestamp.rb b/app/models/timestamp.rb
index 4962ff681b3..604f6007fac 100644
--- a/app/models/timestamp.rb
+++ b/app/models/timestamp.rb
@@ -38,7 +38,7 @@ class Timestamp
DATE_KEYWORD_REGEX =
%r{
- ^(?:#{ALLOWED_DATE_KEYWORDS.join("|")}) # match the relative date keyword
+ ^(?:#{ALLOWED_DATE_KEYWORDS.join('|')}) # match the relative date keyword
@(?:([0-1]?[0-9]|2[0-3]):[0-5]?[0-9]) # match the hour part
[+-](?:([0-1]?[0-9]|2[0-3]):[0-5]?[0-9])$ # match the timezone offset
}x
diff --git a/app/models/type/attribute_groups.rb b/app/models/type/attribute_groups.rb
index 0edc6787cda..739924546b9 100644
--- a/app/models/type/attribute_groups.rb
+++ b/app/models/type/attribute_groups.rb
@@ -229,7 +229,6 @@ module Type::AttributeGroups
ids = (old_groups.map(&:last).flatten - new_groups.map(&:last).flatten)
.filter_map { |k| ::Type::QueryGroup.query_attribute_id(k) }
-
Query.where(id: ids).destroy_all
end
diff --git a/app/models/type/query_group.rb b/app/models/type/query_group.rb
index 432e086a622..c5436fc7428 100644
--- a/app/models/type/query_group.rb
+++ b/app/models/type/query_group.rb
@@ -30,11 +30,11 @@ class Type::QueryGroup < Type::FormGroup
MEMBER_PREFIX = 'query_'.freeze
def self.query_attribute?(name)
- name.to_s.match?(/#{Type::QueryGroup::MEMBER_PREFIX}(\d+)/)
+ name.to_s.match?(/#{Type::QueryGroup::MEMBER_PREFIX}(\d+)/o)
end
def self.query_attribute_id(name)
- match = name.to_s.match(/#{Type::QueryGroup::MEMBER_PREFIX}(\d+)/)
+ match = name.to_s.match(/#{Type::QueryGroup::MEMBER_PREFIX}(\d+)/o)
match ? match[1] : nil
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 658bf8447ff..bbba1c38f7c 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -366,8 +366,8 @@ class User < Principal
block_threshold = Setting.brute_force_block_after_failed_logins.to_i
return false if block_threshold == 0 # disabled
- (last_failed_login_within_block_time? and
- failed_login_count >= block_threshold)
+ last_failed_login_within_block_time? and
+ failed_login_count >= block_threshold
end
def log_failed_login
diff --git a/app/models/users/permission_checks.rb b/app/models/users/permission_checks.rb
index ddbc1ca1aaf..47a76e08ddb 100644
--- a/app/models/users/permission_checks.rb
+++ b/app/models/users/permission_checks.rb
@@ -38,11 +38,11 @@ module Users::PermissionChecks
entity_name_underscored = entity_model_name.underscore
entity_class = entity_model_name.constantize
- define_method "allowed_in_#{entity_name_underscored}?" do |permission, entity|
+ define_method :"allowed_in_#{entity_name_underscored}?" do |permission, entity|
allowed_in_entity?(permission, entity, entity_class)
end
- define_method "allowed_in_any_#{entity_name_underscored}?" do |permission, in_project: nil|
+ define_method :"allowed_in_any_#{entity_name_underscored}?" do |permission, in_project: nil|
allowed_in_any_entity?(permission, entity_class, in_project:)
end
end
diff --git a/app/models/work_package/ask_before_destruction.rb b/app/models/work_package/ask_before_destruction.rb
index 1d37487f4aa..ce9c4f861e3 100644
--- a/app/models/work_package/ask_before_destruction.rb
+++ b/app/models/work_package/ask_before_destruction.rb
@@ -45,9 +45,9 @@ module WorkPackage::AskBeforeDestruction
def cleanup_associated_before_destructing_if_required(work_packages, user, to_do = { action: 'destroy' })
cleanup_required = cleanup_action_required_before_destructing?(work_packages)
- (!cleanup_required ||
+ !cleanup_required ||
(cleanup_required &&
- cleanup_each_associated_class(work_packages, user, to_do)))
+ cleanup_each_associated_class(work_packages, user, to_do))
end
def associated_classes_to_address_before_destruction_of(work_packages)
diff --git a/app/models/work_package/exports/formatters/spent_units.rb b/app/models/work_package/exports/formatters/spent_units.rb
index ca3104c3dc8..df7f05fb373 100644
--- a/app/models/work_package/exports/formatters/spent_units.rb
+++ b/app/models/work_package/exports/formatters/spent_units.rb
@@ -37,7 +37,8 @@ module WorkPackage::Exports
values = cost_helper.summarized_cost_entries.map do |kvp|
cost_type = kvp[0]
volume = kvp[1]
- type_unit = volume.to_d == 1.0.to_d ? cost_type.unit : cost_type.unit_plural
+ BigDecimal('1.0')
+ type_unit = volume.to_d == BigDecimal('1.0') ? cost_type.unit : cost_type.unit_plural
"#{volume} #{type_unit}"
end
return nil if values.empty?
diff --git a/app/models/work_package/pdf_export/common.rb b/app/models/work_package/pdf_export/common.rb
index 76eb03b75fa..54c9d44073b 100644
--- a/app/models/work_package/pdf_export/common.rb
+++ b/app/models/work_package/pdf_export/common.rb
@@ -141,7 +141,7 @@ module WorkPackage::PDFExport::Common
def draw_text_multiline_left(text:, text_style:, max_left:, top:, max_lines:)
lines = wrap_to_lines(text, max_left - pdf.bounds.left, text_style, max_lines)
starting_position = top
- lines.reverse.each do |line|
+ lines.reverse_each do |line|
starting_position += draw_text_multiline_part(line, text_style, pdf.bounds.left, starting_position)
end
end
@@ -149,7 +149,7 @@ module WorkPackage::PDFExport::Common
def draw_text_multiline_right(text:, text_style:, max_left:, top:, max_lines:)
lines = wrap_to_lines(text, pdf.bounds.right - max_left, text_style, max_lines)
starting_position = top
- lines.reverse.each do |line|
+ lines.reverse_each do |line|
line_width = measure_text_width(line, text_style)
line_x = pdf.bounds.right - line_width
starting_position += draw_text_multiline_part(line, text_style, line_x, starting_position)
diff --git a/app/models/work_package/pdf_export/style.rb b/app/models/work_package/pdf_export/style.rb
index 6c3cd46aeb2..00a0764178b 100644
--- a/app/models/work_package/pdf_export/style.rb
+++ b/app/models/work_package/pdf_export/style.rb
@@ -147,7 +147,7 @@ module WorkPackage::PDFExport::Style
def toc_item(level)
resolve_font(@styles.dig(:toc, :item)).merge(
- resolve_font(@styles.dig(:toc, "item_level_#{level}".to_sym))
+ resolve_font(@styles.dig(:toc, :"item_level_#{level}"))
)
end
@@ -157,7 +157,7 @@ module WorkPackage::PDFExport::Style
def toc_item_margins(level)
resolve_margin(@styles.dig(:toc, :item)).merge(
- resolve_margin(@styles.dig(:toc, "item_level_#{level}".to_sym))
+ resolve_margin(@styles.dig(:toc, :"item_level_#{level}"))
)
end
@@ -167,7 +167,7 @@ module WorkPackage::PDFExport::Style
def wp_subject(level)
resolve_font(@styles.dig(:work_package, :subject)).merge(
- resolve_font(@styles.dig(:work_package, "subject_level_#{level}".to_sym))
+ resolve_font(@styles.dig(:work_package, :"subject_level_#{level}"))
)
end
diff --git a/app/models/work_package/pdf_export/sums_table.rb b/app/models/work_package/pdf_export/sums_table.rb
index 483ce95cfd8..b3556c8ea6d 100644
--- a/app/models/work_package/pdf_export/sums_table.rb
+++ b/app/models/work_package/pdf_export/sums_table.rb
@@ -27,7 +27,7 @@
#++
module WorkPackage::PDFExport::SumsTable
- def write_work_packages_sums!(work_packages)
+ def write_work_packages_sums!(_work_packages)
return unless has_summable_column?
write_optional_page_break
diff --git a/app/seeders/demo_data/overview_seeder.rb b/app/seeders/demo_data/overview_seeder.rb
index 3b8be1ed1f9..23153c03555 100644
--- a/app/seeders/demo_data/overview_seeder.rb
+++ b/app/seeders/demo_data/overview_seeder.rb
@@ -73,7 +73,7 @@ module DemoData
end
end
- def query_id_references(overview, widget_options)
+ def query_id_references(_overview, widget_options)
if widget_options && widget_options['queryId']
widget_options['queryId'] = with_references(widget_options['queryId'])
end
diff --git a/app/seeders/demo_data/project_seeder.rb b/app/seeders/demo_data/project_seeder.rb
index 8b154c6a006..4c193ab4fc9 100644
--- a/app/seeders/demo_data/project_seeder.rb
+++ b/app/seeders/demo_data/project_seeder.rb
@@ -56,7 +56,7 @@ module DemoData
DemoData::WorkPackageSeeder,
DemoData::WorkPackageBoardSeeder,
::Meetings::DemoData::MeetingSeeder,
- ::Meetings::DemoData::MeetingAgendaItemsSeeder,
+ ::Meetings::DemoData::MeetingAgendaItemsSeeder
]
end
diff --git a/app/services/attachments/set_attributes_service.rb b/app/services/attachments/set_attributes_service.rb
index 7077ff446b3..99c7360cbab 100644
--- a/app/services/attachments/set_attributes_service.rb
+++ b/app/services/attachments/set_attributes_service.rb
@@ -31,7 +31,7 @@ module Attachments
def set_attributes(params)
# Don't set the content type manually,
# we always want to infer it
- super params.except :content_type
+ super(params.except :content_type)
end
def set_default_attributes(_params)
diff --git a/app/services/authentication/omniauth_service.rb b/app/services/authentication/omniauth_service.rb
index 3be8c4217a9..88f987cb1a0 100644
--- a/app/services/authentication/omniauth_service.rb
+++ b/app/services/authentication/omniauth_service.rb
@@ -252,7 +252,7 @@ module Authentication
mail: info[:email],
firstname: info[:first_name] || info[:name],
lastname: info[:last_name],
- identity_url: identity_url_from_omniauth,
+ identity_url: identity_url_from_omniauth
}
# Map the admin attribute if provided in an attribute mapping
@@ -284,7 +284,7 @@ module Authentication
##
# Try to provide some context of the auth_hash in case of errors
def auth_uid
- hash = (auth_hash || {})
+ hash = auth_hash || {}
hash.dig(:info, :uid) || hash.dig(:uid) || 'unknown'
end
end
diff --git a/app/services/authorization/query_transformation.rb b/app/services/authorization/query_transformation.rb
index 0564a718ebb..6b1c9268826 100644
--- a/app/services/authorization/query_transformation.rb
+++ b/app/services/authorization/query_transformation.rb
@@ -42,7 +42,7 @@ class Authorization::QueryTransformation
self.block = block
end
- def apply(*args)
- block.call(*args)
+ def apply(*)
+ block.call(*)
end
end
diff --git a/app/services/backups/create_service.rb b/app/services/backups/create_service.rb
index bac02942b39..99fd19218c2 100644
--- a/app/services/backups/create_service.rb
+++ b/app/services/backups/create_service.rb
@@ -29,7 +29,7 @@
module Backups
class CreateService < ::BaseServices::Create
def initialize(user:, backup_token:, include_attachments: true, contract_class: ::Backups::CreateContract)
- super user:, contract_class:, contract_options: { backup_token: }
+ super(user:, contract_class:, contract_options: { backup_token: })
@include_attachments = include_attachments
end
diff --git a/app/services/create_type_service.rb b/app/services/create_type_service.rb
index a9614cf1f50..1a7a9141c7a 100644
--- a/app/services/create_type_service.rb
+++ b/app/services/create_type_service.rb
@@ -28,7 +28,7 @@
class CreateTypeService < BaseTypeService
def initialize(user)
- super Type.new, user
+ super(Type.new, user)
end
private
diff --git a/app/services/design/update_design_service.rb b/app/services/design/update_design_service.rb
index 3815dd10821..0c55bc5b598 100644
--- a/app/services/design/update_design_service.rb
+++ b/app/services/design/update_design_service.rb
@@ -83,7 +83,7 @@ module Design
end
def custom_style
- @custom_style ||= (CustomStyle.current || CustomStyle.create!)
+ @custom_style ||= CustomStyle.current || CustomStyle.create!
end
end
end
diff --git a/app/services/grids/copy_service.rb b/app/services/grids/copy_service.rb
index f71f5cc4f7f..d574e5e536a 100644
--- a/app/services/grids/copy_service.rb
+++ b/app/services/grids/copy_service.rb
@@ -46,7 +46,7 @@ module Grids
end
def initialize(user:, source:, contract_class: ::EmptyContract)
- super user:, source:, contract_class:
+ super(user:, source:, contract_class:)
end
protected
diff --git a/app/services/groups/add_users_service.rb b/app/services/groups/add_users_service.rb
index 8f60350ba5c..7614a321c17 100644
--- a/app/services/groups/add_users_service.rb
+++ b/app/services/groups/add_users_service.rb
@@ -33,8 +33,8 @@ module Groups
def initialize(group, current_user:, contract_class: AdminOnlyContract)
self.model = group
- super user: current_user,
- contract_class:
+ super(user: current_user,
+ contract_class:)
end
private
diff --git a/app/services/groups/cleanup_inherited_roles_service.rb b/app/services/groups/cleanup_inherited_roles_service.rb
index 96113812eed..b10cb44ad7c 100644
--- a/app/services/groups/cleanup_inherited_roles_service.rb
+++ b/app/services/groups/cleanup_inherited_roles_service.rb
@@ -40,8 +40,8 @@ module Groups
def initialize(group, current_user:, contract_class: AdminOnlyContract)
self.model = group
- super user: current_user,
- contract_class:
+ super(user: current_user,
+ contract_class:)
end
private
diff --git a/app/services/groups/create_inherited_roles_service.rb b/app/services/groups/create_inherited_roles_service.rb
index d8652e808f3..0f51b81bef3 100644
--- a/app/services/groups/create_inherited_roles_service.rb
+++ b/app/services/groups/create_inherited_roles_service.rb
@@ -36,8 +36,8 @@ module Groups
def initialize(group, current_user:, contract_class: AdminOnlyContract)
self.model = group
- super user: current_user,
- contract_class:
+ super(user: current_user,
+ contract_class:)
end
private
diff --git a/app/services/groups/update_roles_service.rb b/app/services/groups/update_roles_service.rb
index 6ca419d37c2..b14eab5abbf 100644
--- a/app/services/groups/update_roles_service.rb
+++ b/app/services/groups/update_roles_service.rb
@@ -35,8 +35,8 @@ module Groups
def initialize(group, current_user:, contract_class: AdminOnlyContract)
self.model = group
- super user: current_user,
- contract_class:
+ super(user: current_user,
+ contract_class:)
end
private
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rb
index 07220d620e2..59d3286f068 100644
--- a/app/services/journals/create_service.rb
+++ b/app/services/journals/create_service.rb
@@ -254,9 +254,9 @@ module Journals
def association_modifications_sql(association, predecessor)
<<~SQL
cleanup_predecessor_#{association} AS (
- #{send("cleanup_predecessor_#{association}", predecessor)}
+ #{send(:"cleanup_predecessor_#{association}", predecessor)}
), insert_#{association} AS (
- #{send("insert_#{association}_sql")}
+ #{send(:"insert_#{association}_sql")}
)
SQL
end
diff --git a/app/services/notifications/create_from_model_service.rb b/app/services/notifications/create_from_model_service.rb
index f5fe42869f8..9713bd1cded 100644
--- a/app/services/notifications/create_from_model_service.rb
+++ b/app/services/notifications/create_from_model_service.rb
@@ -345,7 +345,7 @@ class Notifications::CreateFromModelService
end
def strategy
- @strategy ||= if self.class.const_defined?("#{resource.class}Strategy")
+ @strategy ||= if self.class.const_defined?(:"#{resource.class}Strategy")
"#{self.class}::#{resource.class}Strategy".constantize
end
end
diff --git a/app/services/notifications/mail_service.rb b/app/services/notifications/mail_service.rb
index 2bd1eb39d4c..bf9d5cf89b2 100644
--- a/app/services/notifications/mail_service.rb
+++ b/app/services/notifications/mail_service.rb
@@ -52,7 +52,7 @@ module Notifications
end
def strategy
- @strategy ||= if self.class.const_defined?("#{strategy_model}Strategy")
+ @strategy ||= if self.class.const_defined?(:"#{strategy_model}Strategy")
"#{self.class}::#{strategy_model}Strategy".constantize
end
end
diff --git a/app/services/principals/replace_references_service.rb b/app/services/principals/replace_references_service.rb
index 72f3af41a25..e7846ec00a7 100644
--- a/app/services/principals/replace_references_service.rb
+++ b/app/services/principals/replace_references_service.rb
@@ -86,8 +86,7 @@ module Principals
Budget,
MeetingAgenda,
MeetingMinutes,
- MeetingAgendaItem
- ].each do |klass|
+ MeetingAgendaItem].each do |klass|
rewrite(klass, :author_id, from, to)
end
end
diff --git a/app/services/settings/update_service.rb b/app/services/settings/update_service.rb
index 364fe7c8462..617aa26ed1c 100644
--- a/app/services/settings/update_service.rb
+++ b/app/services/settings/update_service.rb
@@ -28,8 +28,8 @@
class Settings::UpdateService < BaseServices::BaseContracted
def initialize(user:)
- super user:,
- contract_class: Settings::UpdateContract
+ super(user:,
+ contract_class: Settings::UpdateContract)
end
def persist(call)
diff --git a/app/services/work_packages/update_ancestors/loader.rb b/app/services/work_packages/update_ancestors/loader.rb
index 6e745869763..ce4aa638a27 100644
--- a/app/services/work_packages/update_ancestors/loader.rb
+++ b/app/services/work_packages/update_ancestors/loader.rb
@@ -111,13 +111,13 @@ class WorkPackages::UpdateAncestors::Loader
.send(relation_type)
.where.not(id: queried_work_package.id)
- if send("#{relation_type}_joins")
- scope = scope.joins(send("#{relation_type}_joins"))
+ if send(:"#{relation_type}_joins")
+ scope = scope.joins(send(:"#{relation_type}_joins"))
end
scope
- .pluck(*send("selected_#{relation_type}_attributes"))
- .map { |p| LoaderStruct.new(send("selected_#{relation_type}_attributes").zip(p).to_h) }
+ .pluck(*send(:"selected_#{relation_type}_attributes"))
+ .map { |p| LoaderStruct.new(send(:"selected_#{relation_type}_attributes").zip(p).to_h) }
end
# Returns the current ancestors sorted by distance (called generations in the table)
diff --git a/app/workers/application_job.rb b/app/workers/application_job.rb
index 579d7df009b..de6bccc0067 100644
--- a/app/workers/application_job.rb
+++ b/app/workers/application_job.rb
@@ -59,9 +59,9 @@ class ApplicationJob < ActiveJob::Base
def self.queue_with_priority(value = :default)
if value.is_a?(Symbol)
- super priority_number(value)
+ super(priority_number(value))
else
- super value
+ super(value)
end
end
diff --git a/app/workers/concerns/state_machine_job.rb b/app/workers/concerns/state_machine_job.rb
index b47c8fac6fc..65867fc2fb5 100644
--- a/app/workers/concerns/state_machine_job.rb
+++ b/app/workers/concerns/state_machine_job.rb
@@ -35,8 +35,8 @@ module StateMachineJob
extend ActiveSupport::Concern
included do
- def perform(state, *args)
- results = instance_exec(*args, &states[state][:block])
+ def perform(state, *)
+ results = instance_exec(*, &states[state][:block])
to = states[state][:to]
diff --git a/app/workers/cron/clear_old_sessions_job.rb b/app/workers/cron/clear_old_sessions_job.rb
index 5e342e7042f..e53494d626d 100644
--- a/app/workers/cron/clear_old_sessions_job.rb
+++ b/app/workers/cron/clear_old_sessions_job.rb
@@ -34,7 +34,7 @@ module Cron
self.cron_expression = '15 1 * * *'
def perform
- super 'db:sessions:expire', 7
+ super('db:sessions:expire', 7)
end
end
end
diff --git a/app/workers/cron/clear_tmp_cache_job.rb b/app/workers/cron/clear_tmp_cache_job.rb
index 9f0840eeec5..8ac9a6c2101 100644
--- a/app/workers/cron/clear_tmp_cache_job.rb
+++ b/app/workers/cron/clear_tmp_cache_job.rb
@@ -34,7 +34,7 @@ module Cron
self.cron_expression = '45 2 * * 7'
def perform
- super 'tmp:cache:clear'
+ super('tmp:cache:clear')
end
end
end
diff --git a/app/workers/cron/clear_uploaded_files_job.rb b/app/workers/cron/clear_uploaded_files_job.rb
index c75e0bdb781..458615f98b0 100644
--- a/app/workers/cron/clear_uploaded_files_job.rb
+++ b/app/workers/cron/clear_uploaded_files_job.rb
@@ -34,7 +34,7 @@ module Cron
self.cron_expression = '0 23 * * 5'
def perform
- super 'attachments:clear'
+ super('attachments:clear')
end
end
end
diff --git a/app/workers/oauth/cleanup_job.rb b/app/workers/oauth/cleanup_job.rb
index 67217683624..3295cb0e82b 100644
--- a/app/workers/oauth/cleanup_job.rb
+++ b/app/workers/oauth/cleanup_job.rb
@@ -36,7 +36,7 @@ module OAuth
queue_with_priority :low
def perform
- super 'doorkeeper:db:cleanup'
+ super('doorkeeper:db:cleanup')
end
end
end
diff --git a/app/workers/scm/create_local_repository_job.rb b/app/workers/scm/create_local_repository_job.rb
index 0ff84a93323..3ccdb62a9a3 100644
--- a/app/workers/scm/create_local_repository_job.rb
+++ b/app/workers/scm/create_local_repository_job.rb
@@ -49,7 +49,7 @@ class SCM::CreateLocalRepositoryJob < ApplicationJob
self.class.ensure_not_existing!(repository)
# Create the repository locally.
- mode = (config[:mode] || default_mode)
+ mode = config[:mode] || default_mode
# Ensure that chmod receives an octal number
unless mode.is_a? Integer
diff --git a/config.ru b/config.ru
index d66538f6777..cc50ba9210c 100644
--- a/config.ru
+++ b/config.ru
@@ -28,7 +28,7 @@
# This file is used by Rack-based servers to start the application.
-require ::File.expand_path('config/environment', __dir__)
+require File.expand_path('config/environment', __dir__)
subdir = OpenProject::Configuration.rails_relative_url_root.presence
diff --git a/config/application.rb b/config/application.rb
index dc8bdc92f92..506f69ce468 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -141,7 +141,7 @@ module OpenProject
# config.time_zone = 'Central Time (US & Canada)'
# Add locales from crowdin translations to i18n
- config.i18n.load_path += Dir[Rails.root.join('config', 'locales', 'crowdin', '*.{rb,yml}').to_s]
+ config.i18n.load_path += Dir[Rails.root.join("config/locales/crowdin/*.{rb,yml}").to_s]
config.i18n.default_locale = :en
# Fall back to default locale
diff --git a/config/boot.rb b/config/boot.rb
index da121bbf707..6067c79b275 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -36,7 +36,7 @@ end
require 'bundler/setup' # Set up gems listed in the Gemfile.
-env = ENV['RAILS_ENV']
+env = ENV.fetch('RAILS_ENV', nil)
# Disable deprecation warnings early on (before loading gems), which behaves as RUBYOPT="-w0"
# to disable the Ruby warnings in production.
# Set OPENPROJECT_PROD_DEPRECATIONS=true if you want to see them for debugging purposes
diff --git a/config/constants/open_project/activity.rb b/config/constants/open_project/activity.rb
index 30a78dd09f9..3d79eff7d60 100644
--- a/config/constants/open_project/activity.rb
+++ b/config/constants/open_project/activity.rb
@@ -41,7 +41,7 @@ module OpenProject
@providers ||= Hash.new { |h, k| h[k] = Set.new }
end
- def map(&_block)
+ def map(&)
yield self
end
diff --git a/config/constants/open_project/null_db_fallback.rb b/config/constants/open_project/null_db_fallback.rb
index 170849f1e96..37dad4e11e7 100644
--- a/config/constants/open_project/null_db_fallback.rb
+++ b/config/constants/open_project/null_db_fallback.rb
@@ -60,7 +60,7 @@ module OpenProject
end
def database_config
- YAML.load_file(File.join(Rails.root, "config", "database.yml"))[Rails.env]
+ YAML.load_file(Rails.root.join("config/database.yml").to_s)[Rails.env]
end
end
end
diff --git a/config/constants/settings/definition.rb b/config/constants/settings/definition.rb
index 7c018f92c15..cee3f2cef0a 100644
--- a/config/constants/settings/definition.rb
+++ b/config/constants/settings/definition.rb
@@ -206,13 +206,13 @@ module Settings
description: 'The memcache server host and IP',
format: :string,
default: nil,
- writable: false,
+ writable: false
},
cache_redis_url: {
description: 'URL to the redis cache server',
format: :string,
default: nil,
- writable: false,
+ writable: false
},
cache_namespace: {
format: :string,
@@ -896,7 +896,7 @@ module Settings
},
show_product_version: {
description: 'Show product version information in the administration section',
- default: true,
+ default: true
},
show_pending_migrations_warning: {
description: 'Enable or disable warning bar in case of pending migrations',
diff --git a/config/constants/views.rb b/config/constants/views.rb
index b2f32b8c27e..e44ad504f6c 100644
--- a/config/constants/views.rb
+++ b/config/constants/views.rb
@@ -33,7 +33,7 @@ module Constants
contract_strategy: nil)
@registered ||= {}
- @registered[canonical_type(type)] = { contract_strategy: contract_strategy }
+ @registered[canonical_type(type)] = { contract_strategy: }
end
def registered_types
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 955e37fff49..547b9477922 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -87,4 +87,4 @@ OpenProject::Application.configure do
end
end
-ActiveRecord::Base.logger = ActiveSupport::Logger.new($stdout) unless String(ENV["SILENCE_SQL_LOGS"]).to_bool
+ActiveRecord::Base.logger = ActiveSupport::Logger.new($stdout) unless String(ENV.fetch("SILENCE_SQL_LOGS", nil)).to_bool
diff --git a/config/initializers/appsignal.rb b/config/initializers/appsignal.rb
index fef458a86fb..1706ad12e2e 100644
--- a/config/initializers/appsignal.rb
+++ b/config/initializers/appsignal.rb
@@ -41,8 +41,8 @@ if OpenProject::Appsignal.enabled?
)
# Extend the core log delegator
- handler = ::OpenProject::Appsignal.method(:exception_handler)
- ::OpenProject::Logging::LogDelegator.register(:appsignal, handler)
+ handler = OpenProject::Appsignal.method(:exception_handler)
+ OpenProject::Logging::LogDelegator.register(:appsignal, handler)
Appsignal.start
end
diff --git a/config/initializers/delayed_job_config.rb b/config/initializers/delayed_job_config.rb
index c2f89eb5ec9..89c3af7505c 100644
--- a/config/initializers/delayed_job_config.rb
+++ b/config/initializers/delayed_job_config.rb
@@ -36,7 +36,7 @@ Delayed::Worker.delay_jobs = true
Rails.application.reloader.to_prepare do
# Set default priority (lower = higher priority)
# Example ordering, see ApplicationJob.priority_number
- Delayed::Worker.default_priority = ::ApplicationJob.priority_number(:default)
+ Delayed::Worker.default_priority = ApplicationJob.priority_number(:default)
end
# Do not retry jobs from delayed_job
diff --git a/config/initializers/doorkeeper.rb b/config/initializers/doorkeeper.rb
index 910f484973c..7994c3760b3 100644
--- a/config/initializers/doorkeeper.rb
+++ b/config/initializers/doorkeeper.rb
@@ -5,11 +5,7 @@ Doorkeeper.configure do
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
logged_user = session[:user_id] && User.active.find_by(id: session[:user_id])
- if logged_user.present?
- logged_user
- else
- redirect_to(signin_path(back_url: request.fullpath))
- end
+ logged_user.presence || redirect_to(signin_path(back_url: request.fullpath))
end
# If you are planning to use Doorkeeper in Rails 5 API-only application, then you might
diff --git a/config/initializers/log_slow_sql_queries.rb b/config/initializers/log_slow_sql_queries.rb
index 9895ce0bc3e..eadc105cb40 100644
--- a/config/initializers/log_slow_sql_queries.rb
+++ b/config/initializers/log_slow_sql_queries.rb
@@ -17,7 +17,7 @@ OpenProject::Application.configure do
next if duration <= slow_sql_threshold
payload = {
- duration: duration,
+ duration:,
time: start.iso8601,
cached: !!data[:cache],
sql: data[:sql]
@@ -25,7 +25,7 @@ OpenProject::Application.configure do
sql_log_string = data[:sql].strip.gsub(/(^(\s+)?$\n)/, "")
OpenProject.logger.warn "Encountered slow SQL (#{payload[:duration]} ms): #{sql_log_string}",
- payload: payload,
+ payload:,
# Hash of the query for reference/fingerprinting
reference: Digest::SHA1.hexdigest(data[:sql])
rescue StandardError => e
diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb
index bd21de8df7b..e5940305614 100644
--- a/config/initializers/lograge.rb
+++ b/config/initializers/lograge.rb
@@ -8,6 +8,6 @@ Rails.application.configure do
# Add custom data to event payload
config.lograge.custom_payload do |controller|
- ::OpenProject::Logging.extend_payload!({}, { controller: controller })
+ OpenProject::Logging.extend_payload!({}, { controller: })
end
end
diff --git a/config/initializers/menus.rb b/config/initializers/menus.rb
index 9fdae477062..cf85369fd00 100644
--- a/config/initializers/menus.rb
+++ b/config/initializers/menus.rb
@@ -37,7 +37,7 @@ Redmine::MenuManager.map :top_menu do |menu|
caption: I18n.t('label_projects_menu'),
icon: 'projects',
if: Proc.new {
- (User.current.logged? || !Setting.login_required?)
+ User.current.logged? || !Setting.login_required?
}
menu.push :activity,
@@ -139,7 +139,7 @@ Redmine::MenuManager.map :global_menu do |menu|
icon: 'projects',
after: :home,
if: Proc.new {
- (User.current.logged? || !Setting.login_required?)
+ User.current.logged? || !Setting.login_required?
}
menu.push :projects_query_select,
diff --git a/config/initializers/plaintext.rb b/config/initializers/plaintext.rb
index 404b3225e93..67f6e611c87 100644
--- a/config/initializers/plaintext.rb
+++ b/config/initializers/plaintext.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-file_name = File.join([Rails.root.to_s, 'config', 'plaintext.yml'])
+file_name = Rails.root.join.to_s
if File.file?(file_name)
config_file = File.read(file_name)
Plaintext::Configuration.load(config_file)
diff --git a/config/initializers/rack-cors.rb b/config/initializers/rack-cors.rb
index 52ec0201e45..e657fcaa5a8 100644
--- a/config/initializers/rack-cors.rb
+++ b/config/initializers/rack-cors.rb
@@ -27,17 +27,17 @@
#++
Rails.application.config.middleware.insert_after Rails::Rack::Logger, Rack::Cors do
allow do
- origins { |source, _env| ::API::V3::CORS.allowed?(source) }
+ origins { |source, _env| API::V3::CORS.allowed?(source) }
resource '/api/v3*',
headers: :any,
methods: :any,
credentials: true,
- if: proc { ::API::V3::CORS.enabled? }
+ if: proc { API::V3::CORS.enabled? }
resource '/oauth/*',
headers: :any,
methods: :any,
credentials: true,
- if: proc { ::API::V3::CORS.enabled? }
+ if: proc { API::V3::CORS.enabled? }
end
end
diff --git a/config/initializers/rack_timeout.rb b/config/initializers/rack_timeout.rb
index 46cf2aae153..b6bd86e773a 100644
--- a/config/initializers/rack_timeout.rb
+++ b/config/initializers/rack_timeout.rb
@@ -7,10 +7,10 @@ if OpenProject::Configuration.web_workers >= 2
Rails.logger.debug { "Enabling Rack::Timeout (service=#{service_timeout}s wait=#{wait_timeout}s)" }
Rails.application.config.middleware.insert_before(
- ::Rack::Runtime,
- ::Rack::Timeout,
- service_timeout: service_timeout, # time after which a request being served times out
- wait_timeout: wait_timeout, # time after which a request waiting to be served times out
+ Rack::Runtime,
+ Rack::Timeout,
+ service_timeout:, # time after which a request being served times out
+ wait_timeout:, # time after which a request waiting to be served times out
term_on_timeout: 1, # shut down worker (gracefully) right away on timeout to be restarted
service_past_wait: true # Treat the service timeout as independent from the wait timeout
)
@@ -23,7 +23,7 @@ if OpenProject::Configuration.web_workers >= 2
details = env[Rack::Timeout::ENV_INFO_KEY]
if details.state == :timed_out && details.wait.present?
- ::OpenProject.logger.error "Request timed out waiting to be served!"
+ OpenProject.logger.error "Request timed out waiting to be served!"
end
end
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 31761c649fa..af35f8a1b70 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -44,7 +44,7 @@ Rails.application.reloader.to_prepare do
##
# We use our own decorated session model to note the user_id
# for each session.
- ActionDispatch::Session::ActiveRecordStore.session_class = ::Sessions::SqlBypass
+ ActionDispatch::Session::ActiveRecordStore.session_class = Sessions::SqlBypass
# Continue to use marshal serialization to retain symbols and whatnot
ActiveRecord::SessionStore::Session.serializer = :marshal
end
diff --git a/db/migrate/10000000000000_to_v710_aggregated_migrations.rb b/db/migrate/10000000000000_to_v710_aggregated_migrations.rb
index 6bf2667431b..544e6585d42 100644
--- a/db/migrate/10000000000000_to_v710_aggregated_migrations.rb
+++ b/db/migrate/10000000000000_to_v710_aggregated_migrations.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-Dir["#{Rails.root}/db/migrate/tables/*.rb"].each { |file| require file }
-Dir["#{Rails.root}/db/migrate/aggregated/*.rb"].each { |file| require file }
+Dir["#{Rails.root.join('db/migrate/tables/*.rb')}"].each { |file| require file }
+Dir["#{Rails.root.join('db/migrate/aggregated/*.rb')}"].each { |file| require file }
# This migration aggregates a set of former migrations
class ToV710AggregatedMigrations < ActiveRecord::Migration[5.1]
diff --git a/db/migrate/20100528100562_aggregated_global_roles_migrations.rb b/db/migrate/20100528100562_aggregated_global_roles_migrations.rb
index 2f3dcc67bf0..022ab3c1999 100644
--- a/db/migrate/20100528100562_aggregated_global_roles_migrations.rb
+++ b/db/migrate/20100528100562_aggregated_global_roles_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join('db', 'migrate', 'migration_utils', 'migration_squasher').to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
require 'open_project/plugins/migration_mapping'
# This migration aggregates the migrations detailed in MIGRATION_FILES
class AggregatedGlobalRolesMigrations < ActiveRecord::Migration[5.0]
diff --git a/db/migrate/20180105130053_rebuild_dag.rb b/db/migrate/20180105130053_rebuild_dag.rb
index e9dbfaa0585..c171f29c468 100644
--- a/db/migrate/20180105130053_rebuild_dag.rb
+++ b/db/migrate/20180105130053_rebuild_dag.rb
@@ -25,7 +25,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
require_relative 'migration_utils/typed_dag'
class RebuildDag < ActiveRecord::Migration[5.0]
diff --git a/db/migrate/20190301122554_remove_hierarchy_paths.rb b/db/migrate/20190301122554_remove_hierarchy_paths.rb
index d2476a9f9c9..58a85273784 100644
--- a/db/migrate/20190301122554_remove_hierarchy_paths.rb
+++ b/db/migrate/20190301122554_remove_hierarchy_paths.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './20180116065518_add_hierarchy_paths'
+require_relative '20180116065518_add_hierarchy_paths'
class RemoveHierarchyPaths < ActiveRecord::Migration[5.2]
def up
diff --git a/db/migrate/20190312083304_rename_boards_to_forums.rb b/db/migrate/20190312083304_rename_boards_to_forums.rb
index 365856aac73..046fc6252af 100644
--- a/db/migrate/20190312083304_rename_boards_to_forums.rb
+++ b/db/migrate/20190312083304_rename_boards_to_forums.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './tables/forums'
+require_relative 'tables/forums'
class RenameBoardsToForums < ActiveRecord::Migration[5.2]
def up
diff --git a/db/migrate/20190507132517_add_board_view_to_roles.rb b/db/migrate/20190507132517_add_board_view_to_roles.rb
index e4ca1044a4f..3f7fb964788 100644
--- a/db/migrate/20190507132517_add_board_view_to_roles.rb
+++ b/db/migrate/20190507132517_add_board_view_to_roles.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "#{Rails.root}/db/migrate/migration_utils/permission_adder"
+require "#{Rails.root.join('db/migrate/migration_utils/permission_adder')}"
class AddBoardViewToRoles < ActiveRecord::Migration[5.2]
def up
diff --git a/db/migrate/20190527095959_set_manage_board_permission.rb b/db/migrate/20190527095959_set_manage_board_permission.rb
index 6059f459b55..49a329fdf63 100644
--- a/db/migrate/20190527095959_set_manage_board_permission.rb
+++ b/db/migrate/20190527095959_set_manage_board_permission.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "#{Rails.root}/db/migrate/migration_utils/permission_adder"
+require "#{Rails.root.join('db/migrate/migration_utils/permission_adder')}"
class SetManageBoardPermission < ActiveRecord::Migration[5.2]
def up
diff --git a/db/migrate/20190603060951_set_assign_versions_permission.rb b/db/migrate/20190603060951_set_assign_versions_permission.rb
index 0c20eb48c2a..f862f94f7a2 100644
--- a/db/migrate/20190603060951_set_assign_versions_permission.rb
+++ b/db/migrate/20190603060951_set_assign_versions_permission.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require "#{Rails.root}/db/migrate/migration_utils/permission_adder"
+require "#{Rails.root.join('db/migrate/migration_utils/permission_adder')}"
class SetAssignVersionsPermission < ActiveRecord::Migration[5.2]
def up
diff --git a/db/migrate/20190724093332_add_journal_versions_table.rb b/db/migrate/20190724093332_add_journal_versions_table.rb
index 3d0c9daa150..f9dd416c5c9 100644
--- a/db/migrate/20190724093332_add_journal_versions_table.rb
+++ b/db/migrate/20190724093332_add_journal_versions_table.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
class AddJournalVersionsTable < ActiveRecord::Migration[5.2]
include ::Migration::Utils
diff --git a/db/migrate/20200522140244_remove_journal_versions_table.rb b/db/migrate/20200522140244_remove_journal_versions_table.rb
index 4686d6ffb06..88e5b5f1cc8 100644
--- a/db/migrate/20200522140244_remove_journal_versions_table.rb
+++ b/db/migrate/20200522140244_remove_journal_versions_table.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './20190724093332_add_journal_versions_table'
+require_relative '20190724093332_add_journal_versions_table'
class RemoveJournalVersionsTable < ActiveRecord::Migration[6.0]
def up
diff --git a/db/migrate/20210615150558_aggregate_journals.rb b/db/migrate/20210615150558_aggregate_journals.rb
index b7f33611d39..7f164a71839 100644
--- a/db/migrate/20210615150558_aggregate_journals.rb
+++ b/db/migrate/20210615150558_aggregate_journals.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './20200924085508_cleanup_orphaned_journal_data'
-require_relative './migration_utils/utils'
+require_relative '20200924085508_cleanup_orphaned_journal_data'
+require_relative 'migration_utils/utils'
class AggregateJournals < ActiveRecord::Migration[6.1]
include ::Migration::Utils
diff --git a/db/migrate/20210726070813_remove_journal_versions.rb b/db/migrate/20210726070813_remove_journal_versions.rb
index dabe1124ae3..96d7a52d2d9 100644
--- a/db/migrate/20210726070813_remove_journal_versions.rb
+++ b/db/migrate/20210726070813_remove_journal_versions.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './20190724093332_add_journal_versions_table'
+require_relative '20190724093332_add_journal_versions_table'
# db/migrate/20200522140244_remove_journal_versions_table.rb
# incorrectly removes journal_versions
diff --git a/db/migrate/20210825183540_make_user_preferences_json.rb b/db/migrate/20210825183540_make_user_preferences_json.rb
index 1082dd2e3de..6f30a3b51d5 100644
--- a/db/migrate/20210825183540_make_user_preferences_json.rb
+++ b/db/migrate/20210825183540_make_user_preferences_json.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
class MakeUserPreferencesJson < ActiveRecord::Migration[6.1]
include ::Migration::Utils
diff --git a/db/migrate/20210928133538_add_reminder_workdays.rb b/db/migrate/20210928133538_add_reminder_workdays.rb
index 00914b4afb0..2372fce4de0 100644
--- a/db/migrate/20210928133538_add_reminder_workdays.rb
+++ b/db/migrate/20210928133538_add_reminder_workdays.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
class AddReminderWorkdays < ActiveRecord::Migration[6.1]
include ::Migration::Utils
diff --git a/db/migrate/20211026061420_add_indexes_for_email_reminder_pause.rb b/db/migrate/20211026061420_add_indexes_for_email_reminder_pause.rb
index 634be8c7806..b4116f669fa 100644
--- a/db/migrate/20211026061420_add_indexes_for_email_reminder_pause.rb
+++ b/db/migrate/20211026061420_add_indexes_for_email_reminder_pause.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
class AddIndexesForEmailReminderPause < ActiveRecord::Migration[6.1]
include ::Migration::Utils
diff --git a/db/migrate/20220319211253_add_parent_id_to_wp.rb b/db/migrate/20220319211253_add_parent_id_to_wp.rb
index 7ede7666039..cc235f6d588 100644
--- a/db/migrate/20220319211253_add_parent_id_to_wp.rb
+++ b/db/migrate/20220319211253_add_parent_id_to_wp.rb
@@ -111,7 +111,6 @@ class AddParentIdToWp < ActiveRecord::Migration[6.1]
def add_closure_tree_table
# Copied from closure tree migration
- # rubocop:disable Rails/CreateTableWithTimestamps
create_table :work_package_hierarchies, id: false do |t|
t.integer :ancestor_id, null: false
t.integer :descendant_id, null: false
@@ -125,7 +124,6 @@ class AddParentIdToWp < ActiveRecord::Migration[6.1]
add_index :work_package_hierarchies, [:descendant_id],
name: "work_package_desc_idx"
# End copied from closure tree migration
- # rubocop:enable Rails/CreateTableWithTimestamps
end
# Creates the actual closure tree data.
diff --git a/db/migrate/20220818074150_fix_invalid_journals.rb b/db/migrate/20220818074150_fix_invalid_journals.rb
index 0d3023eccc6..9ddb1868833 100644
--- a/db/migrate/20220818074150_fix_invalid_journals.rb
+++ b/db/migrate/20220818074150_fix_invalid_journals.rb
@@ -65,7 +65,6 @@ class FixInvalidJournals < ActiveRecord::Migration[7.0]
.pluck('DISTINCT(journable_type)')
.compact
.to_h do |journable_type|
-
relation = Journal
.where(journable_type:)
.where.not(data_type: "Journal::#{journable_type}Journal")
diff --git a/db/migrate/20221017073431_remove_orphaned_tokens.rb b/db/migrate/20221017073431_remove_orphaned_tokens.rb
index 03326736293..2b3660562e7 100644
--- a/db/migrate/20221017073431_remove_orphaned_tokens.rb
+++ b/db/migrate/20221017073431_remove_orphaned_tokens.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative "./migration_utils/column"
+require_relative "migration_utils/column"
class RemoveOrphanedTokens < ActiveRecord::Migration[7.0]
def up
diff --git a/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb b/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb
index 81fb3e68e2d..c641d892044 100644
--- a/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb
+++ b/db/migrate/20221026132134_bigint_primary_and_foreign_keys.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative "./migration_utils/column"
+require_relative "migration_utils/column"
class BigintPrimaryAndForeignKeys < ActiveRecord::Migration[7.0]
KEY_CHANGES = {
diff --git a/db/migrate/20230322135932_merge_wiki_content_into_page.rb b/db/migrate/20230322135932_merge_wiki_content_into_page.rb
index 84a68ed5466..d97b2536fab 100644
--- a/db/migrate/20230322135932_merge_wiki_content_into_page.rb
+++ b/db/migrate/20230322135932_merge_wiki_content_into_page.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './migration_utils/utils'
+require_relative 'migration_utils/utils'
class MergeWikiContentIntoPage < ActiveRecord::Migration[7.0]
include ::Migration::Utils
diff --git a/db/migrate/migration_utils/utils.rb b/db/migrate/migration_utils/utils.rb
index 2d564e233be..15dba0019d2 100644
--- a/db/migrate/migration_utils/utils.rb
+++ b/db/migrate/migration_utils/utils.rb
@@ -30,9 +30,9 @@ module Migration
module Utils
UpdateResult = Struct.new(:row, :updated)
- def say_with_time_silently(message, &block)
+ def say_with_time_silently(message, &)
say_with_time message do
- suppress_messages(&block)
+ suppress_messages(&)
end
end
diff --git a/extra/mail_handler/rdm-mailhandler.rb b/extra/mail_handler/rdm-mailhandler.rb
index a670505067d..80e2cf8ff7d 100644
--- a/extra/mail_handler/rdm-mailhandler.rb
+++ b/extra/mail_handler/rdm-mailhandler.rb
@@ -132,7 +132,8 @@ class RedmineMailHandler
when '--verbose'
self.verbose = true
when '--version'
- puts VERSION; exit
+ puts VERSION
+ exit
when '--project', '--status', '--type', '--category', '--priority'
issue_attributes[opt.gsub(%r{^--}, '')] = arg.dup
when '--allow-override'
diff --git a/lib/api/errors/bad_request.rb b/lib/api/errors/bad_request.rb
index b3789e35355..b04e0043083 100644
--- a/lib/api/errors/bad_request.rb
+++ b/lib/api/errors/bad_request.rb
@@ -33,7 +33,7 @@ module API
code 400
def initialize(message, **)
- super I18n.t('api_v3.errors.code_400', message:)
+ super(I18n.t('api_v3.errors.code_400', message:))
end
end
end
diff --git a/lib/api/errors/conflict.rb b/lib/api/errors/conflict.rb
index 93fb2156ebc..5f58a7b32fd 100644
--- a/lib/api/errors/conflict.rb
+++ b/lib/api/errors/conflict.rb
@@ -35,7 +35,7 @@ module API
def initialize(*args)
opts = args.last.is_a?(Hash) ? args.last : {}
- super opts[:message] || I18n.t('api_v3.errors.code_409')
+ super(opts[:message] || I18n.t('api_v3.errors.code_409'))
end
end
end
diff --git a/lib/api/errors/enterprise_token_missing.rb b/lib/api/errors/enterprise_token_missing.rb
index 2fd326d252a..7ab7ebe7842 100644
--- a/lib/api/errors/enterprise_token_missing.rb
+++ b/lib/api/errors/enterprise_token_missing.rb
@@ -33,7 +33,7 @@ module API
code 500
def initialize
- super I18n.t('api_v3.errors.code_500_missing_enterprise_token')
+ super(I18n.t('api_v3.errors.code_500_missing_enterprise_token'))
end
end
end
diff --git a/lib/api/errors/error_base.rb b/lib/api/errors/error_base.rb
index f40143b1498..2133855cc9f 100644
--- a/lib/api/errors/error_base.rb
+++ b/lib/api/errors/error_base.rb
@@ -112,7 +112,7 @@ module API
@message = message
@errors = []
- super message:
+ super(message:)
end
end
end
diff --git a/lib/api/errors/internal_error.rb b/lib/api/errors/internal_error.rb
index ee5c9988573..e2381715947 100644
--- a/lib/api/errors/internal_error.rb
+++ b/lib/api/errors/internal_error.rb
@@ -39,7 +39,7 @@ module API
error += " #{error_message}"
end
- super error
+ super(error)
end
private
diff --git a/lib/api/errors/invalid_resource_link.rb b/lib/api/errors/invalid_resource_link.rb
index 07cd95b2181..caaa67b4ad3 100644
--- a/lib/api/errors/invalid_resource_link.rb
+++ b/lib/api/errors/invalid_resource_link.rb
@@ -40,7 +40,7 @@ module API
expected: expected_i18n,
actual: actual_link)
- super message
+ super(message)
end
end
end
diff --git a/lib/api/errors/invalid_signal.rb b/lib/api/errors/invalid_signal.rb
index c0f3936d6f3..2281b1adca4 100644
--- a/lib/api/errors/invalid_signal.rb
+++ b/lib/api/errors/invalid_signal.rb
@@ -36,7 +36,7 @@ module API
message = I18n.t("api_v3.errors.invalid_signal.#{type}",
invalid: Array(invalid).join(', '),
supported: Array(supported).join(', '))
- super message
+ super(message)
end
end
end
diff --git a/lib/api/errors/invalid_user_status_transition.rb b/lib/api/errors/invalid_user_status_transition.rb
index 2a993ca9511..fad5c4e387b 100644
--- a/lib/api/errors/invalid_user_status_transition.rb
+++ b/lib/api/errors/invalid_user_status_transition.rb
@@ -33,7 +33,7 @@ module API
code 400
def initialize(*)
- super I18n.t('api_v3.errors.invalid_user_status_transition')
+ super(I18n.t('api_v3.errors.invalid_user_status_transition'))
end
end
end
diff --git a/lib/api/errors/multiple_errors.rb b/lib/api/errors/multiple_errors.rb
index 3516b3762ce..9a8870d6aaa 100644
--- a/lib/api/errors/multiple_errors.rb
+++ b/lib/api/errors/multiple_errors.rb
@@ -40,7 +40,7 @@ module API
end
def initialize(errors)
- super I18n.t('api_v3.errors.multiple_errors')
+ super(I18n.t('api_v3.errors.multiple_errors'))
@errors = errors
end
diff --git a/lib/api/errors/not_found.rb b/lib/api/errors/not_found.rb
index 337f496844f..7844de4abbc 100644
--- a/lib/api/errors/not_found.rb
+++ b/lib/api/errors/not_found.rb
@@ -36,7 +36,7 @@ module API
# Try to find a localizable error message for
# the not found error by checking the "model" property set by rails.
model ||= exception&.model&.underscore
- super not_found_message(model)
+ super(not_found_message(model))
end
private
diff --git a/lib/api/errors/not_implemented.rb b/lib/api/errors/not_implemented.rb
index af0ed15a601..01ae439276a 100644
--- a/lib/api/errors/not_implemented.rb
+++ b/lib/api/errors/not_implemented.rb
@@ -33,7 +33,7 @@ module API
code 501
def initialize(error_message = 'Not yet implemented'.freeze, **)
- super error_message
+ super(error_message)
end
end
end
diff --git a/lib/api/errors/outbound_request_forbidden.rb b/lib/api/errors/outbound_request_forbidden.rb
index 022424af992..1b3cbbffe14 100644
--- a/lib/api/errors/outbound_request_forbidden.rb
+++ b/lib/api/errors/outbound_request_forbidden.rb
@@ -33,7 +33,7 @@ module API
code 500
def initialize
- super I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 403)
+ super(I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 403))
end
end
end
diff --git a/lib/api/errors/outbound_request_not_found.rb b/lib/api/errors/outbound_request_not_found.rb
index 368ea861a24..669cbe1272b 100644
--- a/lib/api/errors/outbound_request_not_found.rb
+++ b/lib/api/errors/outbound_request_not_found.rb
@@ -33,7 +33,7 @@ module API
code 500
def initialize
- super I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 404)
+ super(I18n.t('api_v3.errors.code_500_outbound_request_failure', status_code: 404))
end
end
end
diff --git a/lib/api/errors/parse_error.rb b/lib/api/errors/parse_error.rb
index c210e94c019..b2e28671105 100644
--- a/lib/api/errors/parse_error.rb
+++ b/lib/api/errors/parse_error.rb
@@ -33,7 +33,7 @@ module API
code 400
def initialize(_message = nil, details: nil)
- super I18n.t('api_v3.errors.invalid_json')
+ super(I18n.t('api_v3.errors.invalid_json'))
if details
@details = { parseError: clean_parse_error(details) }
diff --git a/lib/api/errors/property_format_error.rb b/lib/api/errors/property_format_error.rb
index 2b127034525..cbcf8c999de 100644
--- a/lib/api/errors/property_format_error.rb
+++ b/lib/api/errors/property_format_error.rb
@@ -41,7 +41,7 @@ module API
property:,
expected_format:,
actual: actual_value)
- super message
+ super(message)
end
def details
diff --git a/lib/api/errors/property_missing_error.rb b/lib/api/errors/property_missing_error.rb
index 3c3a8c3ee9f..3404692b4f0 100644
--- a/lib/api/errors/property_missing_error.rb
+++ b/lib/api/errors/property_missing_error.rb
@@ -38,7 +38,7 @@ module API
self.property = property
message = I18n.t('api_v3.errors.missing_property', property:)
- super message
+ super(message)
end
def details
diff --git a/lib/api/errors/too_many_requests.rb b/lib/api/errors/too_many_requests.rb
index 7e97ac1db6e..759d7c7d8a4 100644
--- a/lib/api/errors/too_many_requests.rb
+++ b/lib/api/errors/too_many_requests.rb
@@ -35,7 +35,7 @@ module API
def initialize(*args)
opts = args.last.is_a?(Hash) ? args.last : {}
- super opts[:message] || I18n.t('api_v3.errors.code_429')
+ super(opts[:message] || I18n.t('api_v3.errors.code_429'))
end
end
end
diff --git a/lib/api/errors/unauthenticated.rb b/lib/api/errors/unauthenticated.rb
index 22f8fd9b3d5..b34aa22f31c 100644
--- a/lib/api/errors/unauthenticated.rb
+++ b/lib/api/errors/unauthenticated.rb
@@ -33,7 +33,7 @@ module API
code 401
def initialize(message = I18n.t('api_v3.errors.code_401'))
- super message
+ super(message)
end
end
end
diff --git a/lib/api/errors/unauthorized.rb b/lib/api/errors/unauthorized.rb
index 0465a7f7ad6..37b6227fd89 100644
--- a/lib/api/errors/unauthorized.rb
+++ b/lib/api/errors/unauthorized.rb
@@ -35,7 +35,7 @@ module API
def initialize(*args)
opts = args.last.is_a?(Hash) ? args.last : {}
- super opts[:message] || I18n.t('api_v3.errors.code_403')
+ super(opts[:message] || I18n.t('api_v3.errors.code_403'))
end
end
end
diff --git a/lib/api/errors/unsupported_media_type.rb b/lib/api/errors/unsupported_media_type.rb
index 0a77ca5aff5..ab86702659a 100644
--- a/lib/api/errors/unsupported_media_type.rb
+++ b/lib/api/errors/unsupported_media_type.rb
@@ -33,7 +33,7 @@ module API
code 415
def initialize(message)
- super message
+ super(message)
end
end
end
diff --git a/lib/api/errors/unwritable_property.rb b/lib/api/errors/unwritable_property.rb
index 44c77b6247a..901fb5d1e2f 100644
--- a/lib/api/errors/unwritable_property.rb
+++ b/lib/api/errors/unwritable_property.rb
@@ -33,7 +33,7 @@ module API
code 422
def initialize(property, message)
- super message
+ super(message)
@property = property
@details = { attribute: property }
diff --git a/lib/api/errors/validation.rb b/lib/api/errors/validation.rb
index 2469b428c73..2f34dd31f37 100644
--- a/lib/api/errors/validation.rb
+++ b/lib/api/errors/validation.rb
@@ -33,7 +33,7 @@ module API
code 422
def initialize(property, full_message)
- super full_message
+ super(full_message)
@property = property
@details = { attribute: property }
diff --git a/lib/api/open_api.rb b/lib/api/open_api.rb
index 7c9df0926de..2188633861b 100644
--- a/lib/api/open_api.rb
+++ b/lib/api/open_api.rb
@@ -20,7 +20,7 @@ module API
end
def assemble_spec(file_path)
- spec = YAML.safe_load File.read(file_path.to_s)
+ spec = YAML.safe_load_file(file_path.to_s)
substitute_refs(spec, path: file_path.parent, root_path: file_path.parent)
rescue Psych::SyntaxError => e
@@ -57,7 +57,7 @@ module API
def substitute_refs_in_hash(spec, path:, root_path:, root_spec: spec)
if spec.size == 1 && spec.keys.first == "$ref"
ref_path = path.join spec.values.first
- ref_value = YAML.safe_load File.read(ref_path.to_s)
+ ref_value = YAML.safe_load_file(ref_path.to_s)
resolve_refs ref_value, path: ref_path.parent, root_path:, root_spec:
else
diff --git a/lib/api/utilities/endpoints/delete.rb b/lib/api/utilities/endpoints/delete.rb
index ec0341832c9..c7eaab693c6 100644
--- a/lib/api/utilities/endpoints/delete.rb
+++ b/lib/api/utilities/endpoints/delete.rb
@@ -34,7 +34,7 @@ module API
def default_instance_generator(model)
->(_params) do
- instance_variable_get("@#{model.name.demodulize.underscore}")
+ instance_variable_get(:"@#{model.name.demodulize.underscore}")
end
end
diff --git a/lib/api/utilities/endpoints/modify.rb b/lib/api/utilities/endpoints/modify.rb
index f06e8518ddc..f264d09b3a9 100644
--- a/lib/api/utilities/endpoints/modify.rb
+++ b/lib/api/utilities/endpoints/modify.rb
@@ -32,7 +32,7 @@ module API
class Modify < Bodied
def default_instance_generator(model)
->(_params, _current_user) do
- instance_variable_get("@#{model.name.demodulize.underscore}")
+ instance_variable_get(:"@#{model.name.demodulize.underscore}")
end
end
diff --git a/lib/api/utilities/endpoints/show.rb b/lib/api/utilities/endpoints/show.rb
index e52ed985372..9b830eddaee 100644
--- a/lib/api/utilities/endpoints/show.rb
+++ b/lib/api/utilities/endpoints/show.rb
@@ -32,7 +32,7 @@ module API
class Show
def default_instance_generator(model)
->(_params) do
- instance_variable_get("@#{model.name.demodulize.underscore}")
+ instance_variable_get(:"@#{model.name.demodulize.underscore}")
end
end
diff --git a/lib/api/utilities/endpoints/update.rb b/lib/api/utilities/endpoints/update.rb
index 6d69604cb6c..64debc9ecfe 100644
--- a/lib/api/utilities/endpoints/update.rb
+++ b/lib/api/utilities/endpoints/update.rb
@@ -32,7 +32,7 @@ module API
class Update < Modify
def default_instance_generator(model)
->(_params) do
- instance_variable_get("@#{model.name.demodulize.underscore}")
+ instance_variable_get(:"@#{model.name.demodulize.underscore}")
end
end
diff --git a/lib/api/v3/activities/activity_property_formatters.rb b/lib/api/v3/activities/activity_property_formatters.rb
index 86bc5d3781f..b4912987060 100644
--- a/lib/api/v3/activities/activity_property_formatters.rb
+++ b/lib/api/v3/activities/activity_property_formatters.rb
@@ -52,7 +52,6 @@ module API
journal
.details
.filter_map { |d| journal.render_detail(d, html:, activity_page:) }
-
end
def journal_note(journal)
diff --git a/lib/api/v3/utilities/endpoints/update_form.rb b/lib/api/v3/utilities/endpoints/update_form.rb
index 32d142d706e..f34bde232ca 100644
--- a/lib/api/v3/utilities/endpoints/update_form.rb
+++ b/lib/api/v3/utilities/endpoints/update_form.rb
@@ -33,7 +33,7 @@ module API
class UpdateForm < Form
def default_instance_generator(model)
->(_params) do
- instance_variable_get("@#{model.name.demodulize.underscore}")
+ instance_variable_get(:"@#{model.name.demodulize.underscore}")
end
end
diff --git a/lib/api/v3/work_packages/eager_loading/base.rb b/lib/api/v3/work_packages/eager_loading/base.rb
index c28b4a220b1..d42bbd9260f 100644
--- a/lib/api/v3/work_packages/eager_loading/base.rb
+++ b/lib/api/v3/work_packages/eager_loading/base.rb
@@ -34,7 +34,7 @@ module API
def initialize(work_packages, **options)
self.work_packages = work_packages
options.each do |key, value|
- send("#{key}=", value) if respond_to?("#{key}=")
+ send(:"#{key}=", value) if respond_to?(:"#{key}=")
end
end
diff --git a/lib/api/v3/work_packages/work_package_collection_representer.rb b/lib/api/v3/work_packages/work_package_collection_representer.rb
index cd14588f1ce..e318a4e5982 100644
--- a/lib/api/v3/work_packages/work_package_collection_representer.rb
+++ b/lib/api/v3/work_packages/work_package_collection_representer.rb
@@ -75,7 +75,7 @@ module API
# and set those to be the represented collection.
# A potential ordering is reapplied to the work package collection in ruby.
- @represented = ::API::V3::WorkPackages::WorkPackageEagerLoadingWrapper \
+ @represented = ::API::V3::WorkPackages::WorkPackageEagerLoadingWrapper
.wrap(represented, current_user, timestamps:, query:)
end
diff --git a/lib/open_project/journal_formatter/active_status.rb b/lib/open_project/journal_formatter/active_status.rb
index 82a8a10f1a3..2604f0244ae 100644
--- a/lib/open_project/journal_formatter/active_status.rb
+++ b/lib/open_project/journal_formatter/active_status.rb
@@ -31,7 +31,7 @@ class OpenProject::JournalFormatter::ActiveStatus < JournalFormatter::Base
label_text = label('project')
label_text = content_tag(:strong, label_text) if options[:html]
- value = \
+ value =
if values.last
I18n.t('activerecord.attributes.project.active_value.true')
else
diff --git a/lib/open_project/journal_formatter/template.rb b/lib/open_project/journal_formatter/template.rb
index fb314539581..e01c33299bf 100644
--- a/lib/open_project/journal_formatter/template.rb
+++ b/lib/open_project/journal_formatter/template.rb
@@ -31,7 +31,7 @@ class OpenProject::JournalFormatter::Template < JournalFormatter::Base
label_text = label('project')
label_text = content_tag(:strong, label_text) if options[:html]
- value = \
+ value =
if values.last
I18n.t('activerecord.attributes.project.templated_value.true')
else
diff --git a/lib/open_project/journal_formatter/visibility.rb b/lib/open_project/journal_formatter/visibility.rb
index 07a302655f9..72f215e7bed 100644
--- a/lib/open_project/journal_formatter/visibility.rb
+++ b/lib/open_project/journal_formatter/visibility.rb
@@ -31,7 +31,7 @@ class OpenProject::JournalFormatter::Visibility < JournalFormatter::Base
label_text = I18n.t('activerecord.attributes.project.public_value.title')
label_text = content_tag(:strong, label_text) if options[:html]
- value = \
+ value =
if values.last
I18n.t('activerecord.attributes.project.public_value.true')
else
diff --git a/lib/open_project/object_linking.rb b/lib/open_project/object_linking.rb
index 55516ae1923..eae69d26898 100644
--- a/lib/open_project/object_linking.rb
+++ b/lib/open_project/object_linking.rb
@@ -103,7 +103,7 @@ module OpenProject
h(truncate(message.subject, length: 60)),
topic_path_or_url(options.delete(:no_root) ? message : message.root,
{
- r: (message.parent_id && message.id),
+ r: message.parent_id && message.id,
anchor: (message.parent_id ? "message-#{message.id}" : nil)
}.merge(options)),
html_options
diff --git a/lib/open_project/omni_auth/authorization.rb b/lib/open_project/omni_auth/authorization.rb
index 3e1dc0760b8..2176ab7d915 100644
--- a/lib/open_project/omni_auth/authorization.rb
+++ b/lib/open_project/omni_auth/authorization.rb
@@ -82,10 +82,10 @@ module OpenProject
end
end
- def self.authorize_user_for_provider(provider, &block)
+ def self.authorize_user_for_provider(provider)
callback = AuthorizationBlockCallback.new do |dec, auth_hash|
if auth_hash.provider.to_sym == provider.to_sym
- block.call dec, auth_hash
+ yield dec, auth_hash
else
dec.approve
end
@@ -260,9 +260,9 @@ module OpenProject
##
# Passes each element to the given block and returns the
# result of the block as soon as it's truthy.
- def find_map(&block)
+ def find_map
each do |e|
- result = block.call e
+ result = yield e
return result if result
end
diff --git a/lib/open_project/patches.rb b/lib/open_project/patches.rb
index 010bb459c3a..50725fcc882 100644
--- a/lib/open_project/patches.rb
+++ b/lib/open_project/patches.rb
@@ -33,14 +33,14 @@ module OpenProject
##
# Check against a particular gem version
# before patching it
- def patch_gem_version(gem, version, &block)
+ def patch_gem_version(gem, version)
found_version = Gem.loaded_specs[gem].version
if found_version > Gem::Version.new(version)
raise "OpenProject expects to patch gem '#{gem}' at version #{version} " \
"but found version #{found_version}. Please check whether the patch is still valid."
end
- block.call
+ yield
end
end
end
diff --git a/lib/open_project/patches/mailer_controller_preview.rb b/lib/open_project/patches/mailer_controller_preview.rb
index 2dd4083c530..ce3f75ba5bd 100644
--- a/lib/open_project/patches/mailer_controller_preview.rb
+++ b/lib/open_project/patches/mailer_controller_preview.rb
@@ -35,7 +35,7 @@ module OpenProject::Patches::MailerControllerCsp
def extend_content_security_policy
append_content_security_policy_directives(
- script_src: %w('unsafe-inline'),
+ script_src: %w('unsafe-inline')
)
end
end
diff --git a/lib/open_project/plugins/frontend_linking/generator.rb b/lib/open_project/plugins/frontend_linking/generator.rb
index 967fc0e0217..b46fc63c12e 100644
--- a/lib/open_project/plugins/frontend_linking/generator.rb
+++ b/lib/open_project/plugins/frontend_linking/generator.rb
@@ -59,7 +59,7 @@ module ::OpenProject::Plugins
# For that, search all gems with the group :opf_plugins
def regenerate_angular_links
all_frontend_plugins.tap do |plugins|
- target_dir = Rails.root.join('frontend', 'src', 'app', 'features', 'plugins', 'linked')
+ target_dir = Rails.root.join("frontend/src/app/features/plugins/linked")
puts "Cleaning linked target directory #{target_dir}"
# Removing the current linked directory and recreate
@@ -103,7 +103,7 @@ module ::OpenProject::Plugins
##
# Regenerate the frontend plugin module orchestrating the linked frontends
def generate_plugin_module(plugins)
- file_register = Rails.root.join('frontend', 'src', 'app', 'features', 'plugins', 'linked-plugins.module.ts')
+ file_register = Rails.root.join("frontend/src/app/features/plugins/linked-plugins.module.ts")
template_file = File.read(File.expand_path('linked-plugins.module.ts.erb', __dir__))
template = ::ERB.new template_file, trim_mode: '-'
@@ -116,7 +116,7 @@ module ::OpenProject::Plugins
##
# Regenerate the frontend plugin sass files
def generate_plugin_sass(plugins)
- file_register = Rails.root.join('frontend', 'src', 'app', 'features', 'plugins', 'linked-plugins.styles.sass')
+ file_register = Rails.root.join("frontend/src/app/features/plugins/linked-plugins.styles.sass")
template_file = File.read(File.expand_path('linked-plugins.styles.sass.erb', __dir__))
template = ::ERB.new template_file, trim_mode: '-'
diff --git a/lib/open_project/rate_limiting/throttled_api_error.rb b/lib/open_project/rate_limiting/throttled_api_error.rb
index 4c8e4bc05d6..e7e47e0b230 100644
--- a/lib/open_project/rate_limiting/throttled_api_error.rb
+++ b/lib/open_project/rate_limiting/throttled_api_error.rb
@@ -4,7 +4,7 @@ module OpenProject::RateLimiting
code 429
def initialize(*)
- super 'You have reached the request limit for this resource.'
+ super('You have reached the request limit for this resource.')
end
end
end
diff --git a/lib/open_project/scm/adapters.rb b/lib/open_project/scm/adapters.rb
index 53f70b14679..5c0ba13b985 100644
--- a/lib/open_project/scm/adapters.rb
+++ b/lib/open_project/scm/adapters.rb
@@ -71,7 +71,7 @@ module OpenProject
def initialize(attributes = {})
%i[name path kind size].each do |attr|
- send("#{attr}=", attributes[attr])
+ send(:"#{attr}=", attributes[attr])
end
self.size = size.to_i if size.present?
@@ -105,7 +105,7 @@ module OpenProject
def initialize(attributes = {})
%i[identifier scmid author time paths revision branch].each do |attr|
- send("#{attr}=", attributes[attr])
+ send(:"#{attr}=", attributes[attr])
end
self.name = attributes[:name].presence || identifier
diff --git a/lib/open_project/scm/adapters/git.rb b/lib/open_project/scm/adapters/git.rb
index 2f2ca407210..a1bd782506d 100644
--- a/lib/open_project/scm/adapters/git.rb
+++ b/lib/open_project/scm/adapters/git.rb
@@ -57,7 +57,7 @@ module OpenProject
end
def client_version
- @client_version ||= (git_binary_version || [])
+ @client_version ||= git_binary_version || []
end
def scm_version_from_command_line
@@ -479,11 +479,11 @@ module OpenProject
# Builds the full git arguments from the parameters
# and calls the given block with in, out, err, thread
# from +Open3#popen3+.
- def popen3(args, opt = {}, &block)
+ def popen3(args, opt = {})
opt = opt.merge(chdir: checkout_path) if checkout?
cmd = build_git_cmd(args)
super(cmd, opt) do |_stdin, stdout, stderr, wait_thr|
- block.call(stdout)
+ yield(stdout)
process = wait_thr.value
if process.exitstatus != 0
diff --git a/lib/open_project/scm/adapters/subversion.rb b/lib/open_project/scm/adapters/subversion.rb
index 9596a98d12e..398d1c36795 100644
--- a/lib/open_project/scm/adapters/subversion.rb
+++ b/lib/open_project/scm/adapters/subversion.rb
@@ -39,11 +39,11 @@ module OpenProject
end
def svnadmin_command
- @svnadmin_command ||= (self.class.config[:svnadmin_command] || 'svnadmin')
+ @svnadmin_command ||= self.class.config[:svnadmin_command] || 'svnadmin'
end
def client_version
- @client_version ||= (svn_binary_version || [])
+ @client_version ||= svn_binary_version || []
end
def svn_binary_version
@@ -358,10 +358,10 @@ module OpenProject
# Builds the full git arguments from the parameters
# and calls the given block with in, out, err, thread
# from +Open3#popen3+.
- def popen3(args, &block)
+ def popen3(args)
cmd = build_svn_cmd(args)
super(cmd) do |_stdin, stdout, stderr, wait_thr|
- block.call(stdout, stderr)
+ yield(stdout, stderr)
process = wait_thr.value
return process.exitstatus == 0
diff --git a/lib/open_project/text_formatting/filters/task_list_filter.rb b/lib/open_project/text_formatting/filters/task_list_filter.rb
index bd9a1e61598..8271c7a4ef8 100644
--- a/lib/open_project/text_formatting/filters/task_list_filter.rb
+++ b/lib/open_project/text_formatting/filters/task_list_filter.rb
@@ -57,7 +57,7 @@ module OpenProject::TextFormatting
#
# Returns nothing.
def filter!
- list_items(doc).reverse.each do |li|
+ list_items(doc).reverse_each do |li|
next if list_items(li.parent).empty?
add_css_class(li.parent, 'op-uc-list_task-list')
@@ -68,7 +68,7 @@ module OpenProject::TextFormatting
else
[li, li.inner_html]
end
- if match = (inner.chomp =~ ItemPattern && $1)
+ if match = inner.chomp =~ ItemPattern && $1
item = TaskList::Item.new(match, inner)
# prepend because we're iterating in reverse
task_list_items.unshift item
diff --git a/lib/open_project/text_formatting/formats.rb b/lib/open_project/text_formatting/formats.rb
index 08b4eb9e422..fbfc0481ef1 100644
--- a/lib/open_project/text_formatting/formats.rb
+++ b/lib/open_project/text_formatting/formats.rb
@@ -32,20 +32,20 @@ module OpenProject::TextFormatting
attr_reader :plain, :rich
%i(plain rich).each do |flavor|
- define_method("#{flavor}_format") do
+ define_method(:"#{flavor}_format") do
send(flavor).format
end
- define_method("#{flavor}_formatter") do
+ define_method(:"#{flavor}_formatter") do
send(flavor).formatter
end
- define_method("#{flavor}_helper") do
+ define_method(:"#{flavor}_helper") do
send(flavor).helper
end
- define_method("register_#{flavor}!") do |klass|
- instance_variable_set("@#{flavor}", klass)
+ define_method(:"register_#{flavor}!") do |klass|
+ instance_variable_set(:"@#{flavor}", klass)
end
end
diff --git a/lib/open_project/text_formatting/matchers/link_handlers/hash_separator.rb b/lib/open_project/text_formatting/matchers/link_handlers/hash_separator.rb
index 815d44f642e..2e4fc02d2f2 100644
--- a/lib/open_project/text_formatting/matchers/link_handlers/hash_separator.rb
+++ b/lib/open_project/text_formatting/matchers/link_handlers/hash_separator.rb
@@ -47,7 +47,7 @@ module OpenProject::TextFormatting::Matchers
# message#1218 -> Link to message with id 1218
#
def call
- send "render_#{matcher.prefix}"
+ send :"render_#{matcher.prefix}"
end
def valid_prefix?
diff --git a/lib/open_project/text_formatting/matchers/resource_links_matcher.rb b/lib/open_project/text_formatting/matchers/resource_links_matcher.rb
index 806d379a472..be45cde2478 100644
--- a/lib/open_project/text_formatting/matchers/resource_links_matcher.rb
+++ b/lib/open_project/text_formatting/matchers/resource_links_matcher.rb
@@ -79,7 +79,7 @@ module OpenProject::TextFormatting
([[[:space:]](,\-\[>]|^) # Leading string
(!)? # Escaped marker
(([a-z0-9\-_]+):)? # Project identifier
- (#{allowed_prefixes.join("|")})? # prefix
+ (#{allowed_prefixes.join('|')})? # prefix
(
(\#+|r)(\d+) # separator and its identifier
|
diff --git a/lib/open_project/text_formatting/truncation.rb b/lib/open_project/text_formatting/truncation.rb
index cc8e87ed3f4..d4ce0da5037 100644
--- a/lib/open_project/text_formatting/truncation.rb
+++ b/lib/open_project/text_formatting/truncation.rb
@@ -33,8 +33,8 @@ module OpenProject
include ActionView::Helpers::TextHelper
# Truncates and returns the string as a single line
- def truncate_single_line(string, *args)
- truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ').html_safe
+ def truncate_single_line(string, *)
+ truncate(string.to_s, *).gsub(%r{[\r\n]+}m, ' ').html_safe
end
end
end
diff --git a/lib/redmine/ciphering.rb b/lib/redmine/ciphering.rb
index f9670fc68be..695fe50ee01 100644
--- a/lib/redmine/ciphering.rb
+++ b/lib/redmine/ciphering.rb
@@ -79,7 +79,7 @@ module Redmine
!!transaction do
all.each do |object|
clear = object.send(attribute)
- object.send "#{attribute}=", clear
+ object.send :"#{attribute}=", clear
raise(ActiveRecord::Rollback) unless object.save(validate: false)
end
end
diff --git a/lib/redmine/menu_manager/menu_item.rb b/lib/redmine/menu_manager/menu_item.rb
index b824a286a27..b194744705d 100644
--- a/lib/redmine/menu_manager/menu_item.rb
+++ b/lib/redmine/menu_manager/menu_item.rb
@@ -72,7 +72,7 @@ class Redmine::MenuManager::MenuItem < Redmine::MenuManager::TreeNode
@engine = options[:engine]
@allow_deeplink = options[:allow_deeplink]
@skip_permissions_check = !!options[:skip_permissions_check]
- super @name.to_sym
+ super(@name.to_sym)
end
def caption(project = nil)
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb
index b6085df3c8a..4769847a8b6 100644
--- a/lib/redmine/plugin.rb
+++ b/lib/redmine/plugin.rb
@@ -89,7 +89,7 @@ module Redmine # :nodoc:
class_eval do
names.each do |name|
define_method(name) do |*args|
- args.empty? ? instance_variable_get("@#{name}") : instance_variable_set("@#{name}", *args)
+ args.empty? ? instance_variable_get(:"@#{name}") : instance_variable_set(:"@#{name}", *args)
end
end
end
diff --git a/lib/tabular_form_builder.rb b/lib/tabular_form_builder.rb
index 8fc607b3449..3e5e2d4d6a8 100644
--- a/lib/tabular_form_builder.rb
+++ b/lib/tabular_form_builder.rb
@@ -165,7 +165,7 @@ class TabularFormBuilder < ActionView::Helpers::FormBuilder
text = field.to_s + "_#{checked_value}",
options = {})
- label_for = "#{sanitized_object_name}_#{field}_#{checked_value}".to_sym
+ label_for = :"#{sanitized_object_name}_#{field}_#{checked_value}"
unchecked_value = options.delete(:unchecked_value) { '' }
input_options = options.reverse_merge(multiple: true,
diff --git a/lib/tasks/dependencies.rake b/lib/tasks/dependencies.rake
index 2223b7e8cd9..123bea60e69 100644
--- a/lib/tasks/dependencies.rake
+++ b/lib/tasks/dependencies.rake
@@ -34,12 +34,10 @@ namespace :openproject do
task update: %w[openproject:dependencies:update:gems]
namespace :update do
- def parse_capture(capture, &block)
+ def parse_capture(capture, &)
capture
.split("\n")
- .filter_map do |line|
- block.call(line)
- end
+ .filter_map(&)
end
desc 'Update gems to the extend the Gemfile allows in individual commits'
diff --git a/lib_static/open_project/authentication.rb b/lib_static/open_project/authentication.rb
index ff50ca8f0cc..b4758ce562f 100644
--- a/lib_static/open_project/authentication.rb
+++ b/lib_static/open_project/authentication.rb
@@ -218,7 +218,6 @@ module OpenProject
def find_all(identifiers)
identifiers
.filter_map { |ident| stages.find { |st| st.identifier == ident } }
-
end
def complete_path(identifier, session:, back_url: nil)
diff --git a/lib_static/open_project/authentication/manager.rb b/lib_static/open_project/authentication/manager.rb
index 35c4f6f841f..b9d808e64c4 100644
--- a/lib_static/open_project/authentication/manager.rb
+++ b/lib_static/open_project/authentication/manager.rb
@@ -11,10 +11,10 @@ module OpenProject
block = lambda { |config|
self.class.configure_warden config
- configure.call config if configure
+ yield config if configure
}
- super app, options, &block
+ super(app, options, &block)
end
class << self
@@ -59,7 +59,7 @@ module OpenProject
def update!(opts, &block)
self.store = opts[:store] if opts.include? :store
self.realm = opts[:realm] if opts.include? :realm
- self.strategies = block.call strategies if block_given?
+ self.strategies = yield strategies if block
end
end
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 c23a7fdf023..9a0916672dd 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
@@ -70,12 +70,10 @@ module OpenProject
##
# Only valid if global basic auth is configured and tried.
def valid?
- (
- OpenProject::Configuration.apiv3_enable_basic_auth? &&
- self.class.configuration? &&
- super &&
- username == self.class.user
- )
+ OpenProject::Configuration.apiv3_enable_basic_auth? &&
+ self.class.configuration? &&
+ super &&
+ username == self.class.user
end
def authenticate_user(username, password)
diff --git a/lib_static/open_project/authentication/strategies/warden/user_basic_auth.rb b/lib_static/open_project/authentication/strategies/warden/user_basic_auth.rb
index e1a0577aa0b..93bf7bc3a66 100644
--- a/lib_static/open_project/authentication/strategies/warden/user_basic_auth.rb
+++ b/lib_static/open_project/authentication/strategies/warden/user_basic_auth.rb
@@ -17,11 +17,9 @@ module OpenProject
end
def valid?
- (
- OpenProject::Configuration.apiv3_enable_basic_auth? &&
- super &&
- username == self.class.user
- )
+ OpenProject::Configuration.apiv3_enable_basic_auth? &&
+ super &&
+ username == self.class.user
end
def authenticate_user(_, api_key)
diff --git a/lib_static/open_project/configuration.rb b/lib_static/open_project/configuration.rb
index 1664ebdf531..1ef566bbb8f 100644
--- a/lib_static/open_project/configuration.rb
+++ b/lib_static/open_project/configuration.rb
@@ -108,7 +108,7 @@ module OpenProject
]
end
- def method_missing(name, *args, &)
+ def method_missing(name, *, &)
setting_name = name.to_s.sub(/\?$/, '')
definition = Settings::Definition[setting_name]
@@ -116,7 +116,7 @@ module OpenProject
if definition
define_config_methods(definition)
- send(name, *args, &)
+ send(name, *, &)
else
super
end
@@ -131,7 +131,7 @@ module OpenProject
self[definition.name]
end
- define_singleton_method "#{definition.name}?" do
+ define_singleton_method :"#{definition.name}?" do
if definition.format != :boolean
ActiveSupport::Deprecation.warn "Calling #{self}.#{definition.name}? is deprecated since it is not a boolean", caller
end
diff --git a/lib_static/open_project/feature_decisions.rb b/lib_static/open_project/feature_decisions.rb
index 42879e0e129..1a3ca370101 100644
--- a/lib_static/open_project/feature_decisions.rb
+++ b/lib_static/open_project/feature_decisions.rb
@@ -65,7 +65,7 @@ module OpenProject
end
def active
- all.filter { |flag_name| send("#{flag_name}_active?") }.map(&:to_s)
+ all.filter { |flag_name| send(:"#{flag_name}_active?") }.map(&:to_s)
end
def all
@@ -73,8 +73,8 @@ module OpenProject
end
def define_flag_methods(flag_name)
- define_singleton_method "#{flag_name}_active?" do
- Setting.exists?("feature_#{flag_name}_active") && Setting.send("feature_#{flag_name}_active?")
+ define_singleton_method :"#{flag_name}_active?" do
+ Setting.exists?("feature_#{flag_name}_active") && Setting.send(:"feature_#{flag_name}_active?")
end
end
diff --git a/lib_static/open_project/notifications.rb b/lib_static/open_project/notifications.rb
index 5ba6949538d..1aa73e1caad 100644
--- a/lib_static/open_project/notifications.rb
+++ b/lib_static/open_project/notifications.rb
@@ -45,7 +45,7 @@ module OpenProject
# @raises ArgumentError if no block is given.
def subscribe(name, clear_subscriptions: false, &block)
# if no block is given, raise an error
- raise ArgumentError, 'please provide a block as a callback' unless block_given?
+ raise ArgumentError, 'please provide a block as a callback' unless block
if clear_subscriptions
subscriptions[name].each do |sub|
@@ -54,7 +54,7 @@ module OpenProject
end
sub = ActiveSupport::Notifications.subscribe(name.to_s) do |_, _, _, _, data|
- block.call(data.fetch(:payload, data))
+ yield(data.fetch(:payload, data))
end
subs = clear_subscriptions ? [] : Array(subscriptions[name])
diff --git a/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb b/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb
index 5a9e2ba0b61..3998cd92771 100644
--- a/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb
+++ b/lib_static/plugins/acts_as_attachable/lib/acts_as_attachable.rb
@@ -122,11 +122,11 @@ module Redmine
end
def view_permission_default
- "view_#{name.pluralize.underscore}".to_sym
+ :"view_#{name.pluralize.underscore}"
end
def edit_permission_default
- "edit_#{name.pluralize.underscore}".to_sym
+ :"edit_#{name.pluralize.underscore}"
end
def attachable_extract_tsv_option(options)
diff --git a/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb b/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb
index f4b32da88de..c9935fe0db7 100644
--- a/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb
+++ b/lib_static/plugins/acts_as_journalized/lib/journal_formatter.rb
@@ -49,16 +49,16 @@
# It provides the hooks to apply different formatting to the details
# of a specific journal.
-require_relative './journal_formatter_cache'
-require_relative './journal_formatter/base'
-require_relative './journal_formatter/attribute'
-require_relative './journal_formatter/datetime'
-require_relative './journal_formatter/day_count'
-require_relative './journal_formatter/decimal'
-require_relative './journal_formatter/fraction'
-require_relative './journal_formatter/id'
-require_relative './journal_formatter/named_association'
-require_relative './journal_formatter/plaintext'
+require_relative 'journal_formatter_cache'
+require_relative 'journal_formatter/base'
+require_relative 'journal_formatter/attribute'
+require_relative 'journal_formatter/datetime'
+require_relative 'journal_formatter/day_count'
+require_relative 'journal_formatter/decimal'
+require_relative 'journal_formatter/fraction'
+require_relative 'journal_formatter/id'
+require_relative 'journal_formatter/named_association'
+require_relative 'journal_formatter/plaintext'
module JournalFormatter
mattr_accessor :formatters, :registered_fields
diff --git a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
index ccb45006f38..24c7bed37ee 100644
--- a/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
+++ b/lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb
@@ -60,7 +60,7 @@ module Redmine
# Permission needed to search this model
unless searchable_options.has_key?(:permission)
searchable_options[:permission] =
- "view_#{name.underscore.pluralize}".to_sym
+ :"view_#{name.underscore.pluralize}"
end
# Should we search custom fields on this model ?
diff --git a/lib_static/plugins/acts_as_watchable/lib/acts_as_watchable.rb b/lib_static/plugins/acts_as_watchable/lib/acts_as_watchable.rb
index f4b9ab031b9..efa6d55a823 100644
--- a/lib_static/plugins/acts_as_watchable/lib/acts_as_watchable.rb
+++ b/lib_static/plugins/acts_as_watchable/lib/acts_as_watchable.rb
@@ -163,7 +163,7 @@ module Redmine
module ClassMethods
def acts_as_watchable_permission
- acts_as_watchable_options[:permission] || "view_#{name.underscore.pluralize}".to_sym
+ acts_as_watchable_options[:permission] || :"view_#{name.underscore.pluralize}"
end
end
end
diff --git a/lib_static/redmine/i18n.rb b/lib_static/redmine/i18n.rb
index 7daaa110742..354dc007c44 100644
--- a/lib_static/redmine/i18n.rb
+++ b/lib_static/redmine/i18n.rb
@@ -50,7 +50,7 @@ module Redmine
end
def l_or_humanize(s, options = {})
- k = "#{options[:prefix]}#{s}".to_sym
+ k = :"#{options[:prefix]}#{s}"
::I18n.t(k, default: s.to_s.humanize)
end
diff --git a/lookbook/previews/users/avatar_component_preview.rb b/lookbook/previews/users/avatar_component_preview.rb
index c951ff85580..2ebeccc893d 100644
--- a/lookbook/previews/users/avatar_component_preview.rb
+++ b/lookbook/previews/users/avatar_component_preview.rb
@@ -3,7 +3,6 @@
module Users
# @logical_path OpenProject/Users
class AvatarComponentPreview < Lookbook::Preview
-
# Renders a user avatar using the OpenProject opce-principal web component
# @param size select { choices: [default, medium, mini] }
# @param link toggle
diff --git a/modules/auth_plugins/spec/features/auth_provider_spec.rb b/modules/auth_plugins/spec/features/auth_provider_spec.rb
index e2ae489d61a..d841c69eda7 100644
--- a/modules/auth_plugins/spec/features/auth_provider_spec.rb
+++ b/modules/auth_plugins/spec/features/auth_provider_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'rendering the login buttons', js: true do
+RSpec.describe 'rendering the login buttons', :js do
let(:providers) do
[
{ name: 'mock_auth' }
diff --git a/modules/auth_saml/lib/open_project/auth_saml/engine.rb b/modules/auth_saml/lib/open_project/auth_saml/engine.rb
index 895fb5efbc6..0222a4ab726 100644
--- a/modules/auth_saml/lib/open_project/auth_saml/engine.rb
+++ b/modules/auth_saml/lib/open_project/auth_saml/engine.rb
@@ -34,7 +34,7 @@ module OpenProject
end
def self.settings_from_yaml
- if (settings = Rails.root.join('config', 'plugins', 'auth_saml', 'settings.yml')).exist?
+ if (settings = Rails.root.join("config/plugins/auth_saml/settings.yml")).exist?
Rails.logger.info("[auth_saml] Registering saml integration from settings file")
YAML::load(File.open(settings)).symbolize_keys
diff --git a/modules/avatars/app/helpers/avatar_helper.rb b/modules/avatars/app/helpers/avatar_helper.rb
index 75f966bd536..6f0e192c1d5 100644
--- a/modules/avatars/app/helpers/avatar_helper.rb
+++ b/modules/avatars/app/helpers/avatar_helper.rb
@@ -45,8 +45,8 @@ module AvatarHelper
# Returns the avatar image tag for the given +user+ if avatars are enabled
# +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <[email protected]>')
- def avatar(principal, size: 'default', hide_name: true, name_classes: '', **options)
- build_principal_avatar_tag principal, size:, hide_name:, name_classes:, **options
+ def avatar(principal, size: 'default', hide_name: true, name_classes: '', **)
+ build_principal_avatar_tag(principal, size:, hide_name:, name_classes:, **)
rescue StandardError => e
Rails.logger.error "Failed to create avatar for #{principal}: #{e}"
''.html_safe
@@ -89,8 +89,8 @@ module AvatarHelper
gravatar_image_url(mail, opts)
end
- def build_principal_avatar_tag(user, **options)
- tag_options = merge_default_avatar_options(user, **options)
+ def build_principal_avatar_tag(user, **)
+ tag_options = merge_default_avatar_options(user, **)
principal_type = API::V3::Principals::PrincipalType.for(user)
principal = {
diff --git a/modules/avatars/spec/features/my_avatar_spec.rb b/modules/avatars/spec/features/my_avatar_spec.rb
index d8d204709e2..ebd46183184 100644
--- a/modules/avatars/spec/features/my_avatar_spec.rb
+++ b/modules/avatars/spec/features/my_avatar_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-require_relative './shared_avatar_examples'
+require_relative 'shared_avatar_examples'
-RSpec.describe 'My avatar management', js: true do
+RSpec.describe 'My avatar management', :js do
include Rails.application.routes.url_helpers
let(:user) { create(:user) }
@@ -26,7 +26,7 @@ RSpec.describe 'My avatar management', js: true do
expect(page).to have_text '[Error 404]'
visit my_account_path
- expect(page).not_to have_selector '.avatar-menu-item'
+ expect(page).to have_no_css '.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 a3aabbb92e5..5fccae30fa8 100644
--- a/modules/avatars/spec/features/shared_avatar_examples.rb
+++ b/modules/avatars/spec/features/shared_avatar_examples.rb
@@ -24,12 +24,12 @@ RSpec.shared_examples 'avatar management' do
it 'shows the gravatar avatar' do
visit avatar_management_path
- expect(page).to have_selector('.form--fieldset-legend', text: 'GRAVATAR')
- expect(page).to have_selector('.avatars--current-gravatar')
+ expect(page).to have_css('.form--fieldset-legend', text: 'GRAVATAR')
+ expect(page).to have_css('.avatars--current-gravatar')
# Local not rendered
- expect(page).not_to have_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
- expect(page).not_to have_selector('.avatars--current-local-avatar', text: 'none')
+ expect(page).to have_no_css('.form--fieldset-legend', text: 'CUSTOM AVATAR')
+ expect(page).to have_no_css('.avatars--current-local-avatar', text: 'none')
end
end
@@ -38,36 +38,36 @@ RSpec.shared_examples 'avatar management' do
it 'can upload a new image' do
visit avatar_management_path
- expect(page).to have_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
- expect(page).to have_selector('.avatars--current-local-avatar', text: 'none')
+ expect(page).to have_css('.form--fieldset-legend', text: 'CUSTOM AVATAR')
+ expect(page).to have_css('.avatars--current-local-avatar', text: 'none')
# Gravatars not rendered
- expect(page).not_to have_selector('.form--fieldset-legend', text: 'GRAVATAR')
+ expect(page).to have_no_css('.form--fieldset-legend', text: 'GRAVATAR')
# Attach a new invalid image
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')
- expect(page).to have_selector('.avatars--error-pane', text: 'Allowed formats are jpg, png, gif')
+ expect(page).to have_css('.form--label.-error')
+ expect(page).to have_css('.avatars--error-pane', text: 'Allowed formats are jpg, png, gif')
# Attach new image
visit avatar_management_path
- expect(page).to have_selector('.avatars--current-local-avatar', text: 'none')
+ expect(page).to have_css('.avatars--current-local-avatar', text: 'none')
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).not_to have_selector('.form--label.-error')
- expect(page).not_to have_selector('.avatars--error-pane span')
+ expect(page).to have_no_css('.form--label.-error')
+ expect(page).to have_no_css('.avatars--error-pane span')
# Expect preview
- expect(page).to have_selector('.preview img')
+ expect(page).to have_css('.preview img')
# Click button
click_on 'Update'
# Expect avatar rendered
- expect(page).to have_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
+ expect(page).to have_css('.form--fieldset-legend', text: 'CUSTOM AVATAR')
avatar_tag = find('.avatars--current-local-avatar img')
expect(avatar_tag[:src]).to include user_avatar_path(target_user)
@@ -82,7 +82,7 @@ RSpec.shared_examples 'avatar management' do
find('.avatars--local-avatar-delete-link').click
end
- expect(page).to have_selector('.avatars--current-local-avatar', text: 'none', wait: 20)
+ expect(page).to have_css('.avatars--current-local-avatar', text: 'none', wait: 20)
end
end
@@ -94,12 +94,12 @@ RSpec.shared_examples 'avatar management' do
visit avatar_management_path
# Gravatar
- expect(page).to have_selector('.form--fieldset-legend', text: 'GRAVATAR')
- expect(page).to have_selector('.avatars--current-gravatar')
+ expect(page).to have_css('.form--fieldset-legend', text: 'GRAVATAR')
+ expect(page).to have_css('.avatars--current-gravatar')
# Local
- expect(page).to have_selector('.form--fieldset-legend', text: 'CUSTOM AVATAR')
- expect(page).to have_selector('.avatars--current-local-avatar', text: 'none')
+ expect(page).to have_css('.form--fieldset-legend', text: 'CUSTOM AVATAR')
+ expect(page).to have_css('.avatars--current-local-avatar', text: 'none')
end
end
end
diff --git a/modules/avatars/spec/features/user_avatar_spec.rb b/modules/avatars/spec/features/user_avatar_spec.rb
index fe84abfe520..4f8ba9fbcfb 100644
--- a/modules/avatars/spec/features/user_avatar_spec.rb
+++ b/modules/avatars/spec/features/user_avatar_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
-require_relative './shared_avatar_examples'
+require_relative 'shared_avatar_examples'
-RSpec.describe 'User avatar management', js: true do
+RSpec.describe 'User avatar management', :js do
include Rails.application.routes.url_helpers
let(:user) { create(:admin) }
@@ -48,7 +48,7 @@ RSpec.describe 'User avatar management', js: true do
it 'does not render the user edit tab' do
visit edit_user_path(user)
- expect(page).not_to have_selector '#tab-avatar'
+ expect(page).to have_no_css '#tab-avatar'
end
end
end
diff --git a/modules/avatars/spec/shared_examples.rb b/modules/avatars/spec/shared_examples.rb
index 1f69d9255f3..7b90b310649 100644
--- a/modules/avatars/spec/shared_examples.rb
+++ b/modules/avatars/spec/shared_examples.rb
@@ -89,6 +89,7 @@ RSpec.shared_examples_for "an action requiring admin" do
end
end
end
+
RSpec.shared_context "there are users with and without avatars" do
let(:base_path) { File.expand_path 'fixtures', __dir__ }
let(:user_without_avatar) { create(:user) }
@@ -117,6 +118,7 @@ RSpec.shared_context "there are users with and without avatars" do
testfile
end
end
+
RSpec.shared_examples_for "an action with an invalid user" do
it do
do_action
@@ -131,6 +133,7 @@ RSpec.shared_context "an action with stubbed User.find" do
allow(User).to receive(:find) { |id, _args| id.to_s == "0" ? nil : user }
end
end
+
RSpec.shared_examples_for "an action that deletes the user's avatar" do
it do
expect_any_instance_of(Attachment).to receive(:destroy).and_call_original
diff --git a/modules/backlogs/app/controllers/version_settings_controller.rb b/modules/backlogs/app/controllers/version_settings_controller.rb
index efb43a7656e..57e3a48de61 100644
--- a/modules/backlogs/app/controllers/version_settings_controller.rb
+++ b/modules/backlogs/app/controllers/version_settings_controller.rb
@@ -36,6 +36,6 @@ class VersionSettingsController < RbApplicationController
def authorize
# Everyone with the right to edit versions has the right to edit version
# settings
- super 'versions', 'edit'
+ super('versions', 'edit')
end
end
diff --git a/modules/backlogs/app/helpers/rb_common_helper.rb b/modules/backlogs/app/helpers/rb_common_helper.rb
index 41254afc005..45e770190f7 100644
--- a/modules/backlogs/app/helpers/rb_common_helper.rb
+++ b/modules/backlogs/app/helpers/rb_common_helper.rb
@@ -95,7 +95,7 @@ module RbCommonHelper
def background_color_hex(task)
background_color = get_backlogs_preference(task.assigned_to, :task_color)
- background_color_hex = background_color.sub(/\#/, '0x').hex
+ background_color_hex = background_color.sub("#", '0x').hex
end
def id_or_empty(item)
diff --git a/modules/backlogs/app/models/burndown.rb b/modules/backlogs/app/models/burndown.rb
index b0e393c93b9..e33b7af1c7e 100644
--- a/modules/backlogs/app/models/burndown.rb
+++ b/modules/backlogs/app/models/burndown.rb
@@ -86,7 +86,7 @@ class Burndown
@available_series ||= {}
s = OpenProject::Backlogs::Burndown::Series.new(data, name, units)
@available_series[name] = s
- instance_variable_set("@#{name}", s)
+ instance_variable_set(:"@#{name}", s)
end
def determine_max
diff --git a/modules/backlogs/db/migrate/20180323151208_to_v710_aggregated_backlogs_migrations.rb b/modules/backlogs/db/migrate/20180323151208_to_v710_aggregated_backlogs_migrations.rb
index c8a735b3b16..6da8c2cfc3d 100644
--- a/modules/backlogs/db/migrate/20180323151208_to_v710_aggregated_backlogs_migrations.rb
+++ b/modules/backlogs/db/migrate/20180323151208_to_v710_aggregated_backlogs_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join("db", "migrate", "migration_utils", "migration_squasher").to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
# This migration aggregates the migrations detailed in MIGRATION_FILES
class ToV710AggregatedBacklogsMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
diff --git a/modules/backlogs/lib/open_project/backlogs/burndown/series_raw_data.rb b/modules/backlogs/lib/open_project/backlogs/burndown/series_raw_data.rb
index 7f9ff584952..53139ab9b87 100644
--- a/modules/backlogs/lib/open_project/backlogs/burndown/series_raw_data.rb
+++ b/modules/backlogs/lib/open_project/backlogs/burndown/series_raw_data.rb
@@ -42,7 +42,7 @@ module OpenProject::Backlogs::Burndown
end
def unit_for(name)
- return :points if @collect[:points].include? name
+ :points if @collect[:points].include? name
end
def collect_data
@@ -50,7 +50,7 @@ module OpenProject::Backlogs::Burndown
data_for_dates(collected_days).each do |day_data|
date = day_data['date']
- date = date.is_a?(Date) ? date : Date.parse(date)
+ date = Date.parse(date) unless date.is_a?(Date)
day_data.each do |key, value|
next if key == 'date'
diff --git a/modules/backlogs/lib/open_project/backlogs/patches/project_seeder_patch.rb b/modules/backlogs/lib/open_project/backlogs/patches/project_seeder_patch.rb
index 7b733df1aa6..34a33c6dc2d 100644
--- a/modules/backlogs/lib/open_project/backlogs/patches/project_seeder_patch.rb
+++ b/modules/backlogs/lib/open_project/backlogs/patches/project_seeder_patch.rb
@@ -40,7 +40,6 @@ module OpenProject::Backlogs::Patches::ProjectSeederPatch
versions = version_data
.filter_map { |data| Version.find_by(name: data['name']) }
-
versions.each do |version|
display = version_settings_display_map[version.name] || VersionSetting::DISPLAY_NONE
diff --git a/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb b/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb
index 0e06ab2b58e..2e0b6ba5218 100644
--- a/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb
+++ b/modules/backlogs/spec/contracts/work_packages/base_contract_spec.rb
@@ -177,7 +177,7 @@ RSpec.describe WorkPackages::BaseContract, type: :model do
it 'is invalid and notes the error' do
expect(subject).to be_falsey
expect(instance.errors.symbols_for(:version_id))
- .to match_array([:task_version_must_be_the_same_as_story_version])
+ .to contain_exactly(:task_version_must_be_the_same_as_story_version)
end
end
diff --git a/modules/backlogs/spec/controllers/versions_controller_spec.rb b/modules/backlogs/spec/controllers/versions_controller_spec.rb
index 41783f5380f..d3b21652a47 100644
--- a/modules/backlogs/spec/controllers/versions_controller_spec.rb
+++ b/modules/backlogs/spec/controllers/versions_controller_spec.rb
@@ -57,9 +57,6 @@ RSpec.describe VersionsController do
@params = {}
@params[:id] = version.id
@params[:version] = { name: @newVersionName }
- end
-
- before do
login_as current_user
end
diff --git a/modules/backlogs/spec/factories/impediment_factory.rb b/modules/backlogs/spec/factories/impediment_factory.rb
index b44a1704589..56bdcd3d7fc 100644
--- a/modules/backlogs/spec/factories/impediment_factory.rb
+++ b/modules/backlogs/spec/factories/impediment_factory.rb
@@ -31,7 +31,7 @@ FactoryBot.define do
association :type, factory: :type_task
subject { 'Impeding progress' }
description { 'Unable to print recipes' }
- association :priority, factory: :priority
+ association :priority
association :author, factory: :user
end
end
diff --git a/modules/backlogs/spec/factories/task_factory.rb b/modules/backlogs/spec/factories/task_factory.rb
index c119474e80c..99056543ee5 100644
--- a/modules/backlogs/spec/factories/task_factory.rb
+++ b/modules/backlogs/spec/factories/task_factory.rb
@@ -31,7 +31,7 @@ FactoryBot.define do
association :type, factory: :type_task
subject { 'Printing Recipes' }
description { 'Just printing recipes' }
- association :priority, factory: :priority
+ association :priority
association :author, factory: :user
end
end
diff --git a/modules/backlogs/spec/features/backlogs/create_story_spec.rb b/modules/backlogs/spec/features/backlogs/create_story_spec.rb
index 239f8a46eaf..0449829b25e 100644
--- a/modules/backlogs/spec/features/backlogs/create_story_spec.rb
+++ b/modules/backlogs/spec/features/backlogs/create_story_spec.rb
@@ -112,7 +112,7 @@ RSpec.describe 'Backlogs', :js, :with_cuprite do
# inactive types should not be selectable
# but the user can choose from the active types
expect(page)
- .not_to have_css('option', text: inactive_story_type.name)
+ .to have_no_css('option', text: inactive_story_type.name)
select story_type2.name, from: 'type'
@@ -133,7 +133,7 @@ RSpec.describe 'Backlogs', :js, :with_cuprite do
page.driver.refresh
expect(page)
- .not_to have_content 'Another story'
+ .to have_no_content 'Another story'
expect(page)
.to have_css '.story:nth-of-type(1)', text: 'The new story'
diff --git a/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb b/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb
index f54523e18eb..bca7a75a26a 100644
--- a/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb
+++ b/modules/backlogs/spec/features/backlogs_in_backlog_view_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require_relative '../support/pages/backlogs'
-RSpec.describe 'Backlogs in backlog view',
- js: true,
+RSpec.describe 'Backlogs in backlog view', :js,
with_cuprite: false do
let!(:project) do
create(:project,
@@ -234,7 +233,7 @@ RSpec.describe 'Backlogs in backlog view',
# the disabled backlog/sprint is no longer visible
expect(page)
- .not_to have_content(backlog.name)
+ .to have_no_content(backlog.name)
# The others are unchanged
backlogs_page
@@ -256,13 +255,13 @@ RSpec.describe 'Backlogs in backlog view',
# the disabled backlog/sprint is no longer visible
expect(page)
- .not_to have_content(other_project_sprint.name)
+ .to have_no_content(other_project_sprint.name)
# The others are unchanged
backlogs_page
.expect_backlog(sprint)
expect(page)
- .not_to have_content(backlog.name)
+ .to have_no_content(backlog.name)
end
end
diff --git a/modules/backlogs/spec/features/empty_backlogs_spec.rb b/modules/backlogs/spec/features/empty_backlogs_spec.rb
index f7b0960aa89..ec3124e0af8 100644
--- a/modules/backlogs/spec/features/empty_backlogs_spec.rb
+++ b/modules/backlogs/spec/features/empty_backlogs_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe 'Empty backlogs project',
it 'only shows a no results box' do
expect(page).to have_css('.generic-table--no-results-container', text: I18n.t(:backlogs_empty_title))
- expect(page).not_to have_css('.generic-table--no-results-description')
+ expect(page).to have_no_css('.generic-table--no-results-description')
end
end
end
diff --git a/modules/backlogs/spec/features/impediments_spec.rb b/modules/backlogs/spec/features/impediments_spec.rb
index d698a644b41..b39a86c14d6 100644
--- a/modules/backlogs/spec/features/impediments_spec.rb
+++ b/modules/backlogs/spec/features/impediments_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Impediments on taskboard',
- js: true,
+RSpec.describe 'Impediments on taskboard', :js,
with_cuprite: false do
let!(:project) do
create(:project,
@@ -121,9 +120,9 @@ RSpec.describe 'Impediments on taskboard',
# Saves successfully
expect(page)
- .to have_selector('div.impediment', text: 'New impediment')
+ .to have_css('div.impediment', text: 'New impediment')
expect(page)
- .not_to have_selector('div.impediment.error', text: 'New impediment')
+ .to have_no_css('div.impediment.error', text: 'New impediment')
# Attempt to create a new impediment with the id of a story from another sprint
find('#impediments .add_new').click
@@ -134,12 +133,12 @@ RSpec.describe 'Impediments on taskboard',
# Saves unsuccessfully
expect(page)
- .to have_selector('div.impediment', text: 'Other sprint impediment')
+ .to have_css('div.impediment', text: 'Other sprint impediment')
expect(page)
- .to have_selector('div.impediment.error', text: 'Other sprint impediment')
+ .to have_css('div.impediment.error', text: 'Other sprint impediment')
expect(page)
- .to have_selector('#msgBox',
- text: "IDs of blocked work packages can only contain IDs of work packages in the current sprint.")
+ .to have_css('#msgBox',
+ text: "IDs of blocked work packages can only contain IDs of work packages in the current sprint.")
click_on 'OK'
@@ -152,12 +151,12 @@ RSpec.describe 'Impediments on taskboard',
# Saves unsuccessfully
expect(page)
- .to have_selector('div.impediment', text: 'Invalid id impediment')
+ .to have_css('div.impediment', text: 'Invalid id impediment')
expect(page)
- .to have_selector('div.impediment.error', text: 'Invalid id impediment')
+ .to have_css('div.impediment.error', text: 'Invalid id impediment')
expect(page)
- .to have_selector('#msgBox',
- text: "IDs of blocked work packages can only contain IDs of work packages in the current sprint.")
+ .to have_css('#msgBox',
+ text: "IDs of blocked work packages can only contain IDs of work packages in the current sprint.")
click_on 'OK'
# Attempt to create a new impediment without specifying the blocked story/task
@@ -168,11 +167,11 @@ RSpec.describe 'Impediments on taskboard',
# Saves unsuccessfully
expect(page)
- .to have_selector('div.impediment', text: 'Unblocking impediment')
+ .to have_css('div.impediment', text: 'Unblocking impediment')
expect(page)
- .to have_selector('div.impediment.error', text: 'Unblocking impediment')
+ .to have_css('div.impediment.error', text: 'Unblocking impediment')
expect(page)
- .to have_selector('#msgBox', text: "IDs of blocked work packages must contain the ID of at least one ticket")
+ .to have_css('#msgBox', text: "IDs of blocked work packages must contain the ID of at least one ticket")
click_on 'OK'
# Updating an impediment
@@ -184,8 +183,8 @@ RSpec.describe 'Impediments on taskboard',
# Saves successfully
expect(page)
- .to have_selector('div.impediment', text: 'Updated impediment')
+ .to have_css('div.impediment', text: 'Updated impediment')
expect(page)
- .not_to have_selector('div.impediment.error', text: 'Updated impediment')
+ .to have_no_css('div.impediment.error', text: 'Updated impediment')
end
end
diff --git a/modules/backlogs/spec/features/stories_in_backlog_spec.rb b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
index 64953a04089..8cc3d8f1b05 100644
--- a/modules/backlogs/spec/features/stories_in_backlog_spec.rb
+++ b/modules/backlogs/spec/features/stories_in_backlog_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require_relative '../support/pages/backlogs'
-RSpec.describe 'Stories in backlog',
- js: true,
+RSpec.describe 'Stories in backlog', :js,
with_cuprite: false do
let!(:project) do
create(:project,
@@ -191,7 +190,7 @@ RSpec.describe 'Stories in backlog',
# All positions will be unique in the sprint
expect(Story.where(version: sprint, type: story, project:).pluck(:position))
- .to match_array([1, 2, 3])
+ .to contain_exactly(1, 2, 3)
backlogs_page
.expect_stories_in_order(sprint, new_story, sprint_story1, sprint_story2)
@@ -229,7 +228,7 @@ RSpec.describe 'Stories in backlog',
.expect_stories_in_order(sprint, sprint_story1, new_story, sprint_story2)
expect(Story.where(version: sprint, type: story, project:).pluck(:position))
- .to match_array([1, 2, 3])
+ .to contain_exactly(1, 2, 3)
# Moving a story to bottom
backlogs_page
@@ -241,7 +240,7 @@ RSpec.describe 'Stories in backlog',
.expect_stories_in_order(sprint, new_story, sprint_story2, sprint_story1)
expect(Story.where(version: sprint, type: story, project:).pluck(:position))
- .to match_array([1, 2, 3])
+ .to contain_exactly(1, 2, 3)
# Moving a story to from the backlog to the sprint (3rd position)
@@ -255,7 +254,7 @@ RSpec.describe 'Stories in backlog',
.expect_stories_in_order(sprint, new_story, sprint_story2, backlog_story1, sprint_story1)
expect(Story.where(version: sprint, type: story, project:).pluck(:position))
- .to match_array([1, 2, 3, 4])
+ .to contain_exactly(1, 2, 3, 4)
# Available statuses when editing
diff --git a/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
index ee9d1f843c2..3965468c0f5 100644
--- a/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
+++ b/modules/backlogs/spec/features/tasks_on_taskboard_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require_relative '../support/pages/taskboard'
-RSpec.describe 'Tasks on taskboard',
- js: true,
+RSpec.describe 'Tasks on taskboard', :js,
with_cuprite: false do
let!(:project) do
create(:project,
@@ -235,8 +234,8 @@ RSpec.describe 'Tasks on taskboard',
# There is a button to the burndown chart
expect(page)
- .to have_selector("a[href='#{backlogs_project_sprint_burndown_chart_path(project, sprint)}']",
- text: 'Burndown Chart')
+ .to have_css("a[href='#{backlogs_project_sprint_burndown_chart_path(project, sprint)}']",
+ text: 'Burndown Chart')
# Tasks can get a color per assigned user
visit my_settings_path
diff --git a/modules/backlogs/spec/features/work_packages/filter_spec.rb b/modules/backlogs/spec/features/work_packages/filter_spec.rb
index 062380cff03..364659094f9 100644
--- a/modules/backlogs/spec/features/work_packages/filter_spec.rb
+++ b/modules/backlogs/spec/features/work_packages/filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Filter by backlog type', js: true do
+RSpec.describe 'Filter by backlog type', :js do
let(:story_type) do
type = create(:type_feature)
project.types << type
diff --git a/modules/backlogs/spec/models/sprint_spec.rb b/modules/backlogs/spec/models/sprint_spec.rb
index bc9626979a0..438ef995829 100644
--- a/modules/backlogs/spec/models/sprint_spec.rb
+++ b/modules/backlogs/spec/models/sprint_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Sprint do
end
it {
- expect(Sprint.displayed_left(project)).to match_array [sprint]
+ expect(Sprint.displayed_left(project)).to contain_exactly(sprint)
}
end
@@ -58,7 +58,7 @@ RSpec.describe Sprint do
sprint.save
end
- it { expect(Sprint.displayed_left(project)).to match_array [sprint] }
+ it { expect(Sprint.displayed_left(project)).to contain_exactly(sprint) }
end
describe 'WITH no version setting defined' do
@@ -67,7 +67,7 @@ RSpec.describe Sprint do
sprint.save!
end
- it { expect(Sprint.displayed_left(project)).to match_array [sprint] }
+ it { expect(Sprint.displayed_left(project)).to contain_exactly(sprint) }
end
context 'WITH a shared version from another project' do
@@ -93,7 +93,7 @@ RSpec.describe Sprint do
describe 'WITH no version settings' do
it "includes the shared version by default" do
- expect(displayed).to match_array [version]
+ expect(displayed).to contain_exactly(version)
end
end
@@ -103,7 +103,7 @@ RSpec.describe Sprint do
end
it "includes the shared version" do
- expect(displayed).to match_array [version]
+ expect(displayed).to contain_exactly(version)
end
end
@@ -113,7 +113,7 @@ RSpec.describe Sprint do
end
it "includes the shared version" do
- expect(displayed).to match_array []
+ expect(displayed).to be_empty
end
end
@@ -123,7 +123,7 @@ RSpec.describe Sprint do
end
it "includes the shared version" do
- expect(displayed).to match_array [version]
+ expect(displayed).to contain_exactly(version)
end
end
@@ -133,7 +133,7 @@ RSpec.describe Sprint do
end
it "does not include the shared version" do
- expect(displayed).to match_array []
+ expect(displayed).to be_empty
end
end
@@ -144,7 +144,7 @@ RSpec.describe Sprint do
end
it "includes the shared version" do
- expect(displayed).to match_array [version]
+ expect(displayed).to contain_exactly(version)
end
end
@@ -155,7 +155,7 @@ RSpec.describe Sprint do
end
it "does not include the shared version" do
- expect(displayed).to match_array []
+ expect(displayed).to be_empty
end
end
@@ -166,7 +166,7 @@ RSpec.describe Sprint do
end
it "includes the shared version" do
- expect(displayed).to match_array [version]
+ expect(displayed).to contain_exactly(version)
end
end
@@ -177,7 +177,7 @@ RSpec.describe Sprint do
end
it "does not include the shared version" do
- expect(displayed).to match_array []
+ expect(displayed).to be_empty
end
end
end
@@ -190,7 +190,7 @@ RSpec.describe Sprint do
sprint.save!
end
- it { expect(Sprint.displayed_right(project)).to match_array [sprint] }
+ it { expect(Sprint.displayed_right(project)).to contain_exactly(sprint) }
end
describe '#order_by_date' do
diff --git a/modules/backlogs/spec/models/story_spec.rb b/modules/backlogs/spec/models/story_spec.rb
index a3dc518d572..9dfdcf89202 100644
--- a/modules/backlogs/spec/models/story_spec.rb
+++ b/modules/backlogs/spec/models/story_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe Story do
story1
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1) }
end
describe "WITH two sprints
@@ -103,8 +103,8 @@ RSpec.describe Story do
story2.save!
end
- it { expect(Story.backlogs(project, [version.id, version2.id])[version.id]).to match_array([story1]) }
- it { expect(Story.backlogs(project, [version.id, version2.id])[version2.id]).to match_array([story2]) }
+ it { expect(Story.backlogs(project, [version.id, version2.id])[version.id]).to contain_exactly(story1) }
+ it { expect(Story.backlogs(project, [version.id, version2.id])[version2.id]).to contain_exactly(story2) }
end
describe "WITH two sprints
@@ -119,7 +119,7 @@ RSpec.describe Story do
story2.save!
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1) }
it { expect(Story.backlogs(project, [version.id])[version2.id]).to be_empty }
end
@@ -141,7 +141,7 @@ RSpec.describe Story do
story2.save!
end
- it { expect(Story.backlogs(project, [version.id, version2.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id, version2.id])[version.id]).to contain_exactly(story1) }
it { expect(Story.backlogs(project, [version.id, version2.id])[version2.id]).to be_empty }
end
@@ -158,7 +158,7 @@ RSpec.describe Story do
story2.save!
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1) }
end
describe "WITH one sprint
@@ -170,7 +170,7 @@ RSpec.describe Story do
story1.save
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1, story2]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1, story2) }
end
describe "WITH one sprint
@@ -182,7 +182,7 @@ RSpec.describe Story do
task.save
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1) }
end
describe "WITH one sprint
@@ -193,7 +193,7 @@ RSpec.describe Story do
story1
end
- it { expect(Story.backlogs(project, [version.id])[version.id]).to match_array([story1]) }
+ it { expect(Story.backlogs(project, [version.id])[version.id]).to contain_exactly(story1) }
end
end
end
diff --git a/modules/backlogs/spec/models/work_package_spec.rb b/modules/backlogs/spec/models/work_package_spec.rb
index 0d1949a0b47..948bf9b8e25 100644
--- a/modules/backlogs/spec/models/work_package_spec.rb
+++ b/modules/backlogs/spec/models/work_package_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe WorkPackage do
it 'returns all the ids of types that are configures to be considered backlogs types' do
allow(Setting).to receive(:plugin_openproject_backlogs).and_return({ 'story_types' => [1], 'task_type' => 2 })
- expect(described_class.backlogs_types).to match_array([1, 2])
+ expect(described_class.backlogs_types).to contain_exactly(1, 2)
end
it 'returns an empty array if nothing is defined' do
@@ -44,10 +44,10 @@ RSpec.describe WorkPackage do
it 'reflects changes to the configuration' do
allow(Setting).to receive(:plugin_openproject_backlogs).and_return({ 'story_types' => [1], 'task_type' => 2 })
- expect(described_class.backlogs_types).to match_array([1, 2])
+ expect(described_class.backlogs_types).to contain_exactly(1, 2)
allow(Setting).to receive(:plugin_openproject_backlogs).and_return({ 'story_types' => [3], 'task_type' => 4 })
- expect(described_class.backlogs_types).to match_array([3, 4])
+ expect(described_class.backlogs_types).to contain_exactly(3, 4)
end
end
diff --git a/modules/backlogs/spec/support/pages/backlogs.rb b/modules/backlogs/spec/support/pages/backlogs.rb
index 8ba79b0f24b..68e1d8e9e7c 100644
--- a/modules/backlogs/spec/support/pages/backlogs.rb
+++ b/modules/backlogs/spec/support/pages/backlogs.rb
@@ -96,7 +96,7 @@ module Pages
find('input[name=subject]').native.send_key :return
expect(page)
- .not_to have_selector('input[name=subject]')
+ .to have_no_css('input[name=subject]')
end
if story
@@ -111,7 +111,7 @@ module Pages
find('input[name=name]').native.send_key :return
expect(page)
- .to have_selector('.start_date.editable')
+ .to have_css('.start_date.editable')
end
end
@@ -161,12 +161,12 @@ module Pages
def expect_sprint(sprint)
expect(page)
- .to have_selector("#sprint_backlogs_container #{backlog_selector(sprint)}")
+ .to have_css("#sprint_backlogs_container #{backlog_selector(sprint)}")
end
def expect_backlog(sprint)
expect(page)
- .to have_selector("#owner_backlogs_container #{backlog_selector(sprint)}")
+ .to have_css("#owner_backlogs_container #{backlog_selector(sprint)}")
end
def expect_story_in_sprint(story, sprint)
@@ -179,7 +179,7 @@ module Pages
def expect_story_not_in_sprint(story, sprint)
within_backlog(sprint) do
expect(page)
- .not_to have_selector(story_selector(story).to_s)
+ .to have_no_selector(story_selector(story).to_s)
end
end
@@ -189,13 +189,13 @@ module Pages
case key
when :subject
expect(page)
- .to have_selector('div.subject', text: value)
+ .to have_css('div.subject', text: value)
when :status
expect(page)
- .to have_selector('div.status_id', text: value)
+ .to have_css('div.status_id', text: value)
when :type
expect(page)
- .to have_selector('div.type_id', text: value)
+ .to have_css('div.type_id', text: value)
else
raise NotImplementedError
end
@@ -239,7 +239,7 @@ module Pages
find('.header .menu-trigger').click
expect(page)
- .to have_selector('.header .backlog-menu .item', text: item_name)
+ .to have_css('.header .backlog-menu .item', text: item_name)
# Close it again for next test
find('.header .menu-trigger').click
diff --git a/modules/backlogs/spec/support/pages/taskboard.rb b/modules/backlogs/spec/support/pages/taskboard.rb
index f1a9ddffee5..6c23d3b4896 100644
--- a/modules/backlogs/spec/support/pages/taskboard.rb
+++ b/modules/backlogs/spec/support/pages/taskboard.rb
@@ -45,13 +45,13 @@ module Pages
def expect_task(task)
expect(page)
- .to have_selector("#work_package_#{task.id}")
+ .to have_css("#work_package_#{task.id}")
end
def expect_task_in_story_column(task, story, column)
within ".story_#{story.id} td:nth-of-type(#{column + 2})" do
expect(page)
- .to have_selector("#work_package_#{task.id}")
+ .to have_css("#work_package_#{task.id}")
end
end
@@ -62,7 +62,7 @@ module Pages
def expect_color_for_task(hex_color, task)
expect(page)
- .to have_selector("#work_package_#{task.id}[style='background-color:#{hex_color};']")
+ .to have_css("#work_package_#{task.id}[style='background-color:#{hex_color};']")
end
def add_task(story, attributes)
@@ -70,8 +70,8 @@ module Pages
change_attributes_in_modal(attributes)
- expect(page).not_to have_selector('.ui-dialog')
- expect(page).not_to have_selector('#work_package_')
+ expect(page).to have_no_css('.ui-dialog')
+ expect(page).to have_no_css('#work_package_')
end
def update_task(task, attributes)
@@ -79,7 +79,7 @@ module Pages
change_attributes_in_modal(attributes)
- expect(page).not_to have_selector('.ui-dialog')
+ expect(page).to have_no_css('.ui-dialog')
sleep(0.5)
end
diff --git a/modules/backlogs/spec/views/rb_taskboards/show_spec.rb b/modules/backlogs/spec/views/rb_taskboards/show_spec.rb
index 94473509a94..434f3f11ef4 100644
--- a/modules/backlogs/spec/views/rb_taskboards/show_spec.rb
+++ b/modules/backlogs/spec/views/rb_taskboards/show_spec.rb
@@ -104,7 +104,7 @@ RSpec.describe 'rb_taskboards/show' do
render
stories.each do |story|
- expect(rendered).to have_selector("#story_#{story.id} .id", text: story.id.to_s)
+ expect(rendered).to have_css("#story_#{story.id} .id", text: story.id.to_s)
end
end
@@ -112,7 +112,7 @@ RSpec.describe 'rb_taskboards/show' do
render
stories.each do |story|
- expect(rendered).to have_selector("#story_#{story.id} .subject", text: story.subject)
+ expect(rendered).to have_css("#story_#{story.id} .subject", text: story.subject)
end
end
@@ -120,7 +120,7 @@ RSpec.describe 'rb_taskboards/show' do
render
stories.each do |story|
- expect(rendered).to have_selector("#story_#{story.id} .status", text: story.status.name)
+ expect(rendered).to have_css("#story_#{story.id} .status", text: story.status.name)
end
end
@@ -132,7 +132,7 @@ RSpec.describe 'rb_taskboards/show' do
stories.each do |story|
expected_text = story.assigned_to ? story.assigned_to.name : 'Unassigned'
- expect(rendered).to have_selector("#story_#{story.id} .assigned_to_id", text: expected_text)
+ expect(rendered).to have_css("#story_#{story.id} .assigned_to_id", text: expected_text)
end
end
end
@@ -160,7 +160,7 @@ RSpec.describe 'rb_taskboards/show' do
stories.each do |story|
assert_select "tr.story_#{story.id} td.add_new" do |td|
expect(td.count).to eq 1
- expect(td.first).not_to have_content '+'
+ expect(td.first).to have_no_content '+'
expect(td.first[:class]).not_to include 'clickable'
end
end
@@ -188,7 +188,7 @@ RSpec.describe 'rb_taskboards/show' do
stories.each do |_story|
assert_select '#impediments td.add_new' do |td|
expect(td.count).to eq 1
- expect(td.first).not_to have_content '+'
+ expect(td.first).to have_no_content '+'
expect(td.first[:class]).not_to include 'clickable'
end
end
@@ -204,7 +204,7 @@ RSpec.describe 'rb_taskboards/show' do
assert_select '.model.work_package.task' do |task|
expect(task.count).to eq 1
- expect(task.first).not_to have_css '.task.prevent_edit'
+ expect(task.first).to have_no_css '.task.prevent_edit'
end
end
@@ -230,7 +230,7 @@ RSpec.describe 'rb_taskboards/show' do
assert_select '.model.work_package.impediment' do |impediment|
expect(impediment.count).to eq 3 # 2 additional for the task and the invisible form
- expect(impediment.first).not_to have_css '.impediment.prevent_edit'
+ expect(impediment.first).to have_no_css '.impediment.prevent_edit'
end
end
diff --git a/modules/bim/app/models/bim/ifc_models/ifc_model.rb b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
index c72073e8c27..6669205c231 100644
--- a/modules/bim/app/models/bim/ifc_models/ifc_model.rb
+++ b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
@@ -21,11 +21,11 @@ module Bim
scope :defaults, -> { where(is_default: true) }
%i(ifc xkt).each do |name|
- define_method "#{name}_attachment" do
+ define_method :"#{name}_attachment" do
get_attached_type(name)
end
- define_method "#{name}_attachment=" do |file|
+ define_method :"#{name}_attachment=" do |file|
if name == :ifc
# Also delete xkt
delete_attachment :xkt
diff --git a/modules/bim/app/services/bim/bcf/comments/create_service.rb b/modules/bim/app/services/bim/bcf/comments/create_service.rb
index 9cfdc293081..b0937bb38ff 100644
--- a/modules/bim/app/services/bim/bcf/comments/create_service.rb
+++ b/modules/bim/app/services/bim/bcf/comments/create_service.rb
@@ -39,7 +39,7 @@ module Bim::Bcf
input = { journal: journal_call.result }
.merge(params)
.slice(*::Bim::Bcf::Comment::CREATE_ATTRIBUTES)
- super input, service_result
+ super(input, service_result)
end
def create_journal(work_package, comment)
diff --git a/modules/bim/app/services/bim/bcf/comments/update_service.rb b/modules/bim/app/services/bim/bcf/comments/update_service.rb
index d9f9157d84d..89247ca2eff 100644
--- a/modules/bim/app/services/bim/bcf/comments/update_service.rb
+++ b/modules/bim/app/services/bim/bcf/comments/update_service.rb
@@ -35,7 +35,7 @@ module Bim::Bcf
journal_call = update_journal(params[:original_comment].journal, params[:comment])
return journal_call if journal_call.failure?
- super params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES), service_result
+ super(params.slice(*::Bim::Bcf::Comment::UPDATE_ATTRIBUTES), service_result)
end
def update_journal(journal, comment)
diff --git a/modules/bim/app/services/bim/bcf/issues/create_service.rb b/modules/bim/app/services/bim/bcf/issues/create_service.rb
index ca3d5dd99d2..160c3a35757 100644
--- a/modules/bim/app/services/bim/bcf/issues/create_service.rb
+++ b/modules/bim/app/services/bim/bcf/issues/create_service.rb
@@ -35,7 +35,7 @@ module Bim::Bcf
wp_call = get_work_package params
return wp_call if wp_call.failure?
- super issue_params(work_package: wp_call.result, params:), service_result
+ super(issue_params(work_package: wp_call.result, params:), service_result)
end
def issue_params(work_package:, params:)
diff --git a/modules/bim/app/services/bim/ifc_models/create_service.rb b/modules/bim/app/services/bim/ifc_models/create_service.rb
index 79380cec8c5..7e8ae367447 100644
--- a/modules/bim/app/services/bim/ifc_models/create_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/create_service.rb
@@ -24,7 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-#+
+# +
module Bim
module IfcModels
diff --git a/modules/bim/app/services/bim/ifc_models/update_service.rb b/modules/bim/app/services/bim/ifc_models/update_service.rb
index eae54743d67..151c0b84eeb 100644
--- a/modules/bim/app/services/bim/ifc_models/update_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/update_service.rb
@@ -24,7 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-#+
+# +
module Bim
module IfcModels
diff --git a/modules/bim/app/services/bim/ifc_models/view_converter_service.rb b/modules/bim/app/services/bim/ifc_models/view_converter_service.rb
index 617712dfb29..a632ac0ce09 100644
--- a/modules/bim/app/services/bim/ifc_models/view_converter_service.rb
+++ b/modules/bim/app/services/bim/ifc_models/view_converter_service.rb
@@ -24,7 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-#+
+# +
require 'open3'
module Bim
diff --git a/modules/bim/db/migrate/20201105154216_seed_custom_style_with_bim_theme.rb b/modules/bim/db/migrate/20201105154216_seed_custom_style_with_bim_theme.rb
index b930be48d7e..a116bee6acb 100644
--- a/modules/bim/db/migrate/20201105154216_seed_custom_style_with_bim_theme.rb
+++ b/modules/bim/db/migrate/20201105154216_seed_custom_style_with_bim_theme.rb
@@ -72,7 +72,7 @@ class SeedCustomStyleWithBimTheme < ActiveRecord::Migration[6.0]
end
def set_custom_style
- custom_style = (CustomStyle.current || CustomStyle.create!)
+ custom_style = CustomStyle.current || CustomStyle.create!
custom_style.attributes = { theme: theme[:theme], theme_logo: theme[:logo] }
custom_style.save!
custom_style
diff --git a/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb b/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
index dd764808163..36e7240f16f 100644
--- a/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
+++ b/modules/bim/lib/open_project/bim/bcf_json/viewpoint_reader.rb
@@ -5,7 +5,7 @@ require 'bigdecimal'
module OpenProject::Bim
module BcfJson
class ViewpointReader
- ROOT_NODE ||= 'VisualizationInfo'.freeze
+ ROOT_NODE ||= 'VisualizationInfo'
attr_reader :uuid, :xml
diff --git a/modules/bim/lib/open_project/bim/bcf_xml.rb b/modules/bim/lib/open_project/bim/bcf_xml.rb
index e482478d12d..2819f10f9fa 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml.rb
@@ -1,5 +1,5 @@
module OpenProject::Bim
module Bcf
- require_relative './bcf_xml/importer'
+ require_relative 'bcf_xml/importer'
end
end
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
index 1e6dd688960..f29441b67cc 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/issue_writer.rb
@@ -101,7 +101,7 @@ module OpenProject::Bim::BcfXml
.select(&:element?)
.group_by(&:name)
- sequence.reverse.each do |name|
+ sequence.reverse_each do |name|
if children_with_name = children_by_name[name]
children_with_name.each do |child|
parent_node.delete child
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
index ee245d179ca..5b7c4abc963 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/viewpoint_writer.rb
@@ -42,8 +42,8 @@ module OpenProject::Bim::BcfXml
{ Guid: viewpoint.uuid }
end
- def dig_json(*args)
- viewpoint.json_viewpoint.dig(*args)
+ def dig_json(*)
+ viewpoint.json_viewpoint.dig(*)
end
def components(xml)
@@ -165,7 +165,7 @@ module OpenProject::Bim::BcfXml
hash.transform_keys do |key|
# `camelize` uses the inflections of ActiveSupport. There we defined inflections for `IFC`. However, here we
# don't want that applied here. `ifc_foo` shall be converted to `IfcFoo` and not to `IFCFoo`.
- key.camelize.gsub(/IFC/, 'Ifc')
+ key.camelize.gsub("IFC", 'Ifc')
end
end
diff --git a/modules/bim/lib/open_project/bim/hooks.rb b/modules/bim/lib/open_project/bim/hooks.rb
index e57664b48a6..5f01bbb2247 100644
--- a/modules/bim/lib/open_project/bim/hooks.rb
+++ b/modules/bim/lib/open_project/bim/hooks.rb
@@ -24,7 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-#+
+# +
module OpenProject::Bim::Hooks
class Hook < OpenProject::Hook::Listener
diff --git a/modules/bim/spec/bcf/bcf_xml/importer_spec.rb b/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
index 68d84e7be91..3b83d63d360 100644
--- a/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/importer_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe OpenProject::Bim::BcfXml::Importer do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/octet-stream'
)
end
@@ -95,8 +95,8 @@ RSpec.describe OpenProject::Bim::BcfXml::Importer do
it 'creates 2 work packages' do
subject.import!
- expect(Bim::Bcf::Issue.count).to be_eql 2
- expect(WorkPackage.count).to be_eql 2
+ expect(Bim::Bcf::Issue.count).to eql 2
+ expect(WorkPackage.count).to eql 2
end
end
diff --git a/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb b/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
index e2267f92705..9cf3f54c007 100644
--- a/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/issue_writer_spec.rb
@@ -120,25 +120,25 @@ RSpec.describe OpenProject::Bim::BcfXml::IssueWriter do
expect(subject.at('Markup')).to be_present
expect(subject.at('Topic')).to be_present
- expect(subject.at('Topic/@Guid').content).to be_eql bcf_issue.uuid
- expect(subject.at('Topic/@TopicStatus').content).to be_eql work_package.status.name
- expect(subject.at('Topic/@TopicType').content).to be_eql 'Issue'
-
- expect(subject.at('Topic/Title').content).to be_eql work_package.subject
- expect(subject.at('Topic/CreationDate').content).to be_eql work_package.created_at.iso8601
- expect(subject.at('Topic/ModifiedDate').content).to be_eql work_package.updated_at.iso8601
- expect(subject.at('Topic/Description').content).to be_eql work_package.description
- expect(subject.at('Topic/CreationAuthor').content).to be_eql work_package.author.mail
- expect(subject.at('Topic/ReferenceLink').content).to be_eql url_helpers.work_package_url(work_package)
- expect(subject.at('Topic/Priority').content).to be_eql work_package.priority.name
- expect(subject.at('Topic/ModifiedAuthor').content).to be_eql work_package.journals.last.user.mail
- expect(subject.at('Topic/AssignedTo').content).to be_eql work_package.assigned_to.mail
- expect(subject.at('Topic/DueDate').content).to be_eql work_package.due_date.to_datetime.iso8601
+ expect(subject.at('Topic/@Guid').content).to eql bcf_issue.uuid
+ expect(subject.at('Topic/@TopicStatus').content).to eql work_package.status.name
+ expect(subject.at('Topic/@TopicType').content).to eql 'Issue'
+
+ expect(subject.at('Topic/Title').content).to eql work_package.subject
+ expect(subject.at('Topic/CreationDate').content).to eql work_package.created_at.iso8601
+ expect(subject.at('Topic/ModifiedDate').content).to eql work_package.updated_at.iso8601
+ expect(subject.at('Topic/Description').content).to eql work_package.description
+ expect(subject.at('Topic/CreationAuthor').content).to eql work_package.author.mail
+ expect(subject.at('Topic/ReferenceLink').content).to eql url_helpers.work_package_url(work_package)
+ expect(subject.at('Topic/Priority').content).to eql work_package.priority.name
+ expect(subject.at('Topic/ModifiedAuthor').content).to eql work_package.journals.last.user.mail
+ expect(subject.at('Topic/AssignedTo').content).to eql work_package.assigned_to.mail
+ expect(subject.at('Topic/DueDate').content).to eql work_package.due_date.to_datetime.iso8601
end
end
def valid_markup?(doc)
- schema = Nokogiri::XML::Schema(File.read(File.join(Rails.root, 'modules/bim/spec/bcf/bcf_xml/markup.xsd')))
+ schema = Nokogiri::XML::Schema(File.read(Rails.root.join("modules/bim/spec/bcf/bcf_xml/markup.xsd").to_s))
errors = schema.validate(doc)
if errors.empty?
true
@@ -166,8 +166,8 @@ RSpec.describe OpenProject::Bim::BcfXml::IssueWriter do
it_behaves_like 'valid markup'
it "maintains existing nodes and attributes untouched" do
- expect(subject.at('Index').content).to be_eql "0"
- expect(subject.at('BimSnippet')['SnippetType']).to be_eql "JSON"
+ expect(subject.at('Index').content).to eql "0"
+ expect(subject.at('BimSnippet')['SnippetType']).to eql "JSON"
end
it 'exports all BCF comments' do
diff --git a/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb b/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
index 77e5bf1a5f4..110f71ce864 100644
--- a/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
+++ b/modules/bim/spec/bcf/bcf_xml/markup_extractor_spec.rb
@@ -32,7 +32,7 @@ RSpec.describe OpenProject::Bim::BcfXml::MarkupExtractor do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/octet-stream'
)
end
@@ -51,35 +51,35 @@ RSpec.describe OpenProject::Bim::BcfXml::MarkupExtractor do
end
it '#uuid' do
- expect(subject.uuid).to be_eql '63E78882-7C6A-4BF7-8982-FC478AFB9C97'
+ expect(subject.uuid).to eql '63E78882-7C6A-4BF7-8982-FC478AFB9C97'
end
it '#title' do
- expect(subject.title).to be_eql 'Maximum Content'
+ expect(subject.title).to eql 'Maximum Content'
end
it '#priority' do
- expect(subject.priority).to be_eql 'High'
+ expect(subject.priority).to eql 'High'
end
it '#status' do
- expect(subject.status).to be_eql 'Open'
+ expect(subject.status).to eql 'Open'
end
it '#description' do
- expect(subject.description).to be_eql 'This is a topic with all information present.'
+ expect(subject.description).to eql 'This is a topic with all information present.'
end
it '#author' do
- expect(subject.author).to be_eql '[email protected]'
+ expect(subject.author).to eql '[email protected]'
end
it '#modified_author' do
- expect(subject.modified_author).to be_eql '[email protected]'
+ expect(subject.modified_author).to eql '[email protected]'
end
it '#assignee' do
- expect(subject.assignee).to be_eql '[email protected]'
+ expect(subject.assignee).to eql '[email protected]'
end
it '#due_date' do
diff --git a/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb b/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
index a63081a665a..4b5a1690a24 100644
--- a/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/bcf/issues/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Bim::Bcf::Issues::CreateContract do
it_behaves_like 'issues contract' do
diff --git a/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb b/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
index 347b80fdaca..a17020e2850 100644
--- a/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
+++ b/modules/bim/spec/contracts/bcf/issues/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Bim::Bcf::Issues::UpdateContract do
it_behaves_like 'issues contract' do
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 895ad05c7f8..7484466bcb4 100644
--- a/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
+++ b/modules/bim/spec/contracts/ifc_models/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Bim::IfcModels::CreateContract do
it_behaves_like 'ifc model contract' do
diff --git a/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb b/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
index 3ef87109129..422c0bae85a 100644
--- a/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
+++ b/modules/bim/spec/contracts/ifc_models/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Bim::IfcModels::UpdateContract do
it_behaves_like 'ifc model contract' do
diff --git a/modules/bim/spec/controllers/issues_controller_spec.rb b/modules/bim/spec/controllers/issues_controller_spec.rb
index 5b6daf669be..f80460faac8 100644
--- a/modules/bim/spec/controllers/issues_controller_spec.rb
+++ b/modules/bim/spec/controllers/issues_controller_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe Bim::Bcf::IssuesController do
context 'not member of project' do
let(:bcf_manager_member) {}
- it 'will return "not authorized"' do
+ it 'returns "not authorized"' do
expect(response).not_to be_successful
end
end
@@ -83,7 +83,7 @@ RSpec.describe Bim::Bcf::IssuesController do
roles: [collaborator_role])
end
- it 'will return "not authorized"' do
+ it 'returns "not authorized"' do
expect(response).not_to be_successful
end
end
@@ -105,7 +105,7 @@ RSpec.describe Bim::Bcf::IssuesController do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/zip'
)
end
@@ -137,7 +137,7 @@ RSpec.describe Bim::Bcf::IssuesController do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/octet-stream'
)
end
@@ -165,7 +165,7 @@ RSpec.describe Bim::Bcf::IssuesController do
let(:filename) { 'MaximumInformation.bcf' }
let(:file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/octet-stream'
)
end
diff --git a/modules/bim/spec/factories/ifc_model_factory.rb b/modules/bim/spec/factories/ifc_model_factory.rb
index 3e58ac4dc7d..cdb4f9a6c88 100644
--- a/modules/bim/spec/factories/ifc_model_factory.rb
+++ b/modules/bim/spec/factories/ifc_model_factory.rb
@@ -35,7 +35,7 @@ FactoryBot.define do
transient do
ifc_attachment do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/minimal.ifc"),
+ Rails.root.join("modules/bim/spec/fixtures/files/minimal.ifc").to_s,
'application/binary'
)
end
@@ -55,7 +55,7 @@ FactoryBot.define do
transient do
xkt_attachment do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/minimal.xkt"),
+ Rails.root.join("modules/bim/spec/fixtures/files/minimal.xkt").to_s,
'application/binary'
)
end
diff --git a/modules/bim/spec/features/bcf/api_authorization_spec.rb b/modules/bim/spec/features/bcf/api_authorization_spec.rb
index d55a03964b0..eeb822dcb72 100644
--- a/modules/bim/spec/features/bcf/api_authorization_spec.rb
+++ b/modules/bim/spec/features/bcf/api_authorization_spec.rb
@@ -118,7 +118,7 @@ RSpec.describe 'authorization for BCF api', :js, with_config: { edition: 'bim' }
visit my_account_path
click_on 'Access token'
- expect(page).to have_selector("#oauth-application-grant-#{app.id}", text: app.name)
+ expect(page).to have_css("#oauth-application-grant-#{app.id}", text: app.name)
expect(page).to have_css('td', text: app.name)
# While being logged in, the api can be accessed with the session
diff --git a/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
index 52ecea4b7d4..02a41b1a13b 100644
--- a/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
+++ b/modules/bim/spec/features/bcf/bcf_snapshot_column_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-RSpec.describe 'BCF snapshot column',
- js: true,
+RSpec.describe 'BCF snapshot column', :js,
with_config: { edition: 'bim' } do
let(:project) { create(:project, enabled_module_names: %w[bim work_package_tracking]) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -32,7 +31,7 @@ RSpec.describe 'BCF snapshot column',
page.within(".wp-row-#{work_package.id} td.bcfThumbnail") do
image_path = "/api/bcf/2.1/projects/#{project.identifier}/topics/#{bcf_issue.uuid}/viewpoints/#{bcf_issue.viewpoints.first.uuid}/snapshot"
- expect(page).to have_selector("img[src=\"#{image_path}\"]")
+ expect(page).to have_css("img[src=\"#{image_path}\"]")
end
end
end
diff --git a/modules/bim/spec/features/bcf/export_spec.rb b/modules/bim/spec/features/bcf/export_spec.rb
index e2dec51b011..a18724bd9af 100644
--- a/modules/bim/spec/features/bcf/export_spec.rb
+++ b/modules/bim/spec/features/bcf/export_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
require_relative '../../support/pages/ifc_models/show_default'
-RSpec.describe 'bcf export',
- js: true,
+RSpec.describe 'bcf export', :js,
with_config: { edition: 'bim' } do
let(:status) { create(:status, name: 'New', is_default: true) }
let(:closed_status) { create(:closed_status, name: 'Closed') }
diff --git a/modules/bim/spec/features/bcf_view_management_spec.rb b/modules/bim/spec/features/bcf_view_management_spec.rb
index 4e21547765a..d153b63df10 100644
--- a/modules/bim/spec/features/bcf_view_management_spec.rb
+++ b/modules/bim/spec/features/bcf_view_management_spec.rb
@@ -31,8 +31,7 @@ require 'spec_helper'
require_relative '../support/pages/ifc_models/show_default'
require_relative '../../../../spec/features/views/shared_examples'
-RSpec.describe 'bcf view management',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'bcf view management', :js, 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 eff44117660..78fcde873f7 100644
--- a/modules/bim/spec/features/bim_filter_spec.rb
+++ b/modules/bim/spec/features/bim_filter_spec.rb
@@ -31,8 +31,7 @@ require 'spec_helper'
require_relative '../support/pages/ifc_models/show'
require_relative '../support/pages/ifc_models/show_default'
-RSpec.describe 'BIM filter spec',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'BIM filter spec', :js, 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 6e379f0546f..8c519796f9c 100644
--- a/modules/bim/spec/features/bim_navigation_spec.rb
+++ b/modules/bim/spec/features/bim_navigation_spec.rb
@@ -28,8 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'BIM navigation spec',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'BIM navigation spec', :js, 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/ifc_models/direct_ifc_upload_spec.rb b/modules/bim/spec/features/ifc_models/direct_ifc_upload_spec.rb
index fa7e612fd1c..e8f9acd7de3 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
@@ -27,9 +27,9 @@
#++
require 'spec_helper'
-require_relative './ifc_upload_shared_examples'
+require_relative 'ifc_upload_shared_examples'
-RSpec.describe 'direct IFC upload', js: true, with_config: { edition: 'bim' }, with_direct_uploads: :redirect do
+RSpec.describe 'direct IFC upload', :js, 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/regular_ifc_upload_spec.rb b/modules/bim/spec/features/ifc_models/regular_ifc_upload_spec.rb
index c7051e6d2f6..d52fd4f7b9f 100644
--- a/modules/bim/spec/features/ifc_models/regular_ifc_upload_spec.rb
+++ b/modules/bim/spec/features/ifc_models/regular_ifc_upload_spec.rb
@@ -27,9 +27,9 @@
#++
require 'spec_helper'
-require_relative './ifc_upload_shared_examples'
+require_relative 'ifc_upload_shared_examples'
-RSpec.describe 'IFC upload', js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'IFC upload', :js, with_config: { edition: 'bim' } do
it_behaves_like 'can upload an IFC file' do
let(:model_name) { 'minimal.ifc' }
end
diff --git a/modules/bim/spec/features/model_management_spec.rb b/modules/bim/spec/features/model_management_spec.rb
index 26c410c8d43..427d82c23f3 100644
--- a/modules/bim/spec/features/model_management_spec.rb
+++ b/modules/bim/spec/features/model_management_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/ifc_models/index'
-RSpec.describe 'model management',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'model management', :js, 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(:project_role, permissions: %i[view_ifc_models manage_bcf manage_ifc_models view_work_packages]) }
@@ -131,7 +130,7 @@ RSpec.describe 'model management',
it "I can't see any models and perform no actions" do
expected = '[Error 403] You are not authorized to access this page.'
- expect(page).to have_selector('.op-toast.-error', text: expected)
+ expect(page).to have_css('.op-toast.-error', text: expected)
index_page.add_model_allowed false
end
diff --git a/modules/bim/spec/features/model_viewer_spec.rb b/modules/bim/spec/features/model_viewer_spec.rb
index 27a16673068..5d094cceff7 100644
--- a/modules/bim/spec/features/model_viewer_spec.rb
+++ b/modules/bim/spec/features/model_viewer_spec.rb
@@ -28,8 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'model viewer',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'model viewer', :js, 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:) }
@@ -94,7 +93,7 @@ RSpec.describe 'model viewer',
it 'shows a warning that no IFC models exist yet' do
login_as user
visit defaults_bcf_project_ifc_models_path(project)
- expect(page).to have_selector('.op-toast.-info', text: I18n.t('js.ifc_models.empty_warning'))
+ expect(page).to have_css('.op-toast.-info', text: I18n.t('js.ifc_models.empty_warning'))
end
end
end
@@ -135,7 +134,7 @@ RSpec.describe 'model viewer',
it 'shows no viewer' do
expected = '[Error 403] You are not authorized to access this page.'
- expect(page).to have_selector('.op-toast.-error', text: expected)
+ expect(page).to have_css('.op-toast.-error', text: expected)
show_model_page.model_viewer_visible false
show_model_page.model_viewer_shows_a_toolbar false
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 9fdb332a3be..3f158eb52b4 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
@@ -28,8 +28,8 @@
require_relative '../../spec_helper'
-RSpec.describe 'BIM Revit Add-in navigation spec',
- driver: :chrome_revit_add_in, js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'BIM Revit Add-in navigation spec', :js,
+ driver: :chrome_revit_add_in, 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
@@ -71,7 +71,7 @@ RSpec.describe 'BIM Revit Add-in navigation spec',
within '.op-app-header' do
page.find("a[title='#{user.name}']").click
- expect(page).to have_selector('li', text: I18n.t('js.revit.revit_add_in_settings'))
+ expect(page).to have_css('li', text: I18n.t('js.revit.revit_add_in_settings'))
end
end
@@ -81,14 +81,14 @@ RSpec.describe 'BIM Revit Add-in navigation spec',
find('.menu-item', text: 'NONE', wait: 10).click
full_create.edit_field(:subject).expect_active!
- expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: :all)
+ expect(page).to have_css('.work-packages-partitioned-page--content-right', visible: :all)
end
it 'shows work package details page in full view on Cards display mode' do
model_page.click_info_icon(work_package)
- expect(page).to have_selector('.work-packages-partitioned-page--content-left', text: work_package.subject)
- expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: :all)
+ expect(page).to have_css('.work-packages-partitioned-page--content-left', text: work_package.subject)
+ expect(page).to have_css('.work-packages-partitioned-page--content-right', visible: :all)
end
context 'with the table display mode' do
@@ -98,12 +98,12 @@ RSpec.describe 'BIM Revit Add-in navigation spec',
model_page.switch_view 'Table'
loading_indicator_saveguard
- expect(page).to have_selector('.work-package-table')
+ expect(page).to have_css('.work-package-table')
wp_table.expect_work_package_listed work_package
wp_table.open_split_view work_package
- expect(page).to have_selector('.work-packages-partitioned-page--content-left', text: work_package.subject)
- expect(page).to have_selector('.work-packages-partitioned-page--content-right', visible: false)
+ expect(page).to have_css('.work-packages-partitioned-page--content-left', text: work_package.subject)
+ expect(page).to have_css('.work-packages-partitioned-page--content-right', visible: false)
end
end
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 30759fb1255..758064b33da 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
@@ -28,8 +28,8 @@
require_relative '../../spec_helper'
-RSpec.describe 'BIM Revit Add-in navigation spec',
- driver: :chrome_revit_add_in, js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'BIM Revit Add-in navigation spec', :js,
+ driver: :chrome_revit_add_in, 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 7f77b68aee3..3163e734062 100644
--- a/modules/bim/spec/features/show_default_spec.rb
+++ b/modules/bim/spec/features/show_default_spec.rb
@@ -28,8 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'show default model',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'show default model', :js, 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 ba184f3a9c4..10084b3cfbf 100644
--- a/modules/bim/spec/features/viewer/create_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/create_viewpoint_spec.rb
@@ -28,8 +28,7 @@
require_relative '../../spec_helper'
-RSpec.describe 'Create viewpoint from BCF details page',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'Create viewpoint from BCF details page', :js, 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 7419790fe26..e5f9c38800d 100644
--- a/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/delete_viewpoint_spec.rb
@@ -28,8 +28,7 @@
require_relative '../../spec_helper'
-RSpec.describe 'Delete viewpoint in model viewer',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'Delete viewpoint in model viewer', :js, 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 ee4c539cea1..9b0bcf7108d 100644
--- a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
@@ -28,8 +28,7 @@
require_relative '../../spec_helper'
-RSpec.describe 'Show viewpoint in model viewer',
- js: true, with_config: { edition: 'bim' } do
+RSpec.describe 'Show viewpoint in model viewer', :js, with_config: { edition: 'bim' } do
let(:project) do
create(:project,
enabled_module_names: %i[bim work_package_tracking],
@@ -144,7 +143,7 @@ RSpec.describe 'Show viewpoint in model viewer',
it 'does not show the viewpoint' do
wp_details.visit!
bcf_details.expect_viewpoint_count(0)
- expect(page).not_to have_selector('h3.attributes-group--header-text', text: 'BCF')
+ expect(page).to have_no_css('h3.attributes-group--header-text', text: 'BCF')
end
end
end
diff --git a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
index 4875ac72ee9..133f9250cc6 100644
--- a/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
+++ b/modules/bim/spec/lib/open_project/bcf/bcf_json/viewpoint_reader_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './viewpoint_reader_shared_examples'
+require_relative 'viewpoint_reader_shared_examples'
RSpec.describe OpenProject::Bim::BcfJson::ViewpointReader do
let(:instance) { described_class.new xml_viewpoint.uuid, xml_viewpoint.viewpoint }
diff --git a/modules/bim/spec/models/bcf/issue_spec.rb b/modules/bim/spec/models/bcf/issue_spec.rb
index 1147504edef..ed3dceada29 100644
--- a/modules/bim/spec/models/bcf/issue_spec.rb
+++ b/modules/bim/spec/models/bcf/issue_spec.rb
@@ -42,14 +42,14 @@ RSpec.describe Bim::Bcf::Issue do
it "caches the document" do
first_fetched_doc = subject.markup_doc
- expect(subject.markup_doc).to be_eql(first_fetched_doc)
+ expect(subject.markup_doc).to eql(first_fetched_doc)
end
it "invalidates the cache after an update of the issue" do
first_fetched_doc = subject.markup_doc
subject.markup = subject.markup + ' '
subject.save
- expect(subject.markup_doc).not_to be_eql(first_fetched_doc)
+ expect(subject.markup_doc).not_to eql(first_fetched_doc)
end
end
@@ -59,7 +59,7 @@ RSpec.describe Bim::Bcf::Issue do
it 'returns all issues of the provided project' do
expect(described_class.of_project(issue.project))
- .to match_array [issue]
+ .to contain_exactly(issue)
end
end
end
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/auth_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/auth_api_spec.rb
index 8edaf10145f..a60ec1ddcbf 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/auth_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/auth_api_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'rack/test'
-require_relative './shared_responses'
+require_relative 'shared_responses'
RSpec.describe 'BCF 2.1 auth resource', content_type: :json do
include Rack::Test::Methods
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/current_user_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/current_user_api_spec.rb
index 8d485890199..9b226a1a9be 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/current_user_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/current_user_api_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'rack/test'
-require_relative './shared_responses'
+require_relative 'shared_responses'
RSpec.describe 'BCF 2.1 current-user resource', content_type: :json do
include Rack::Test::Methods
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/project_extensions_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/project_extensions_api_spec.rb
index a45f1478948..34d9a7ac2d3 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/project_extensions_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/project_extensions_api_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'rack/test'
-require_relative './shared_responses'
+require_relative 'shared_responses'
RSpec.describe 'BCF 2.1 project extensions resource', content_type: :json do
include Rack::Test::Methods
diff --git a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
index 49413343a9d..8ae31ca303c 100644
--- a/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf/v2_1/viewpoints_api_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'rack/test'
-require_relative './shared_responses'
+require_relative 'shared_responses'
RSpec.describe 'BCF 2.1 viewpoints resource', content_type: :json do
include Rack::Test::Methods
diff --git a/modules/bim/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb b/modules/bim/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb
index e7fe2c7142b..69cb65849fd 100644
--- a/modules/bim/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb
+++ b/modules/bim/spec/requests/api/bcf_xml/v1/bcf_xml_api_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe 'BCF XML API v1 bcf_xml resource' do
let(:filename) { 'MaximumInformation.bcf' }
let(:bcf_xml_file) do
Rack::Test::UploadedFile.new(
- File.join(Rails.root, "modules/bim/spec/fixtures/files/#{filename}"),
+ Rails.root.join("modules/bim/spec/fixtures/files/#{filename}").to_s,
'application/octet-stream'
)
end
diff --git a/modules/bim/spec/support/components/bcf_details_viewpoints.rb b/modules/bim/spec/support/components/bcf_details_viewpoints.rb
index 8c76f44d3ea..084f468b0fc 100644
--- a/modules/bim/spec/support/components/bcf_details_viewpoints.rb
+++ b/modules/bim/spec/support/components/bcf_details_viewpoints.rb
@@ -29,11 +29,11 @@
module Components
module BcfDetailsViewpoints
def expect_viewpoint_count(number)
- expect(page).to have_selector('a.ngx-gallery-thumbnail', visible: :all, count: number, wait: 20)
+ expect(page).to have_css('a.ngx-gallery-thumbnail', visible: :all, count: number, wait: 20)
end
def expect_no_viewpoint_addable
- expect(page).not_to have_selector('a.button', text: 'Viewpoint')
+ expect(page).to have_no_css('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 7366ecc1dca..737013cb593 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).not_to have_selector('.button.-alt-highlight', text: 'IFC model')
+ expect(page).to have_no_css('.button.-alt-highlight', text: 'IFC model')
end
end
@@ -69,14 +69,14 @@ module Pages
def edit_model_allowed(model_name, allowed)
row = find_model_table_row model_name
within row do
- expect(page).to (allowed ? have_selector('.icon-edit') : have_no_selector('.icon-edit'))
+ expect(page).to (allowed ? have_css('.icon-edit') : have_no_selector('.icon-edit'))
end
end
def delete_model_allowed(model_name, allowed)
row = find_model_table_row model_name
within row do
- expect(page).to (allowed ? have_selector('.icon-edit') : have_no_selector('.icon-edit'))
+ expect(page).to (allowed ? have_css('.icon-edit') : have_no_selector('.icon-edit'))
end
end
@@ -153,7 +153,7 @@ module Pages
end
def change_model_name(model_name, new_name)
- expect(page).to have_selector('input[type="file"]')
+ expect(page).to have_css('input[type="file"]')
expect(page).to have_field('bim_ifc_models_ifc_model[title]', with: model_name)
fill_in 'bim_ifc_models_ifc_model[title]', with: new_name
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 0a11dd4b4dd..0b4fb31ba45 100644
--- a/modules/bim/spec/support/pages/ifc_models/show_default.rb
+++ b/modules/bim/spec/support/pages/ifc_models/show_default.rb
@@ -58,7 +58,7 @@ module Pages
end
def finished_loading
- expect(page).to have_selector('.xeokit-busy-modal', visible: :all, wait: 30)
+ expect(page).to have_css('.xeokit-busy-modal', visible: :all, wait: 30)
end
def model_viewer_visible(visible)
@@ -78,8 +78,8 @@ module Pages
expect(page).to have_selector(selector, count: 8)
end
else
- expect(page).not_to have_selector(selector)
- expect(page).not_to have_selector('[data-test-selector="op-ifc-viewer--toolbar-container"]')
+ expect(page).to have_no_selector(selector)
+ expect(page).to have_no_css('[data-test-selector="op-ifc-viewer--toolbar-container"]')
end
end
@@ -90,7 +90,7 @@ module Pages
end
def page_has_a_toolbar
- expect(page).to have_selector('.toolbar-container')
+ expect(page).to have_css('.toolbar-container')
end
def page_shows_a_filter_button(visible)
@@ -115,11 +115,11 @@ module Pages
end
def expect_view_toggle_at(value)
- expect(page).to have_selector('#bcf-view-toggle-button', text: value)
+ expect(page).to have_css('#bcf-view-toggle-button', text: value)
end
def has_no_menu_item_with_text?(value)
- expect(page).not_to have_selector('.menu-item', text: value)
+ expect(page).to have_no_css('.menu-item', text: value)
end
private
diff --git a/modules/bim/spec/views/bim/ifc_models/ifc_models/index.html.erb_spec.rb b/modules/bim/spec/views/bim/ifc_models/ifc_models/index.html.erb_spec.rb
index 50d45b6952e..fa71df317e3 100644
--- a/modules/bim/spec/views/bim/ifc_models/ifc_models/index.html.erb_spec.rb
+++ b/modules/bim/spec/views/bim/ifc_models/ifc_models/index.html.erb_spec.rb
@@ -96,7 +96,7 @@ RSpec.describe 'bim/ifc_models/ifc_models/index' do
it 'lists the IFC model with all but the download button' do
render
expect(rendered).to have_text('office.ifc')
- expect(rendered).not_to have_link('Download')
+ expect(rendered).to have_no_link('Download')
expect(rendered).to have_link('Delete')
expect(rendered).to have_link('Edit')
end
diff --git a/modules/boards/app/models/boards/grid.rb b/modules/boards/app/models/boards/grid.rb
index beec300c2fc..9c3cfd2cf69 100644
--- a/modules/boards/app/models/boards/grid.rb
+++ b/modules/boards/app/models/boards/grid.rb
@@ -68,7 +68,6 @@ module Boards
def contained_query_ids
widgets
.filter_map { |w| w.options['queryId'] || w.options['query_id'] }
-
end
end
end
diff --git a/modules/boards/spec/features/action_boards/assignee_board_spec.rb b/modules/boards/spec/features/action_boards/assignee_board_spec.rb
index 5feb4325f8c..2e052f9c39e 100644
--- a/modules/boards/spec/features/action_boards/assignee_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/assignee_board_spec.rb
@@ -27,11 +27,10 @@
#++
require 'spec_helper'
-require_relative './../support/board_index_page'
-require_relative './../support/board_page'
+require_relative '../support/board_index_page'
+require_relative '../support/board_page'
-RSpec.describe 'Assignee action board',
- js: true,
+RSpec.describe 'Assignee action board', :js,
with_ee: %i[board_view] do
let(:bobself_user) do
create(:user,
@@ -149,7 +148,7 @@ RSpec.describe 'Assignee action board',
# Expect to have changed the avatar
within_test_selector('op-wp-single-card--content-assignee') do
- expect(page).to have_selector('.op-avatar_mini', text: 'FB', wait: 10)
+ expect(page).to have_css('.op-avatar_mini', text: 'FB', wait: 10)
end
work_package.reload
@@ -163,7 +162,7 @@ RSpec.describe 'Assignee action board',
# Expect to have changed the avatar
within_test_selector('op-wp-single-card--content-assignee') do
- expect(page).to have_selector('.op-avatar_mini', text: 'GG', wait: 10)
+ expect(page).to have_css('.op-avatar_mini', text: 'GG', wait: 10)
end
work_package.reload
diff --git a/modules/boards/spec/features/action_boards/custom_field_filters_spec.rb b/modules/boards/spec/features/action_boards/custom_field_filters_spec.rb
index f47018d04b4..dae5cc3c5f1 100644
--- a/modules/boards/spec/features/action_boards/custom_field_filters_spec.rb
+++ b/modules/boards/spec/features/action_boards/custom_field_filters_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './../support//board_index_page'
-require_relative './../support/board_page'
+require_relative '../support//board_index_page'
+require_relative '../support/board_page'
-RSpec.describe 'Custom field filter in boards', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Custom field filter in boards', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
diff --git a/modules/boards/spec/features/action_boards/status_board_spec.rb b/modules/boards/spec/features/action_boards/status_board_spec.rb
index c4bf4c896a9..6a3b072db89 100644
--- a/modules/boards/spec/features/action_boards/status_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/status_board_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './../support//board_index_page'
-require_relative './../support/board_page'
+require_relative '../support//board_index_page'
+require_relative '../support/board_page'
-RSpec.describe 'Status action board', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Status action board', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
diff --git a/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb b/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb
index 4a3cd5ff022..2483a30268d 100644
--- a/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/status_type_moving_board_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './../support//board_index_page'
-require_relative './../support/board_page'
+require_relative '../support//board_index_page'
+require_relative '../support/board_page'
-RSpec.describe 'Status action board', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Status action board', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
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 a2f9e324a05..0573ab22203 100644
--- a/modules/boards/spec/features/action_boards/subproject_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/subproject_board_spec.rb
@@ -202,11 +202,11 @@ RSpec.describe 'Subproject action board', :js, with_ee: %i[board_view] do
board_page.expect_card subproject1.name, work_package.subject
# No error is to be displayed as erroneous columns are filtered out
- expect(page).not_to have_css('.op-toast.-error')
+ expect(page).to have_no_css('.op-toast.-error')
board_page.expect_no_list(subproject2.name)
expect(page)
- .not_to have_content invisible_work_package.subject
+ .to have_no_content invisible_work_package.subject
end
end
@@ -236,7 +236,7 @@ RSpec.describe 'Subproject action board', :js, with_ee: %i[board_view] do
board_page.open_and_fill_add_list_modal subproject2.name
- expect(page).not_to have_css('.ng-option', text: subproject2.name)
+ expect(page).to have_no_css('.ng-option', text: subproject2.name)
end
end
end
diff --git a/modules/boards/spec/features/action_boards/subtasks_board_spec.rb b/modules/boards/spec/features/action_boards/subtasks_board_spec.rb
index d075792e21e..ca86390bffc 100644
--- a/modules/boards/spec/features/action_boards/subtasks_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/subtasks_board_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support//board_index_page'
require_relative '../support/board_page'
-RSpec.describe 'Subtasks action board', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Subtasks action board', :js, with_ee: %i[board_view] do
let(:type) { create(:type_standard) }
let(:project) { create(:project, types: [type], enabled_module_names: %i[work_package_tracking board_view]) }
let(:role) { create(:project_role, permissions:) }
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 b98a713970e..6c0180afb5e 100644
--- a/modules/boards/spec/features/action_boards/version_board_spec.rb
+++ b/modules/boards/spec/features/action_boards/version_board_spec.rb
@@ -245,18 +245,18 @@ RSpec.describe 'Version action board', :js, with_ee: %i[board_view] do
end
board_page.expect_list 'Closed version'
- expect(page).to have_selector("#{test_selector('op-version-board-header')}.-closed")
+ expect(page).to have_css("#{test_selector('op-version-board-header')}.-closed")
# Can open that version
board_page.click_list_dropdown 'Closed version', 'Open version'
- expect(page).not_to have_selector("#{test_selector('op-version-board-header')}.-closed")
+ expect(page).to have_no_css("#{test_selector('op-version-board-header')}.-closed")
closed_version.reload
expect(closed_version.status).to eq 'open'
# Can lock that version
board_page.click_list_dropdown 'Closed version', 'Lock version'
- expect(page).to have_selector("#{test_selector('op-version-board-header')}.-locked")
+ expect(page).to have_css("#{test_selector('op-version-board-header')}.-locked")
closed_version.reload
expect(closed_version.status).to eq 'locked'
@@ -323,7 +323,7 @@ RSpec.describe 'Version action board', :js, with_ee: %i[board_view] do
board_page.expect_editable_board(true)
board_page.expect_editable_list(false)
- expect(page).not_to have_selector("#{test_selector('op-wp-single-card')}.-draggable")
+ expect(page).to have_no_css("#{test_selector('op-wp-single-card')}.-draggable")
end
end
@@ -337,7 +337,7 @@ RSpec.describe 'Version action board', :js, with_ee: %i[board_view] do
board_page.open_and_fill_add_list_modal 'Completely new version'
- expect(page).not_to have_css('.ng-option', text: 'Completely new version')
+ expect(page).to have_no_css('.ng-option', text: 'Completely new version')
end
end
end
diff --git a/modules/boards/spec/features/board_conflicts_spec.rb b/modules/boards/spec/features/board_conflicts_spec.rb
index ce5d2e46f5f..a97d4e39176 100644
--- a/modules/boards/spec/features/board_conflicts_spec.rb
+++ b/modules/boards/spec/features/board_conflicts_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './support/board_index_page'
-require_relative './support/board_page'
+require_relative 'support/board_index_page'
+require_relative 'support/board_page'
-RSpec.describe 'Board remote changes resolution', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Board remote changes resolution', :js, with_ee: %i[board_view] do
let(:user1) do
create(:user,
member_with_roles: { project => role })
diff --git a/modules/boards/spec/features/board_enterprise_spec.rb b/modules/boards/spec/features/board_enterprise_spec.rb
index 0e05c8ae788..dd8d4b15a80 100644
--- a/modules/boards/spec/features/board_enterprise_spec.rb
+++ b/modules/boards/spec/features/board_enterprise_spec.rb
@@ -56,8 +56,8 @@ RSpec.describe 'Boards enterprise spec', :js, :with_cuprite do
it 'disabled all action boards' do
page.find('.toolbar-item a', text: 'Board').click
- expect(page).to have_selector("#{test_selector('op-tile-block')}:not(.-disabled)", text: 'Basic')
- expect(page).to have_selector("#{test_selector('op-tile-block')}.-disabled", count: 5)
+ expect(page).to have_css("#{test_selector('op-tile-block')}:not(.-disabled)", text: 'Basic')
+ expect(page).to have_css("#{test_selector('op-tile-block')}.-disabled", count: 5)
end
it 'shows a banner on the action board' do
@@ -85,7 +85,7 @@ RSpec.describe 'Boards enterprise spec', :js, :with_cuprite do
it 'enables all options' do
page.find('.toolbar-item a', text: 'Board').click
- expect(page).to have_selector("#{test_selector('op-tile-block')}:not(.-disabled)", count: 6)
+ expect(page).to have_css("#{test_selector('op-tile-block')}:not(.-disabled)", count: 6)
end
it 'shows the action board' do
diff --git a/modules/boards/spec/features/board_highlighting_spec.rb b/modules/boards/spec/features/board_highlighting_spec.rb
index 86f0b0b3b4a..2c144beb40f 100644
--- a/modules/boards/spec/features/board_highlighting_spec.rb
+++ b/modules/boards/spec/features/board_highlighting_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './support/board_index_page'
-require_relative './support/board_page'
+require_relative 'support/board_index_page'
+require_relative 'support/board_page'
-RSpec.describe 'Work Package boards spec', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Work Package boards spec', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
@@ -81,26 +81,26 @@ RSpec.describe 'Work Package boards spec', js: true, with_ee: %i[board_view] do
board_page.expect_card 'Open', wp2.subject
# Highlight type inline is always active
- expect(page).to have_selector(".__hl_inline_type_#{type.id}")
- expect(page).to have_selector(".__hl_inline_type_#{type2.id}")
+ expect(page).to have_css(".__hl_inline_type_#{type.id}")
+ expect(page).to have_css(".__hl_inline_type_#{type2.id}")
# Highlight whole card by priority
board_page.change_board_highlighting 'inline', 'Priority'
- expect(page).to have_selector(".__hl_background_priority_#{priority.id}")
- expect(page).to have_selector(".__hl_background_priority_#{priority2.id}")
+ expect(page).to have_css(".__hl_background_priority_#{priority.id}")
+ expect(page).to have_css(".__hl_background_priority_#{priority2.id}")
# Highlight whole card by type
board_page.change_board_highlighting 'inline', 'Type'
- expect(page).to have_selector(".__hl_background_type_#{type.id}")
- expect(page).to have_selector(".__hl_background_type_#{type2.id}")
+ expect(page).to have_css(".__hl_background_type_#{type.id}")
+ expect(page).to have_css(".__hl_background_type_#{type2.id}")
# Disable highlighting
board_page.change_board_highlighting 'none'
- expect(page).not_to have_selector(".__hl_background_type_#{type.id}")
- expect(page).not_to have_selector(".__hl_background_type_#{type2.id}")
+ expect(page).to have_no_css(".__hl_background_type_#{type.id}")
+ expect(page).to have_no_css(".__hl_background_type_#{type2.id}")
# Type is still shown highlighted
- expect(page).to have_selector(".__hl_inline_type_#{type.id}")
- expect(page).to have_selector(".__hl_inline_type_#{type2.id}")
+ expect(page).to have_css(".__hl_inline_type_#{type.id}")
+ expect(page).to have_css(".__hl_inline_type_#{type2.id}")
end
end
diff --git a/modules/boards/spec/features/board_index_spec.rb b/modules/boards/spec/features/board_index_spec.rb
index 79c3596f0e1..06edd75b75a 100644
--- a/modules/boards/spec/features/board_index_spec.rb
+++ b/modules/boards/spec/features/board_index_spec.rb
@@ -67,7 +67,6 @@ RSpec.describe 'Work Package Project Boards Index Page',
shared_let(:priority) { create(:default_priority) }
shared_let(:status) { create(:default_status) }
-
let(:current_user) { user_with_full_permissions }
let(:board_index) { Pages::BoardIndex.new(project) }
diff --git a/modules/boards/spec/features/board_management_spec.rb b/modules/boards/spec/features/board_management_spec.rb
index b23b483994b..a15e88ba211 100644
--- a/modules/boards/spec/features/board_management_spec.rb
+++ b/modules/boards/spec/features/board_management_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './support/board_index_page'
-require_relative './support/board_page'
+require_relative 'support/board_index_page'
+require_relative 'support/board_page'
-RSpec.describe 'Board management spec', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Board management spec', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
@@ -283,7 +283,7 @@ RSpec.describe 'Board management spec', js: true, with_ee: %i[board_view] do
it 'does not allow viewing of boards' do
visit project_work_package_board_path(project, board_view)
- expect(page).to have_selector('#errorExplanation', text: I18n.t(:notice_not_authorized))
+ expect(page).to have_css('#errorExplanation', text: I18n.t(:notice_not_authorized))
board_index.expect_editable false
end
@@ -294,7 +294,7 @@ RSpec.describe 'Board management spec', js: true, with_ee: %i[board_view] do
it 'does not allow viewing of boards' do
board_index.visit!
- expect(page).to have_selector('#errorExplanation', text: I18n.t(:notice_not_authorized))
+ expect(page).to have_css('#errorExplanation', text: I18n.t(:notice_not_authorized))
end
end
end
diff --git a/modules/boards/spec/features/board_navigation_spec.rb b/modules/boards/spec/features/board_navigation_spec.rb
index 1da1ec87215..6fd0cefa35d 100644
--- a/modules/boards/spec/features/board_navigation_spec.rb
+++ b/modules/boards/spec/features/board_navigation_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './support/board_index_page'
-require_relative './support/board_page'
+require_relative 'support/board_index_page'
+require_relative 'support/board_page'
-RSpec.describe 'Work Package boards spec', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Work Package boards spec', :js, with_ee: %i[board_view] do
let(:user) do
create(:user,
member_with_roles: { project => role })
diff --git a/modules/boards/spec/features/board_update_spec.rb b/modules/boards/spec/features/board_update_spec.rb
index 23aca879e2b..78a6e8d7cf4 100644
--- a/modules/boards/spec/features/board_update_spec.rb
+++ b/modules/boards/spec/features/board_update_spec.rb
@@ -27,10 +27,10 @@
#++
require 'spec_helper'
-require_relative './support/board_index_page'
-require_relative './support/board_page'
+require_relative 'support/board_index_page'
+require_relative 'support/board_page'
-RSpec.describe 'Work Package boards updating spec', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Work Package boards updating spec', :js, with_ee: %i[board_view] do
let(:admin) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %i[work_package_tracking board_view]) }
diff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rb
index b4a0f528edf..f2d1cd747f0 100644
--- a/modules/boards/spec/features/boards_global_create_spec.rb
+++ b/modules/boards/spec/features/boards_global_create_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe 'Boards',
context 'with a Community Edition', with_ee: %i[] do
it 'renders an enterprise banner and disables all restriced board types', :aggregate_failures do
- expect(page).to have_selector('op-enterprise-banner')
+ expect(page).to have_css('op-enterprise-banner')
expect(page).to have_selector(:radio_button, 'Basic')
%w[Status Assignee Version Subproject Parent-child].each do |restricted_board_type|
@@ -96,7 +96,7 @@ RSpec.describe 'Boards',
expect(page).to have_text(I18n.t(:notice_successful_create))
expect(page).to have_current_path("/projects/#{project.identifier}/boards/#{Boards::Grid.last.id}")
expect(page).to have_text "Gotham Renewal Board"
- expect(page).to have_selector("[data-query-name='#{status.name}']")
+ expect(page).to have_css("[data-query-name='#{status.name}']")
end
end
@@ -128,10 +128,10 @@ RSpec.describe 'Boards',
expect(page).to have_current_path("/projects/#{project.identifier}/boards/#{Boards::Grid.last.id}")
expect(page).to have_text "Gotham Renewal Board"
versions.each do |version|
- expect(page).to have_selector("[data-query-name='#{version.name}'")
+ expect(page).to have_css("[data-query-name='#{version.name}'")
end
excluded_versions.each do |version|
- expect(page).not_to have_selector("[data-query-name='#{version.name}'")
+ expect(page).to have_no_css("[data-query-name='#{version.name}'")
end
end
end
diff --git a/modules/boards/spec/features/boards_sorting_spec.rb b/modules/boards/spec/features/boards_sorting_spec.rb
index f77c5bbc6e3..9ece629182e 100644
--- a/modules/boards/spec/features/boards_sorting_spec.rb
+++ b/modules/boards/spec/features/boards_sorting_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative 'support/board_index_page'
require_relative 'support/board_page'
-RSpec.describe 'Work Package boards sorting spec', js: true, with_ee: %i[board_view] do
+RSpec.describe 'Work Package boards sorting spec', :js, with_ee: %i[board_view] do
let(:admin) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %i[work_package_tracking board_view]) }
let(:board_index) { Pages::BoardIndex.new(project) }
diff --git a/modules/boards/spec/features/menu_items/global_menu_item_spec.rb b/modules/boards/spec/features/menu_items/global_menu_item_spec.rb
index 3ae8cb57df9..422333c35bc 100644
--- a/modules/boards/spec/features/menu_items/global_menu_item_spec.rb
+++ b/modules/boards/spec/features/menu_items/global_menu_item_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe 'Global menu item for boards', :js, :with_cuprite do
it 'is not rendered' do
within '#main-menu' do
- expect(page).not_to have_content(boards_label)
+ expect(page).to have_no_content(boards_label)
end
end
end
diff --git a/modules/boards/spec/features/menu_items/top_menu_item_spec.rb b/modules/boards/spec/features/menu_items/top_menu_item_spec.rb
index ee4181aa90e..a85b0c38c47 100644
--- a/modules/boards/spec/features/menu_items/top_menu_item_spec.rb
+++ b/modules/boards/spec/features/menu_items/top_menu_item_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe 'Top menu item for boards', :js, :with_cuprite do
it "does not display the menu item" do
within '#more-menu', visible: false do
- expect(page).not_to have_link boards
+ expect(page).to have_no_link boards
end
end
end
diff --git a/modules/boards/spec/features/support/board_index_page.rb b/modules/boards/spec/features/support/board_index_page.rb
index 8647aae07a2..3bc10cbd10f 100644
--- a/modules/boards/spec/features/support/board_index_page.rb
+++ b/modules/boards/spec/features/support/board_index_page.rb
@@ -73,10 +73,10 @@ module Pages
new_board_page.click_on_submit
if expect_empty
- expect(page).to have_selector('.boards-list--add-item-text', wait: 10)
- expect(page).not_to have_selector('.boards-list--item')
+ expect(page).to have_css('.boards-list--add-item-text', wait: 10)
+ expect(page).to have_no_css('.boards-list--item')
else
- expect(page).to have_selector('.boards-list--item', wait: 10)
+ expect(page).to have_css('.boards-list--item', wait: 10)
end
::Pages::Board.new ::Boards::Grid.last
diff --git a/modules/boards/spec/features/support/board_list_page.rb b/modules/boards/spec/features/support/board_list_page.rb
index 8830ae0f327..3696969947d 100644
--- a/modules/boards/spec/features/support/board_list_page.rb
+++ b/modules/boards/spec/features/support/board_list_page.rb
@@ -42,14 +42,14 @@ module Pages
def expect_no_create_button
within '.toolbar-items' do
- expect(page).not_to have_link 'Board'
+ expect(page).to have_no_link 'Board'
end
end
def expect_delete_buttons(*boards)
within '#content-wrapper' do
boards.each do |board|
- expect(page).to have_selector "[data-test-selector='board-remove-#{board.id}']"
+ expect(page).to have_css "[data-test-selector='board-remove-#{board.id}']"
end
end
end
@@ -57,7 +57,7 @@ module Pages
def expect_no_delete_buttons(*boards)
within '#content-wrapper' do
boards.each do |board|
- expect(page).not_to have_selector "[data-test-selector='board-remove-#{board.id}']"
+ expect(page).to have_no_css "[data-test-selector='board-remove-#{board.id}']"
end
end
end
@@ -67,7 +67,7 @@ module Pages
within '#content-wrapper' do
expected_board_names.each do |board_name|
- expect(page).to have_selector("td.name", text: board_name)
+ expect(page).to have_css("td.name", text: board_name)
end
end
end
@@ -86,7 +86,7 @@ module Pages
within '#content-wrapper' do
unexpected_board_names.each do |board_name|
- expect(page).not_to have_selector("td.title", text: board_name)
+ expect(page).to have_no_css("td.title", text: board_name)
end
end
end
@@ -102,7 +102,7 @@ module Pages
end
def expect_to_be_on_page(number)
- expect(page).to have_selector('.op-pagination--item_current', text: number)
+ expect(page).to have_css('.op-pagination--item_current', text: number)
end
def to_page(number)
diff --git a/modules/boards/spec/features/support/board_overview_page.rb b/modules/boards/spec/features/support/board_overview_page.rb
index 5661d72b4aa..7a71af131b9 100644
--- a/modules/boards/spec/features/support/board_overview_page.rb
+++ b/modules/boards/spec/features/support/board_overview_page.rb
@@ -37,7 +37,7 @@ module Pages
def expect_global_menu_item_selected
within '#main-menu' do
- expect(page).to have_selector('.selected', text: 'Boards')
+ expect(page).to have_css('.selected', text: 'Boards')
end
end
end
diff --git a/modules/boards/spec/features/support/board_page.rb b/modules/boards/spec/features/support/board_page.rb
index 58ddf172106..e5fd3f0ebc3 100644
--- a/modules/boards/spec/features/support/board_page.rb
+++ b/modules/boards/spec/features/support/board_page.rb
@@ -27,7 +27,6 @@
#++
require 'support/pages/page'
-require_relative './board_page'
module Pages
class Board < Page
@@ -130,7 +129,7 @@ module Pages
query: work_package.subject,
results_selector: '.work-packages-partitioned-query-space--container')
- expect(target_dropdown).not_to have_selector('.ui-menu-item', text: work_package.subject)
+ expect(target_dropdown).to have_no_css('.ui-menu-item', text: work_package.subject)
end
##
@@ -159,7 +158,7 @@ module Pages
def expect_movable(list_name, card_title, movable: true)
within_list(list_name) do
- expect(page).to have_selector('[data-test-selector="op-wp-single-card"]', text: card_title)
+ expect(page).to have_css('[data-test-selector="op-wp-single-card"]', text: card_title)
expect(page).to have_conditional_selector(movable,
'[data-test-selector="op-wp-single-card"][data-qa-draggable]',
text: card_title)
@@ -177,8 +176,8 @@ module Pages
# wait for reload of lists to start and finish
# Not sure if that's the most reliable way to do it, but there is nothing visible
# about the PATCH request being sent and executed successfully after moving a card.
- expect(page).to have_selector('.op-loading-indicator', wait: 5)
- expect(page).not_to have_selector('.op-loading-indicator')
+ expect(page).to have_css('.op-loading-indicator', wait: 5)
+ expect(page).to have_no_css('.op-loading-indicator')
end
def add_list(option: nil, query: option)
@@ -190,7 +189,7 @@ module Pages
if option.nil?
page.find('.boards-list--add-item').click
- expect(page).to have_selector('[data-test-selector="op-board-list"]', count: count + 1)
+ expect(page).to have_css('[data-test-selector="op-board-list"]', count: count + 1)
else
open_and_fill_add_list_modal query
page.find('.ng-option', text: option, wait: 10).click
@@ -210,23 +209,23 @@ module Pages
end
def expect_changed
- expect(page).to have_selector('.editable-toolbar-title--save')
+ expect(page).to have_css('.editable-toolbar-title--save')
end
def expect_not_changed
- expect(page).not_to have_selector('.editable-toolbar-title--save')
+ expect(page).to have_no_css('.editable-toolbar-title--save')
end
def expect_list(name)
- expect(page).to have_selector('[data-test-selector="op-board-list--header"]', text: name, wait: 10)
+ expect(page).to have_css('[data-test-selector="op-board-list--header"]', text: name, wait: 10)
end
def expect_no_list(name)
- expect(page).not_to have_selector('[data-test-selector="op-board-list--header"]', text: name)
+ expect(page).to have_no_css('[data-test-selector="op-board-list--header"]', text: name)
end
def expect_empty
- expect(page).not_to have_selector('.boards-list--item', wait: 10)
+ expect(page).to have_no_css('.boards-list--item', wait: 10)
end
def remove_list(name)
@@ -235,7 +234,7 @@ module Pages
accept_alert_dialog!
expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
- expect(page).not_to have_selector list_selector(name)
+ expect(page).to have_no_selector list_selector(name)
end
def click_list_dropdown(list_name, action)
@@ -255,9 +254,9 @@ module Pages
open_and_fill_add_list_modal name
if present
- expect(page).to have_selector('.ng-option', text: name)
+ expect(page).to have_css('.ng-option', text: name)
else
- expect(page).not_to have_selector('.ng-option', text: name)
+ expect(page).to have_no_css('.ng-option', text: name)
end
find('body').send_keys [:escape]
end
@@ -334,7 +333,7 @@ module Pages
if editable
expect(page).to have_field('editable-toolbar-title', with: name)
else
- expect(page).to have_selector('.editable-toolbar-title--fixed', text: name)
+ expect(page).to have_css('.editable-toolbar-title--fixed', text: name)
end
end
@@ -358,7 +357,7 @@ module Pages
def open_add_list_modal
page.find('.boards-list--add-item').click
- expect(page).to have_selector('.new-list--action-select input')
+ expect(page).to have_css('.new-list--action-select input')
end
def add_list_modal_shows_warning(value, with_link: false)
diff --git a/modules/boards/spec/queries/grids/query_integration_spec.rb b/modules/boards/spec/queries/grids/query_integration_spec.rb
index 2688f32feda..7c2463d6bb0 100644
--- a/modules/boards/spec/queries/grids/query_integration_spec.rb
+++ b/modules/boards/spec/queries/grids/query_integration_spec.rb
@@ -56,7 +56,7 @@ RSpec.describe Grids::Query, type: :model do
context 'without a filter' do
describe '#results' do
it 'is the same as getting all the boards visible to the user' do
- expect(instance.results).to match_array [board_grid]
+ expect(instance.results).to contain_exactly(board_grid)
end
end
end
@@ -69,7 +69,7 @@ RSpec.describe Grids::Query, type: :model do
describe '#results' do
it 'yields boards assigned to the project' do
- expect(instance.results).to match_array [board_grid]
+ expect(instance.results).to contain_exactly(board_grid)
end
end
diff --git a/modules/boards/spec/requests/api/v3/grids/grids_resource_spec.rb b/modules/boards/spec/requests/api/v3/grids/grids_resource_spec.rb
index 986326b28a4..55de32fde4c 100644
--- a/modules/boards/spec/requests/api/v3/grids/grids_resource_spec.rb
+++ b/modules/boards/spec/requests/api/v3/grids/grids_resource_spec.rb
@@ -259,8 +259,7 @@ RSpec.describe 'API v3 Grids resource for Board Grids', content_type: :json do
expect(subject.status).to eq 422
expect(JSON.parse(subject.body)['_embedded']['errors'].map { |e| e['message'] })
- .to match_array ["Widgets is outside of the grid.",
- "Number of rows must be greater than 0."]
+ .to contain_exactly("Widgets is outside of the grid.", "Number of rows must be greater than 0.")
end
it 'does not persist the changes to widgets' do
@@ -391,9 +390,8 @@ RSpec.describe 'API v3 Grids resource for Board Grids', content_type: :json do
.at_path('_type')
expect(JSON.parse(subject.body)['_embedded']['errors'].map { |e| e['message'] })
- .to match_array ["Widgets is outside of the grid.",
- "Number of rows must be greater than 0.",
- "Number of columns must be greater than 0."]
+ .to contain_exactly("Widgets is outside of the grid.", "Number of rows must be greater than 0.",
+ "Number of columns must be greater than 0.")
end
end
diff --git a/modules/boards/spec/services/copy_service_integration_spec.rb b/modules/boards/spec/services/copy_service_integration_spec.rb
index 5682ae157df..1213dbe45f3 100644
--- a/modules/boards/spec/services/copy_service_integration_spec.rb
+++ b/modules/boards/spec/services/copy_service_integration_spec.rb
@@ -76,7 +76,7 @@ RSpec.describe Projects::CopyService, 'integration', type: :model do
query.save!
end
- it 'will succeed to copy, but add an error for the missing subproject column (Regression #34550)' do
+ it 'succeeds to copy, but add an error for the missing subproject column (Regression #34550)' do
# Expect to have created to board, but with error
expect(subject).to be_success
expect(subject.errors.full_messages).to eq([expected_error])
@@ -101,7 +101,7 @@ RSpec.describe Projects::CopyService, 'integration', type: :model do
end
describe 'call' do
- it 'will copy the boards with the order correct' do
+ it 'copies the boards with the order correct' do
expect(subject).to be_success
expect(board_copies.count).to eq 1
diff --git a/modules/budgets/app/models/budget.rb b/modules/budgets/app/models/budget.rb
index 22de1755b48..cc7f457941c 100644
--- a/modules/budgets/app/models/budget.rb
+++ b/modules/budgets/app/models/budget.rb
@@ -224,13 +224,13 @@ class Budget < ApplicationRecord
def update_budget_item_attributes(budget_item_attributes, type:)
return unless edit_allowed?
- budget_items = send("#{type}_budget_items")
+ budget_items = send(:"#{type}_budget_items")
budget_items.reject(&:new_record?).each do |budget_item|
attributes = budget_item_attributes[budget_item.id.to_s.to_sym]
- send("correct_#{type}_attributes!", attributes)
+ send(:"correct_#{type}_attributes!", attributes)
- if send("valid_#{type}_budget_attributes?", attributes)
+ if send(:"valid_#{type}_budget_attributes?", attributes)
budget_item.attributes = attributes
else
# This is surprising as it will delete right away compared to the
diff --git a/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb b/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb
index cfdae6b0ad7..2d68c93a9d9 100644
--- a/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb
+++ b/modules/budgets/app/models/queries/work_packages/filter/budget_filter.rb
@@ -58,7 +58,6 @@ module Queries::WorkPackages::Filter
values
.filter_map { |budget_id| available_budgets[budget_id.to_i] }
-
end
def human_name
diff --git a/modules/budgets/spec/factories/labor_budget_item_factory.rb b/modules/budgets/spec/factories/labor_budget_item_factory.rb
index 967f89b0b07..fc011c63617 100644
--- a/modules/budgets/spec/factories/labor_budget_item_factory.rb
+++ b/modules/budgets/spec/factories/labor_budget_item_factory.rb
@@ -28,8 +28,8 @@
FactoryBot.define do
factory :labor_budget_item do
- association :user, factory: :user
- association :budget, factory: :budget
+ association :user
+ association :budget
hours { 0.0 }
end
end
diff --git a/modules/budgets/spec/factories/material_budget_item_factory.rb b/modules/budgets/spec/factories/material_budget_item_factory.rb
index 1b8e778842f..62965ea6d31 100644
--- a/modules/budgets/spec/factories/material_budget_item_factory.rb
+++ b/modules/budgets/spec/factories/material_budget_item_factory.rb
@@ -28,8 +28,8 @@
FactoryBot.define do
factory :material_budget_item do
- association :cost_type, factory: :cost_type
- association :budget, factory: :budget
+ association :cost_type
+ association :budget
units { 0.0 }
end
end
diff --git a/modules/budgets/spec/features/budgets/add_budget_spec.rb b/modules/budgets/spec/features/budgets/add_budget_spec.rb
index 60857662ceb..78f68e470ae 100644
--- a/modules/budgets/spec/features/budgets/add_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/add_budget_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-RSpec.describe 'adding a new budget', js: true do
+RSpec.describe 'adding a new budget', :js do
let(:project) { create(:project_with_types, members: project_members) }
let(:user) { create(:admin) }
let(:project_members) { {} }
@@ -73,8 +73,8 @@ RSpec.describe 'adding a new budget', js: true do
expect(page).to have_content "Successful creation"
expect(page).to have_content "My subject"
- expect(page).to have_selector('.material_budget_items td.units', text: '15.00')
- expect(page).to have_selector('.material_budget_items td', text: 'Foobar')
+ expect(page).to have_css('.material_budget_items td.units', text: '15.00')
+ expect(page).to have_css('.material_budget_items td', text: 'Foobar')
end
end
@@ -161,13 +161,13 @@ RSpec.describe 'adding a new budget', js: true do
expect(page).to have_content('Successful creation')
new_budget_page.toggle_unit_costs!
- expect(page).to have_selector('td.currency', text: '150.00 EUR')
+ expect(page).to have_css('td.currency', text: '150.00 EUR')
expect(new_budget_page.unit_costs_at(1)).to have_content '150.00 EUR'
expect(new_budget_page.unit_costs_at(2)).to have_content '100.00 EUR'
expect(new_budget_page.overall_unit_costs).to have_content '250.00 EUR'
new_budget_page.toggle_labor_costs!
- expect(page).to have_selector('td.currency', text: '125.00 EUR')
+ expect(page).to have_css('td.currency', text: '125.00 EUR')
expect(new_budget_page.labor_costs_at(1)).to have_content '125.00 EUR'
expect(new_budget_page.labor_costs_at(2)).to have_content '50.00 EUR'
expect(new_budget_page.overall_labor_costs).to have_content '175.00 EUR'
diff --git a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
index 0079c661900..1c53a46b48f 100644
--- a/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
+++ b/modules/budgets/spec/features/budgets/attachment_upload_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'Upload attachment to budget', js: true do
+RSpec.describe 'Upload attachment to budget', :js do
let(:user) do
create(:user, member_with_permissions: { project => %i[view_budgets edit_budgets] })
end
@@ -59,7 +59,7 @@ RSpec.describe 'Upload attachment to budget', js: true do
click_on 'Create'
- expect(page).to have_selector('#content img', count: 1)
+ expect(page).to have_css('#content img', count: 1)
expect(page).to have_content('Image uploaded on creation')
attachments_list.expect_attached('image.png')
@@ -73,7 +73,7 @@ RSpec.describe 'Upload attachment to budget', js: true do
click_on 'Submit'
- expect(page).to have_selector('#content img', count: 2)
+ expect(page).to have_css('#content img', count: 2)
expect(page).to have_content('Image uploaded on creation')
expect(page).to have_content('Image uploaded the second time')
attachments_list.expect_attached('image.png', count: 2)
diff --git a/modules/budgets/spec/features/budgets/copy_budget_spec.rb b/modules/budgets/spec/features/budgets/copy_budget_spec.rb
index ed4800467fa..98deeba1488 100644
--- a/modules/budgets/spec/features/budgets/copy_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/copy_budget_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-RSpec.describe 'Copying a budget', js: true do
+RSpec.describe 'Copying a budget', :js do
let(:project) { create(:project, enabled_module_names: %i[budgets costs]) }
let(:current_user) do
create(:user,
@@ -91,6 +91,6 @@ RSpec.describe 'Copying a budget', js: true do
budget_page.expect_toast message: 'Successful creation.'
expect(page)
- .to have_selector('.author', text: current_user.name)
+ .to have_css('.author', text: current_user.name)
end
end
diff --git a/modules/budgets/spec/features/budgets/delete_budget_spec.rb b/modules/budgets/spec/features/budgets/delete_budget_spec.rb
index cdbeda2a0a2..283f43ee024 100644
--- a/modules/budgets/spec/features/budgets/delete_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/delete_budget_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper.rb")
-RSpec.describe 'Deleting a budget', js: true do
+RSpec.describe 'Deleting a budget', :js do
let(:project) { create(:project, enabled_module_names: %i[budgets costs]) }
let(:user) { create(:admin) }
let(:budget_subject) { "A budget subject" }
diff --git a/modules/budgets/spec/features/budgets/update_budget_spec.rb b/modules/budgets/spec/features/budgets/update_budget_spec.rb
index bc2b4ae19e3..1260754d9b0 100644
--- a/modules/budgets/spec/features/budgets/update_budget_spec.rb
+++ b/modules/budgets/spec/features/budgets/update_budget_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb')
-RSpec.describe 'updating a budget', js: true do
+RSpec.describe 'updating a budget', :js do
let(:project) do
create(:project_with_types,
enabled_module_names: %i[budgets costs work_package_tracking],
@@ -62,11 +62,11 @@ RSpec.describe 'updating a budget', js: true do
expect(budget_page).to have_content('Successful update')
budget_page.toggle_unit_costs!
- expect(page).to have_selector('tbody td.currency', text: '150.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '150.00 EUR')
expect(budget_page.overall_unit_costs).to have_content '150.00 EUR'
budget_page.toggle_labor_costs!
- expect(page).to have_selector('tbody td.currency', text: '125.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '125.00 EUR')
expect(budget_page.labor_costs_at(1)).to have_content '125.00 EUR'
expect(budget_page.overall_labor_costs).to have_content '125.00 EUR'
end
@@ -125,12 +125,12 @@ RSpec.describe 'updating a budget', js: true do
expect(budget_page).to have_content('Successful update')
budget_page.toggle_unit_costs!
- expect(page).to have_selector('tbody td.currency', text: '250.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '250.00 EUR')
expect(budget_page.unit_costs_at(1)).to have_content '250.00 EUR'
expect(budget_page.overall_unit_costs).to have_content '250.00 EUR'
budget_page.toggle_labor_costs!
- expect(page).to have_selector('tbody td.currency', text: '75.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '75.00 EUR')
expect(budget_page.labor_costs_at(1)).to have_content '75.00 EUR'
expect(budget_page.overall_labor_costs).to have_content '75.00 EUR'
end
@@ -165,9 +165,9 @@ RSpec.describe 'updating a budget', js: true do
click_on 'OK'
expect(budget_page).to have_content(I18n.t(:notice_successful_update, locale: :de))
- expect(page).to have_selector('tbody td.currency', text: '150,00 EUR')
- expect(page).to have_selector('tbody td.currency', text: '1.000,00 EUR')
- expect(page).to have_selector('tbody td.currency', text: '125,00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '150,00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '1.000,00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '125,00 EUR')
end
end
@@ -186,15 +186,15 @@ RSpec.describe 'updating a budget', js: true do
# Update first element
budget_page.edit_planned_costs! material_budget_item.id, type: :material, costs: 123
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: '123.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '123.00 EUR')
click_on 'Update'
# Update second element
budget_page.edit_planned_costs! material_budget_item_2.id, type: :material, costs: 543
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: '123.00 EUR')
- expect(page).to have_selector('tbody td.currency', text: '543.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '123.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '543.00 EUR')
# Expect overridden costs on both
material_budget_item.reload
@@ -223,15 +223,15 @@ RSpec.describe 'updating a budget', js: true do
# Update first element
budget_page.edit_planned_costs! material_budget_item.id, type: :material, costs: 123
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: 'USD 123.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 123.00')
click_on 'Update'
# Update second element
budget_page.edit_planned_costs! material_budget_item_2.id, type: :material, costs: 543
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: 'USD 123.00')
- expect(page).to have_selector('tbody td.currency', text: 'USD 543.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 123.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 543.00')
# Expect overridden costs on both
material_budget_item.reload
@@ -263,15 +263,15 @@ RSpec.describe 'updating a budget', js: true do
# Update first element
budget_page.edit_planned_costs! labor_budget_item.id, type: :labor, costs: 456
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: '456.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '456.00 EUR')
click_on 'Update'
# Update second element
budget_page.edit_planned_costs! labor_budget_item_2.id, type: :labor, costs: 987
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: '456.00 EUR')
- expect(page).to have_selector('tbody td.currency', text: '987.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '456.00 EUR')
+ expect(page).to have_css('tbody td.currency', text: '987.00 EUR')
# Expect overridden costs on both
labor_budget_item.reload
@@ -300,15 +300,15 @@ RSpec.describe 'updating a budget', js: true do
# Update first element
budget_page.edit_planned_costs! labor_budget_item.id, type: :labor, costs: 456
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: 'USD 456.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 456.00')
click_on 'Update'
# Update second element
budget_page.edit_planned_costs! labor_budget_item_2.id, type: :labor, costs: 987
expect(budget_page).to have_content('Successful update')
- expect(page).to have_selector('tbody td.currency', text: 'USD 456.00')
- expect(page).to have_selector('tbody td.currency', text: 'USD 987.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 456.00')
+ expect(page).to have_css('tbody td.currency', text: 'USD 987.00')
# Expect overridden costs on both
labor_budget_item.reload
@@ -333,7 +333,7 @@ RSpec.describe 'updating a budget', js: true do
page.find("#budget_existing_labor_budget_item_attributes_#{labor_budget_item.id} a.delete-budget-item").click
click_on 'Submit'
- expect(budget_page.labor_costs_at(1)).not_to have_content '125.00 EUR'
+ expect(budget_page.labor_costs_at(1)).to have_no_content '125.00 EUR'
end
end
end
diff --git a/modules/budgets/spec/features/costs_edit_fields_spec.rb b/modules/budgets/spec/features/costs_edit_fields_spec.rb
index 43d00887efd..0e90b5c23c6 100644
--- a/modules/budgets/spec/features/costs_edit_fields_spec.rb
+++ b/modules/budgets/spec/features/costs_edit_fields_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
-RSpec.describe 'Work Package budget fields', js: true do
+RSpec.describe 'Work Package budget fields', :js do
let(:type_task) { create(:type_task) }
let!(:status) { create(:status, is_default: true) }
let!(:priority) { create(:priority, is_default: true) }
@@ -46,10 +46,10 @@ RSpec.describe 'Work Package budget fields', js: true do
it 'does not show read-only fields and allows setting the budget' do
create_page.visit!
- expect(page).to have_selector('.inline-edit--container.budget')
- 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')
+ expect(page).to have_css('.inline-edit--container.budget')
+ expect(page).to have_no_css('.inline-edit--container.laborCosts')
+ expect(page).to have_no_css('.inline-edit--container.materialCosts')
+ expect(page).to have_no_css('.inline-edit--container.overallCosts')
field = create_page.edit_field(:budget)
field.set_value budget.name
diff --git a/modules/budgets/spec/features/work_package_filter_spec.rb b/modules/budgets/spec/features/work_package_filter_spec.rb
index 2a2a4c7b8d5..b21a5d93a60 100644
--- a/modules/budgets/spec/features/work_package_filter_spec.rb
+++ b/modules/budgets/spec/features/work_package_filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Filter by budget', js: true do
+RSpec.describe 'Filter by budget', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
diff --git a/modules/budgets/spec/support/pages/destroy_info.rb b/modules/budgets/spec/support/pages/destroy_info.rb
index f6d14b7801c..7bfab77bdc0 100644
--- a/modules/budgets/spec/support/pages/destroy_info.rb
+++ b/modules/budgets/spec/support/pages/destroy_info.rb
@@ -48,7 +48,7 @@ module Pages
def expect_no_reassign_option
expect(page)
- .not_to have_field('todo_reassign')
+ .to have_no_field('todo_reassign')
end
def select_reassign_option(budget_name)
diff --git a/modules/budgets/spec/support/pages/index_budget.rb b/modules/budgets/spec/support/pages/index_budget.rb
index 9c2a056795d..228e18a37fd 100644
--- a/modules/budgets/spec/support/pages/index_budget.rb
+++ b/modules/budgets/spec/support/pages/index_budget.rb
@@ -38,7 +38,7 @@ module Pages
def expect_budget_not_listed(budget_name)
expect(page)
- .not_to have_content(budget_name)
+ .to have_no_content(budget_name)
end
def path
diff --git a/modules/calendar/app/models/ical_token_query_assignment.rb b/modules/calendar/app/models/ical_token_query_assignment.rb
index a7a5de5c1c7..6dbbb977037 100644
--- a/modules/calendar/app/models/ical_token_query_assignment.rb
+++ b/modules/calendar/app/models/ical_token_query_assignment.rb
@@ -29,11 +29,8 @@
class ICalTokenQueryAssignment < ApplicationRecord
self.table_name = 'ical_token_query_assignments'
- # rubocop:disable Rails/BelongsTo
belongs_to :ical_token, class_name: 'Token::ICal', optional: true
belongs_to :query, optional: true
- # rubocop:enable Rails/BelongsTo
-
validates :name, presence: true
validate :unique_name_per_user_and_query
diff --git a/modules/calendar/app/services/calendar/create_ical_service.rb b/modules/calendar/app/services/calendar/create_ical_service.rb
index b553e89c646..d8cbffc0c2b 100644
--- a/modules/calendar/app/services/calendar/create_ical_service.rb
+++ b/modules/calendar/app/services/calendar/create_ical_service.rb
@@ -68,7 +68,7 @@ module Calendar
location
description
].each do |value|
- event.send("#{value}=", send("#{value}_value", work_package))
+ event.send(:"#{value}=", send(:"#{value}_value", work_package))
end
event
@@ -92,7 +92,7 @@ module Calendar
end
def start_date(work_package)
- (work_package.start_date.presence || work_package.due_date)
+ work_package.start_date.presence || work_package.due_date
end
def dtend_value(work_package)
diff --git a/modules/calendar/spec/features/calendar_create_work_package_spec.rb b/modules/calendar/spec/features/calendar_create_work_package_spec.rb
index 52ed74681b4..2b86b6e033f 100644
--- a/modules/calendar/spec/features/calendar_create_work_package_spec.rb
+++ b/modules/calendar/spec/features/calendar_create_work_package_spec.rb
@@ -27,9 +27,9 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
-RSpec.describe 'Calendar create new work package', js: true do
+RSpec.describe 'Calendar create new work package', :js do
include_context 'with calendar full access'
let(:type_task) { create(:type_task) }
diff --git a/modules/calendar/spec/features/calendar_dates_spec.rb b/modules/calendar/spec/features/calendar_dates_spec.rb
index 77ee81f16a4..662cd88006c 100644
--- a/modules/calendar/spec/features/calendar_dates_spec.rb
+++ b/modules/calendar/spec/features/calendar_dates_spec.rb
@@ -51,22 +51,22 @@ RSpec.describe 'Calendar non working days', :js, :with_cuprite do
expect(page).to have_css('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
expect(page).to have_css('.fc-day-sun.fc-non-working-day', minimum: 1)
- expect(page).not_to have_css('.fc-day-mon.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-tue.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-wed.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-thu.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-fri.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-tue.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-fri.fc-non-working-day')
find('.fc-next-button').click
expect(page).to have_css('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
expect(page).to have_css('.fc-day-sun.fc-non-working-day', minimum: 1)
- expect(page).not_to have_css('.fc-day-mon.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-tue.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-wed.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-thu.fc-non-working-day')
- expect(page).not_to have_css('.fc-day-fri.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-tue.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-fri.fc-non-working-day')
end
end
diff --git a/modules/calendar/spec/features/calendar_project_include_spec.rb b/modules/calendar/spec/features/calendar_project_include_spec.rb
index 91efafc584b..f34008cb72a 100644
--- a/modules/calendar/spec/features/calendar_project_include_spec.rb
+++ b/modules/calendar/spec/features/calendar_project_include_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require 'features/work_packages/project_include/project_include_shared_examples'
require_relative '../support/pages/calendar'
-RSpec.describe 'Calendar project include', js: true do
+RSpec.describe 'Calendar project include', :js do
shared_let(:enabled_modules) { %w[work_package_tracking calendar_view] }
shared_let(:permissions) do
%i[view_work_packages view_calendar edit_work_packages add_work_packages save_queries manage_public_queries]
diff --git a/modules/calendar/spec/features/calendar_sharing_spec.rb b/modules/calendar/spec/features/calendar_sharing_spec.rb
index fd5ed82efa3..d8b93697ad5 100644
--- a/modules/calendar/spec/features/calendar_sharing_spec.rb
+++ b/modules/calendar/spec/features/calendar_sharing_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
page.click_button("Subscribe to calendar")
# modal should not be shown
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
end
end
end
@@ -155,7 +155,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
page.click_button("Subscribe to calendar")
# modal should not be shown
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
end
end
end
@@ -199,7 +199,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
click_button "Cancel"
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
end
it 'successfully requests a new tokenized iCalendar URL when a unique name is provided' do
@@ -210,7 +210,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
click_button "Copy URL"
# implicitly testing for success -> modal is closed and fallback message is shown
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
expect(page).to have_content("/projects/#{saved_query.project.id}/calendars/#{saved_query.id}/ical?ical_token=")
# explictly testing for success message is not working in test env, probably
@@ -242,7 +242,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
click_button "Copy URL"
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
expect(page).to have_content("/projects/#{saved_query.project.id}/calendars/#{saved_query.id}/ical?ical_token=")
# do the same thing again, now expect validation error
@@ -309,7 +309,7 @@ RSpec.describe 'Calendar sharing via ical', :js do
page.click_button("Subscribe to calendar")
# modal should not be shown
- expect(page).not_to have_css('.spot-modal--header', text: "Subscribe to calendar")
+ expect(page).to have_no_css('.spot-modal--header', text: "Subscribe to calendar")
end
end
end
diff --git a/modules/calendar/spec/features/calendar_widget_spec.rb b/modules/calendar/spec/features/calendar_widget_spec.rb
index 7e52cb32caf..89e08d07faf 100644
--- a/modules/calendar/spec/features/calendar_widget_spec.rb
+++ b/modules/calendar/spec/features/calendar_widget_spec.rb
@@ -78,7 +78,7 @@ RSpec.describe 'Calendar Widget', :js, :with_cuprite, with_settings: { start_of_
overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
- expect(page).to have_selector('.fc-event-title', text: work_package.subject)
+ expect(page).to have_css('.fc-event-title', text: work_package.subject)
calendar.resize_date(work_package, work_package.due_date - 1.day)
overview_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
diff --git a/modules/calendar/spec/features/calendars_spec.rb b/modules/calendar/spec/features/calendars_spec.rb
index f4171861245..7edd7505e2e 100644
--- a/modules/calendar/spec/features/calendars_spec.rb
+++ b/modules/calendar/spec/features/calendars_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package calendars', js: true do
+RSpec.describe 'Work package calendars', :js do
let(:project) { create(:project) }
let(:user) do
create(:user,
@@ -86,13 +86,13 @@ RSpec.describe 'Work package calendars', js: true do
# should open the calendar with the current month displayed
expect(page)
- .to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_no_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_no_css '.fc-event-title', text: another_future_work_package.subject
filters.expect_filter_count 1
@@ -105,9 +105,9 @@ RSpec.describe 'Work package calendars', js: true do
# non matching work packages are no longer displayed
expect(page)
- .not_to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_no_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_css '.fc-event-title', text: another_current_work_package.subject
# The filter for the time frame added implicitly should not be visible
filters.expect_filter_count 2
@@ -116,25 +116,25 @@ RSpec.describe 'Work package calendars', js: true do
find('.fc-next-button').click
expect(page)
- .not_to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_no_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_no_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_no_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_css '.fc-event-title', text: another_future_work_package.subject
# removing the filter will show the event again
filters.remove_filter 'subject'
expect(page)
- .not_to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_no_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_no_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_css '.fc-event-title', text: another_future_work_package.subject
future_url = current_url
@@ -142,37 +142,37 @@ RSpec.describe 'Work package calendars', js: true do
find('.fc-prev-button').click
expect(page)
- .to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_no_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_no_css '.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)
- .not_to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_no_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_no_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_css '.fc-event-title', text: another_future_work_package.subject
# go back a month by using the browser back functionality
page.execute_script('window.history.back()')
expect(page)
- .to have_selector '.fc-event-title', text: current_work_package.subject
+ .to have_css '.fc-event-title', text: current_work_package.subject
expect(page)
- .to have_selector '.fc-event-title', text: another_current_work_package.subject
+ .to have_css '.fc-event-title', text: another_current_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: future_work_package.subject
+ .to have_no_css '.fc-event-title', text: future_work_package.subject
expect(page)
- .not_to have_selector '.fc-event-title', text: another_future_work_package.subject
+ .to have_no_css '.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
@@ -182,7 +182,7 @@ RSpec.describe 'Work package calendars', js: true do
# Regression #29664
page.go_back
expect(page)
- .to have_selector('.fc-event-title', text: current_work_package.subject, wait: 20)
+ .to have_css('.fc-event-title', text: current_work_package.subject, wait: 20)
current_wp_split_screen.expect_closed
# click goes to work package split screen page again
@@ -193,7 +193,7 @@ RSpec.describe 'Work package calendars', js: true do
current_wp_split_screen.close
expect(page)
- .to have_selector '.fc-event-title', text: current_work_package.subject, wait: 20
+ .to have_css '.fc-event-title', text: current_work_package.subject, wait: 20
current_wp_split_screen.expect_closed
end
end
diff --git a/modules/calendar/spec/support/pages/calendar.rb b/modules/calendar/spec/support/pages/calendar.rb
index 4af28db990c..7eb67e01852 100644
--- a/modules/calendar/spec/support/pages/calendar.rb
+++ b/modules/calendar/spec/support/pages/calendar.rb
@@ -89,7 +89,7 @@ module Pages
end
def expect_title(title = 'Unnamed calendar')
- expect(page).to have_selector '.editable-toolbar-title--fixed', text: title
+ expect(page).to have_css '.editable-toolbar-title--fixed', text: title
end
def expect_event(work_package, present: true)
@@ -109,11 +109,11 @@ module Pages
end
def expect_wp_not_resizable(work_package)
- expect(page).to have_selector('.fc-event:not(.fc-event-resizable)', text: work_package.subject)
+ expect(page).to have_css('.fc-event:not(.fc-event-resizable)', text: work_package.subject)
end
def expect_wp_not_draggable(work_package)
- expect(page).to have_selector('.fc-event:not(.fc-event-draggable)', text: work_package.subject)
+ expect(page).to have_css('.fc-event:not(.fc-event-draggable)', text: work_package.subject)
end
def set_title(title)
@@ -150,19 +150,19 @@ module Pages
end
def expect_create_button
- expect(page).to have_selector '.button', text: 'Calendar'
+ expect(page).to have_css '.button', text: 'Calendar'
end
def expect_no_create_button
- expect(page).not_to have_selector '.button', text: 'Calendar'
+ expect(page).to have_no_css '.button', text: 'Calendar'
end
def expect_delete_button(query)
- expect(page).to have_selector "[data-test-selector='calendar-remove-#{query.id}']"
+ expect(page).to have_css "[data-test-selector='calendar-remove-#{query.id}']"
end
def expect_no_delete_button(query)
- expect(page).not_to have_selector "[data-test-selector='calendar-remove-#{query.id}']"
+ expect(page).to have_no_css "[data-test-selector='calendar-remove-#{query.id}']"
end
def expect_no_views_visible
@@ -170,11 +170,11 @@ module Pages
end
def expect_view_visible(query)
- expect(page).to have_selector 'td', text: query.name
+ expect(page).to have_css 'td', text: query.name
end
def expect_view_not_visible(query)
- expect(page).not_to have_selector 'td', text: query.name
+ expect(page).to have_no_css 'td', text: query.name
end
def expect_views_listed_in_order(*queries)
diff --git a/modules/costs/app/models/entry.rb b/modules/costs/app/models/entry.rb
index b5047a69b7c..2e40152e16e 100644
--- a/modules/costs/app/models/entry.rb
+++ b/modules/costs/app/models/entry.rb
@@ -36,9 +36,9 @@ module Entry
TimeEntry === obj or CostEntry === obj
end
- def calculate(type, *args)
- a = TimeEntry.calculate(type, *args)
- b = CostEntry.calculate(type, *args)
+ def calculate(type, *)
+ a = TimeEntry.calculate(type, *)
+ b = CostEntry.calculate(type, *)
case type
when :sum, :count then a + b
when :avg then (a + b) / 2
@@ -69,16 +69,16 @@ module Entry
def find_from_ids(_args, options) find_many :find_from_ids, options end
- def find_one(*args)
- TimeEntry.send(*args) || CostEntry.send(*args)
+ def find_one(*)
+ TimeEntry.send(*) || CostEntry.send(*)
end
- def find_many(*args)
- TimeEntry.send(*args) + CostEntry.send(*args)
+ def find_many(*)
+ TimeEntry.send(*) + CostEntry.send(*)
end
- def send_all(*args)
- [TimeEntry.send(*args), CostEntry.send(*args)]
+ def send_all(*)
+ [TimeEntry.send(*), CostEntry.send(*)]
end
end
end
diff --git a/modules/costs/app/services/time_entries/set_attributes_service.rb b/modules/costs/app/services/time_entries/set_attributes_service.rb
index d7c27f478e9..a42862f7d97 100644
--- a/modules/costs/app/services/time_entries/set_attributes_service.rb
+++ b/modules/costs/app/services/time_entries/set_attributes_service.rb
@@ -30,7 +30,7 @@ module TimeEntries
class SetAttributesService < ::BaseServices::SetAttributes
private
- def set_attributes(attributes)
+ def set_attributes(_attributes)
model.attributes = params
##
diff --git a/modules/costs/db/migrate/20180323133404_to_v710_aggregated_costs_migrations.rb b/modules/costs/db/migrate/20180323133404_to_v710_aggregated_costs_migrations.rb
index b1aece8fd0c..8202b775909 100644
--- a/modules/costs/db/migrate/20180323133404_to_v710_aggregated_costs_migrations.rb
+++ b/modules/costs/db/migrate/20180323133404_to_v710_aggregated_costs_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join("db", "migrate", "migration_utils", "migration_squasher").to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
# This migration aggregates the migrations detailed in MIGRATION_FILES
class ToV710AggregatedCostsMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
@@ -120,7 +120,7 @@ class ToV710AggregatedCostsMigrations < ActiveRecord::Migration[5.1]
t.integer :author_id, null: false
t.string :subject, null: false
t.text :description
- t.date :fixed_date, null: false
+ t.date :fixed_date, null: false
t.datetime :created_on
end
diff --git a/modules/costs/lib/costs/patches/members_patch.rb b/modules/costs/lib/costs/patches/members_patch.rb
index d47b230473c..9bc1aca8a33 100644
--- a/modules/costs/lib/costs/patches/members_patch.rb
+++ b/modules/costs/lib/costs/patches/members_patch.rb
@@ -45,7 +45,7 @@ module Costs
module TableComponent
def sort_collection(query, sort_clause, sort_columns)
- q = super query, sort_clause.gsub("current_rate", 'COALESCE(rate, 0.0)'), sort_columns
+ q = super(query, sort_clause.gsub("current_rate", 'COALESCE(rate, 0.0)'), sort_columns)
if sort_columns.include? :current_rate
join_rate q
diff --git a/modules/costs/spec/factories/cost_rate_factory.rb b/modules/costs/spec/factories/cost_rate_factory.rb
index b7307b720d9..9460919cd54 100644
--- a/modules/costs/spec/factories/cost_rate_factory.rb
+++ b/modules/costs/spec/factories/cost_rate_factory.rb
@@ -28,7 +28,7 @@
FactoryBot.define do
factory :cost_rate do
- association :cost_type, factory: :cost_type
+ association :cost_type
valid_from { Date.today }
rate { 50.0 }
end
diff --git a/modules/costs/spec/factories/default_hourly_rate_factory.rb b/modules/costs/spec/factories/default_hourly_rate_factory.rb
index ad7a3873302..d77bfd71bb6 100644
--- a/modules/costs/spec/factories/default_hourly_rate_factory.rb
+++ b/modules/costs/spec/factories/default_hourly_rate_factory.rb
@@ -28,7 +28,7 @@
FactoryBot.define do
factory :default_hourly_rate do
- association :user, factory: :user
+ association :user
valid_from { Date.today }
rate { 50.0 }
end
diff --git a/modules/costs/spec/factories/hourly_rate_factory.rb b/modules/costs/spec/factories/hourly_rate_factory.rb
index d11ecf9ed53..96bdde3ad78 100644
--- a/modules/costs/spec/factories/hourly_rate_factory.rb
+++ b/modules/costs/spec/factories/hourly_rate_factory.rb
@@ -28,8 +28,8 @@
FactoryBot.define do
factory :hourly_rate do
- association :user, factory: :user
- association :project, factory: :project
+ association :user
+ association :project
valid_from { Date.today }
rate { 50.0 }
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 2ef46f0b4f0..a11bcf36324 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
@@ -28,7 +28,7 @@
require_relative '../../spec_helper'
-RSpec.describe 'Work Package cost fields', js: true do
+RSpec.describe 'Work Package cost fields', :js do
shared_let(:type_task) { create(:type_task) }
shared_let(:status) { create(:status, is_default: true) }
shared_let(:priority) { create(:priority, is_default: true) }
@@ -79,17 +79,17 @@ RSpec.describe 'Work Package cost fields', js: true do
# Set single value, should update suffix
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_selector('#cost_entry_costs', text: '1.00 EUR')
+ expect(page).to have_css('#cost_entry_unit_name', text: 'A single')
+ expect(page).to have_css('#cost_entry_costs', text: '1.00 EUR')
fill_in 'cost_entry_units', with: '2'
- expect(page).to have_selector('#cost_entry_unit_name', text: 'A plural')
- expect(page).to have_selector('#cost_entry_costs', text: '2.00 EUR')
+ expect(page).to have_css('#cost_entry_unit_name', text: 'A plural')
+ expect(page).to have_css('#cost_entry_costs', text: '2.00 EUR')
# Switch cost type
select 'B', from: 'cost_entry_cost_type_id'
- expect(page).to have_selector('#cost_entry_unit_name', text: 'B plural')
- expect(page).to have_selector('#cost_entry_costs', text: '4.00 EUR')
+ expect(page).to have_css('#cost_entry_unit_name', text: 'B plural')
+ expect(page).to have_css('#cost_entry_costs', text: '4.00 EUR')
# Override costs
find_by_id('cost_entry_costs').click
@@ -99,7 +99,7 @@ RSpec.describe 'Work Package cost fields', js: true do
click_on 'Save'
# Expect correct costs
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
entry = CostEntry.last
expect(entry.cost_type_id).to eq(cost_type2.id)
expect(entry.units).to eq(2.0)
@@ -107,7 +107,7 @@ RSpec.describe 'Work Package cost fields', js: true do
expect(entry.real_costs).to eq(15.52)
visit edit_cost_entry_path(entry)
- expect(page).to have_selector('#cost_entry_costs', text: '15.52 EUR')
+ expect(page).to have_css('#cost_entry_costs', text: '15.52 EUR')
end
context 'with german locale' do
@@ -125,8 +125,8 @@ RSpec.describe 'Work Package cost fields', js: true do
SeleniumHubWaiter.wait
fill_in 'cost_entry_units', with: '1,42'
select 'B', from: 'cost_entry_cost_type_id'
- expect(page).to have_selector('#cost_entry_unit_name', text: 'B plural')
- expect(page).to have_selector('#cost_entry_costs', text: '2,84 EUR')
+ expect(page).to have_css('#cost_entry_unit_name', text: 'B plural')
+ expect(page).to have_css('#cost_entry_costs', text: '2,84 EUR')
# Override costs
find_by_id('cost_entry_costs').click
@@ -136,7 +136,7 @@ RSpec.describe 'Work Package cost fields', js: true do
click_on I18n.t(:button_save)
# Expect correct costs
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
entry = CostEntry.last
expect(entry.cost_type_id).to eq(cost_type2.id)
expect(entry.units).to eq(1.42)
@@ -145,7 +145,7 @@ RSpec.describe 'Work Package cost fields', js: true do
# Can edit the costs again
visit edit_cost_entry_path(entry)
- expect(page).to have_selector('#cost_entry_costs', text: '1.350,25 EUR')
+ expect(page).to have_css('#cost_entry_costs', text: '1.350,25 EUR')
# Toggle the cost button
SeleniumHubWaiter.wait
@@ -156,7 +156,7 @@ RSpec.describe 'Work Package cost fields', js: true do
fill_in 'cost_entry_overridden_costs', with: '55.000,55'
click_on I18n.t(:button_save)
- expect(page).to have_selector('#cost_entry_costs', text: '55.000,55 EUR')
+ expect(page).to have_css('#cost_entry_costs', text: '55.000,55 EUR')
entry.reload
expect(entry.units).to eq(1.42)
expect(entry.costs).to eq(2.84)
@@ -181,8 +181,8 @@ RSpec.describe 'Work Package cost fields', js: true do
find('.menu-item', text: I18n.t(:button_log_costs)).click
SeleniumHubWaiter.wait
- 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)
+ expect(page).to have_no_css('#cost_entry_user_id option', text: placeholder_user.name, visible: :all)
+ expect(page).to have_css('#cost_entry_user_id option', text: user.name, visible: :all)
end
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 8c33b65795e..111a666a5ee 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
@@ -28,7 +28,7 @@
require_relative '../../spec_helper'
-RSpec.describe 'Create cost entry without rate permissions', js: true do
+RSpec.describe 'Create cost entry without rate permissions', :js do
shared_let(:type_task) { create(:type_task) }
shared_let(:status) { create(:status, is_default: true) }
shared_let(:priority) { create(:priority, is_default: true) }
@@ -71,13 +71,13 @@ RSpec.describe 'Create cost entry without rate permissions', js: true do
# Set single value, should update suffix
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).not_to have_selector('#cost_entry_costs')
+ expect(page).to have_css('#cost_entry_unit_name', text: 'A single')
+ expect(page).to have_no_css('#cost_entry_costs')
click_on 'Save'
# Expect correct costs
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_cost_logged_successfully))
entry = CostEntry.last
expect(entry.cost_type_id).to eq(cost_type.id)
expect(entry.units).to eq(1.0)
diff --git a/modules/costs/spec/features/cost_types/create_cost_type_spec.rb b/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
index d8f834cf6bf..6f4cd437db8 100644
--- a/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
+++ b/modules/costs/spec/features/cost_types/create_cost_type_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'creating a cost type', js: true do
+RSpec.describe 'creating a cost type', :js do
let!(:user) { create(:admin) }
let!(:cost_type) do
type = create(:cost_type, name: 'Translations')
@@ -53,14 +53,14 @@ RSpec.describe 'creating a cost type', js: true do
scroll_to_and_click(find('button.-with-icon.icon-checkmark'))
expect_angular_frontend_initialized
- expect(page).to have_selector '.generic-table', wait: 10
+ expect(page).to have_css '.generic-table', wait: 10
cost_type_row = find('tr', text: 'Test day rate')
- expect(cost_type_row).to have_selector('td a', text: 'Test day rate')
- expect(cost_type_row).to have_selector('td', text: 'dayUnit')
- expect(cost_type_row).to have_selector('td', text: 'dayUnitPlural')
- expect(cost_type_row).to have_selector('td.currency', text: '1,000.25')
+ expect(cost_type_row).to have_css('td a', text: 'Test day rate')
+ expect(cost_type_row).to have_css('td', text: 'dayUnit')
+ expect(cost_type_row).to have_css('td', text: 'dayUnitPlural')
+ expect(cost_type_row).to have_css('td.currency', text: '1,000.25')
cost_type = CostType.last
expect(cost_type.name).to eq 'Test day rate'
@@ -84,14 +84,14 @@ RSpec.describe 'creating a cost type', js: true do
scroll_to_and_click(find('button.-with-icon.icon-checkmark'))
expect_angular_frontend_initialized
- expect(page).to have_selector '.generic-table', wait: 10
+ expect(page).to have_css '.generic-table', wait: 10
cost_type_row = find('tr', text: 'Test day rate')
- expect(cost_type_row).to have_selector('td a', text: 'Test day rate')
- expect(cost_type_row).to have_selector('td', text: 'dayUnit')
- expect(cost_type_row).to have_selector('td', text: 'dayUnitPlural')
- expect(cost_type_row).to have_selector('td.currency', text: '1.000,25')
+ expect(cost_type_row).to have_css('td a', text: 'Test day rate')
+ expect(cost_type_row).to have_css('td', text: 'dayUnit')
+ expect(cost_type_row).to have_css('td', text: 'dayUnitPlural')
+ expect(cost_type_row).to have_css('td.currency', text: '1.000,25')
cost_type = CostType.last
expect(cost_type.name).to eq 'Test day rate'
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 42479aca549..48f61847e2a 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'deleting a cost type', js: true do
+RSpec.describe 'deleting a cost type', :js do
let!(:user) { create(:admin) }
let!(:cost_type) do
type = create(:cost_type, name: 'Translations')
@@ -49,7 +49,7 @@ RSpec.describe 'deleting a cost type', js: true do
# Expect no results if not locked
expect_angular_frontend_initialized
- expect(page).to have_selector '.generic-table--no-results-container', wait: 10
+ expect(page).to have_css '.generic-table--no-results-container', wait: 10
SeleniumHubWaiter.wait
# Show locked
@@ -59,7 +59,7 @@ RSpec.describe 'deleting a cost type', js: true do
# Expect no results if not locked
expect(page).to have_text I18n.t(:label_locked_cost_types)
- expect(page).to have_selector('.restore_cost_type')
- expect(page).to have_selector('.cost-types--list-deleted td', text: 'Translations')
+ expect(page).to have_css('.restore_cost_type')
+ expect(page).to have_css('.cost-types--list-deleted td', text: 'Translations')
end
end
diff --git a/modules/costs/spec/features/costs_context_menu_spec.rb b/modules/costs/spec/features/costs_context_menu_spec.rb
index 1cb8cf88e16..48ed7859e98 100644
--- a/modules/costs/spec/features/costs_context_menu_spec.rb
+++ b/modules/costs/spec/features/costs_context_menu_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work package table log unit costs', js: true do
+RSpec.describe 'Work package table log unit costs', :js do
let(:user) { create(:admin) }
let(:work_package) { create(:work_package) }
@@ -26,6 +26,6 @@ RSpec.describe 'Work package table log unit costs', js: true do
it 'renders the log unit costs menu item' do
menu.choose(I18n.t(:label_log_costs))
- expect(page).to have_selector('h2', text: I18n.t(:label_log_costs))
+ expect(page).to have_css('h2', text: I18n.t(:label_log_costs))
end
end
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 ee77ac8af19..66874c5d1cb 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
@@ -28,7 +28,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
-RSpec.describe 'Deleting time entries', js: true do
+RSpec.describe 'Deleting time entries', :js do
let(:project) { work_package.project }
let(:user) do
create(:user,
diff --git a/modules/costs/spec/features/members_hourly_rates_spec.rb b/modules/costs/spec/features/members_hourly_rates_spec.rb
index 9e4ce090f3b..9b37479230e 100644
--- a/modules/costs/spec/features/members_hourly_rates_spec.rb
+++ b/modules/costs/spec/features/members_hourly_rates_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe 'hourly rates on a member', :js do
def expect_current_rate_in_members_table(amount)
view_project_members
- expect(page).to have_selector("#member-#{member.id} .currency", text: amount)
+ expect(page).to have_css("#member-#{member.id} .currency", text: amount)
end
def add_rate(rate:, date:)
diff --git a/modules/costs/spec/features/time_entries_spec.rb b/modules/costs/spec/features/time_entries_spec.rb
index 1e3875ff259..661e3184ebc 100644
--- a/modules/costs/spec/features/time_entries_spec.rb
+++ b/modules/costs/spec/features/time_entries_spec.rb
@@ -28,7 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'Work Package table cost entries', js: true do
+RSpec.describe 'Work Package table cost entries', :js do
shared_let(:project) { create(:project_with_types) }
shared_let(:user) { create(:admin) }
@@ -73,8 +73,8 @@ RSpec.describe 'Work Package table cost entries', js: true do
parent_row = wp_table.row(parent)
wp_row = wp_table.row(work_package)
- expect(parent_row).to have_selector('.inline-edit--container.spentTime', text: '12.5 h')
- expect(wp_row).to have_selector('.inline-edit--container.spentTime', text: '2.5 h')
+ expect(parent_row).to have_css('.inline-edit--container.spentTime', text: '12.5 h')
+ expect(wp_row).to have_css('.inline-edit--container.spentTime', text: '2.5 h')
end
it 'creates an activity' do
@@ -86,7 +86,7 @@ RSpec.describe 'Work Package table cost entries', js: true do
wp1 = time_entry1.work_package
wp2 = time_entry2.work_package
- expect(page).to have_selector('.op-activity-list--item-title', text: "#{wp1.type.name} ##{wp1.id}: #{wp1.subject}")
- expect(page).to have_selector('.op-activity-list--item-title', text: "#{wp2.type.name} ##{wp2.id}: #{wp2.subject}")
+ expect(page).to have_css('.op-activity-list--item-title', text: "#{wp1.type.name} ##{wp1.id}: #{wp1.subject}")
+ expect(page).to have_css('.op-activity-list--item-title', text: "#{wp2.type.name} ##{wp2.id}: #{wp2.subject}")
end
end
diff --git a/modules/costs/spec/features/timer_spec.rb b/modules/costs/spec/features/timer_spec.rb
index d22e9b26339..cdbdb22cc11 100644
--- a/modules/costs/spec/features/timer_spec.rb
+++ b/modules/costs/spec/features/timer_spec.rb
@@ -28,7 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'Work Package timer', js: true do
+RSpec.describe 'Work Package timer', :js do
shared_let(:project) { create(:project_with_types) }
shared_let(:work_package_a) { create(:work_package, subject: 'WP A', project:) }
@@ -59,8 +59,8 @@ RSpec.describe 'Work Package timer', js: true do
expect(timer_entry.hours).to be_nil
page.find('.op-top-menu-user').click
- expect(page).to have_selector('.op-timer-account-menu', wait: 10)
- expect(page).to have_selector('.op-timer-account-menu--wp-details', text: "##{work_package_a.id}: WP A")
+ expect(page).to have_css('.op-timer-account-menu', wait: 10)
+ expect(page).to have_css('.op-timer-account-menu--wp-details', text: "##{work_package_a.id}: WP A")
page.find_test_selector('op-timer-account-menu-stop').click
time_logging_modal.is_visible true
@@ -92,7 +92,7 @@ RSpec.describe 'Work Package timer', js: true do
timer_button.start
- expect(page).to have_selector('.op-timer-stop-modal')
+ expect(page).to have_css('.op-timer-stop-modal')
expect(page).to have_text('Tracking time:')
active_time_entries = TimeEntry.where(ongoing: true, user:)
@@ -163,7 +163,7 @@ RSpec.describe 'Work Package timer', js: true do
timer_button.expect_inactive
timer_button.start
- expect(page).to have_selector('.op-timer-stop-modal')
+ expect(page).to have_css('.op-timer-stop-modal')
expect(page).to have_text('Tracking time:')
page.within('.spot-modal') { click_button 'Stop current timer' }
@@ -207,7 +207,7 @@ RSpec.describe 'Work Package timer', js: true do
wp_view_a.visit!
# Wait for another button to be present
- expect(page).to have_selector('#watch-button', wait: 10)
+ expect(page).to have_css('#watch-button', wait: 10)
timer_button.expect_visible visible: false
end
end
diff --git a/modules/costs/spec/features/users_hourly_rates_spec.rb b/modules/costs/spec/features/users_hourly_rates_spec.rb
index 00ea8f5bcbb..7d0ab901267 100644
--- a/modules/costs/spec/features/users_hourly_rates_spec.rb
+++ b/modules/costs/spec/features/users_hourly_rates_spec.rb
@@ -28,7 +28,7 @@
require_relative '../spec_helper'
-RSpec.describe 'hourly rates on user edit', js: true do
+RSpec.describe 'hourly rates on user edit', :js do
let(:user) { create(:admin) }
def view_rates
@@ -73,7 +73,7 @@ RSpec.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).not_to have_text 'Current rate'
+ expect(page).to have_no_text 'Current rate'
end
end
end
@@ -98,8 +98,8 @@ RSpec.describe 'hourly rates on user edit', js: true do
view_rates
- expect(page).to have_selector('.currency', text: '1,00')
- expect(page).to have_selector('.currency', text: '5,12')
+ expect(page).to have_css('.currency', text: '1,00')
+ expect(page).to have_css('.currency', text: '5,12')
end
end
end
diff --git a/modules/costs/spec/models/cost_entry_spec.rb b/modules/costs/spec/models/cost_entry_spec.rb
index b925339c433..9bcccb733a3 100644
--- a/modules/costs/spec/models/cost_entry_spec.rb
+++ b/modules/costs/spec/models/cost_entry_spec.rb
@@ -108,7 +108,7 @@ RSpec.describe CostEntry do
cost_entry.save!
end
- it { expect(CostEntry.visible(user2, project)).to match_array([cost_entry]) }
+ it { expect(CostEntry.visible(user2, project)).to contain_exactly(cost_entry) }
end
describe "WHEN not having the view_cost_entries permission
@@ -120,7 +120,7 @@ RSpec.describe CostEntry do
cost_entry.save!
end
- it { expect(CostEntry.visible(user2, project)).to match_array([]) }
+ it { expect(CostEntry.visible(user2, project)).to be_empty }
end
describe "WHEN having the view_own_cost_entries permission
@@ -132,7 +132,7 @@ RSpec.describe CostEntry do
cost_entry.save!
end
- it { expect(CostEntry.visible(user2, project)).to match_array([]) }
+ it { expect(CostEntry.visible(user2, project)).to be_empty }
end
describe "WHEN having the view_own_cost_entries permission
@@ -144,7 +144,7 @@ RSpec.describe CostEntry do
cost_entry2.save!
end
- it { expect(CostEntry.visible(cost_entry2.user, project)).to match_array([cost_entry2]) }
+ it { expect(CostEntry.visible(cost_entry2.user, project)).to contain_exactly(cost_entry2) }
end
end
end
diff --git a/modules/costs/spec/models/projects/scopes/activated_time_activity_spec.rb b/modules/costs/spec/models/projects/scopes/activated_time_activity_spec.rb
index f5f7b9a82ed..15c170ec234 100644
--- a/modules/costs/spec/models/projects/scopes/activated_time_activity_spec.rb
+++ b/modules/costs/spec/models/projects/scopes/activated_time_activity_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe Projects::Scopes::ActivatedTimeActivity do
context 'and being active' do
it 'returns all projects' do
expect(subject)
- .to match_array [project, other_project]
+ .to contain_exactly(project, other_project)
end
end
@@ -65,7 +65,7 @@ RSpec.describe Projects::Scopes::ActivatedTimeActivity do
context 'and being active' do
it 'returns the project the activity is activated in' do
expect(subject)
- .to match_array [project]
+ .to contain_exactly(project)
end
end
@@ -76,7 +76,7 @@ RSpec.describe Projects::Scopes::ActivatedTimeActivity do
it 'returns only the projects the activity is activated in' do
expect(subject)
- .to match_array [project]
+ .to contain_exactly(project)
end
end
end
diff --git a/modules/costs/spec/models/time_entries/scopes/of_user_and_day_spec.rb b/modules/costs/spec/models/time_entries/scopes/of_user_and_day_spec.rb
index 4078396c00e..3629d96f1db 100644
--- a/modules/costs/spec/models/time_entries/scopes/of_user_and_day_spec.rb
+++ b/modules/costs/spec/models/time_entries/scopes/of_user_and_day_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe TimeEntries::Scopes::OfUserAndDay do
it 'are all the time entries of the user on the date' do
expect(subject)
- .to match_array([time_entry, other_time_entry])
+ .to contain_exactly(time_entry, other_time_entry)
end
context 'if excluding a time entry' do
@@ -65,7 +65,7 @@ RSpec.describe TimeEntries::Scopes::OfUserAndDay do
it 'does not include the time entry' do
expect(subject)
- .to match_array([time_entry])
+ .to contain_exactly(time_entry)
end
end
end
diff --git a/modules/costs/spec/models/time_entry_activities/scopes/active_in_project_spec.rb b/modules/costs/spec/models/time_entry_activities/scopes/active_in_project_spec.rb
index f4eecce27a2..0bdd14257c8 100644
--- a/modules/costs/spec/models/time_entry_activities/scopes/active_in_project_spec.rb
+++ b/modules/costs/spec/models/time_entry_activities/scopes/active_in_project_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
context 'with the activity being active' do
it 'includes the activity' do
expect(subject)
- .to match_array [activity, other_activity]
+ .to contain_exactly(activity, other_activity)
end
end
@@ -52,7 +52,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'excludes the activity' do
expect(subject)
- .to match_array([other_activity])
+ .to contain_exactly(other_activity)
end
end
end
@@ -64,7 +64,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'includes the activity' do
expect(subject)
- .to match_array [activity, other_activity]
+ .to contain_exactly(activity, other_activity)
end
context 'with the activity being inactive' do
@@ -74,7 +74,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'includes the activity' do
expect(subject)
- .to match_array [activity, other_activity]
+ .to contain_exactly(activity, other_activity)
end
end
end
@@ -86,7 +86,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'includes the activity' do
expect(subject)
- .to match_array [activity, other_activity]
+ .to contain_exactly(activity, other_activity)
end
end
@@ -97,7 +97,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'excludes the activity' do
expect(subject)
- .to match_array [other_activity]
+ .to contain_exactly(other_activity)
end
context 'with a project configuration configured to true but for a different project' do
@@ -107,7 +107,7 @@ RSpec.describe TimeEntryActivities::Scopes::ActiveInProject do
it 'excludes the activity' do
expect(subject)
- .to match_array [other_activity]
+ .to contain_exactly(other_activity)
end
end
end
diff --git a/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb b/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb
index 8ef8bbb0aac..34b82bfd6c4 100644
--- a/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb
+++ b/modules/costs/spec/services/time_entries/set_attributes_service_spec.rb
@@ -200,7 +200,7 @@ RSpec.describe TimeEntries::SetAttributesService, type: :model do
context 'with an invalid contract' do
let(:contract_valid) { false }
let(:expect_time_instance_save) do
- expect(time_entry_instance).not_to receive(:save) # rubocop:disable RSpec/MessageSpies
+ expect(time_entry_instance).not_to receive(:save) # rubocop:disable RSpec/MessageSpies
end
it 'returns failure' do
diff --git a/modules/dashboards/spec/contracts/grids/create_contract_spec.rb b/modules/dashboards/spec/contracts/grids/create_contract_spec.rb
index 7ea452fef89..0da26fb0323 100644
--- a/modules/dashboards/spec/contracts/grids/create_contract_spec.rb
+++ b/modules/dashboards/spec/contracts/grids/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe Grids::CreateContract do
include_context 'grid contract'
diff --git a/modules/dashboards/spec/features/custom_text_spec.rb b/modules/dashboards/spec/features/custom_text_spec.rb
index ebecb6fbb13..764a90d5df3 100644
--- a/modules/dashboards/spec/features/custom_text_spec.rb
+++ b/modules/dashboards/spec/features/custom_text_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Project description widget on dashboard', js: true do
+RSpec.describe 'Project description widget on dashboard', :js do
let!(:type) { create(:type_task, name: 'Task') }
let!(:project) do
create(:project, types: [type])
@@ -79,7 +79,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
editor.insert_macro 'Insert create work package button'
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
select 'Task', from: 'selected-type'
find('.spot-modal--submit-button').click
@@ -88,7 +88,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
dashboard_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
within('#content') do
- expect(page).to have_selector("a[href=\"/projects/#{project.identifier}/work_packages/new?type=#{type.id}\"]")
+ expect(page).to have_css("a[href=\"/projects/#{project.identifier}/work_packages/new?type=#{type.id}\"]")
end
end
@@ -111,7 +111,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
within custom_text_widget.area do
expect(page)
- .to have_selector('.inline-edit--display-field', text: 'My own little text')
+ .to have_css('.inline-edit--display-field', text: 'My own little text')
find('.inplace-editing--container').click
@@ -119,7 +119,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
field.cancel_by_click
expect(page)
- .to have_selector('.inline-edit--display-field', text: 'My own little text')
+ .to have_css('.inline-edit--display-field', text: 'My own little text')
end
dashboard_page.expect_no_toaster message: I18n.t('js.notice_successful_update')
@@ -137,7 +137,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
within custom_text_widget.area do
expect(page).to have_test_selector('op-attachment-list-item', text: 'image.png')
- expect(page).not_to have_selector('notifications-upload-progress')
+ expect(page).to have_no_css('notifications-upload-progress')
field.save!
end
@@ -146,7 +146,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
within custom_text_widget.area do
expect(page)
- .to have_selector('#content img', count: 1)
+ .to have_css('#content img', count: 1)
expect(page)
.not_to have_test_selector('op-attachment-list-item', text: 'image.png')
@@ -175,7 +175,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
.to have_content(dashboard.widgets.first.options[:text])
expect(page)
- .not_to have_selector('.inplace-editing--container')
+ .to have_no_css('.inplace-editing--container')
end
end
end
diff --git a/modules/dashboards/spec/features/docments_spec.rb b/modules/dashboards/spec/features/docments_spec.rb
index fefcf6e842a..adc46559269 100644
--- a/modules/dashboards/spec/features/docments_spec.rb
+++ b/modules/dashboards/spec/features/docments_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Documents widget on dashboard', js: true do
+RSpec.describe 'Documents widget on dashboard', :js do
let!(:project) { create(:project) }
let!(:other_project) { create(:project) }
let!(:visible_document) do
diff --git a/modules/dashboards/spec/features/members_principals_spec.rb b/modules/dashboards/spec/features/members_principals_spec.rb
index 625a4226016..bed0d1f449b 100644
--- a/modules/dashboards/spec/features/members_principals_spec.rb
+++ b/modules/dashboards/spec/features/members_principals_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Dashboard page members', js: true do
+RSpec.describe 'Dashboard page members', :js do
shared_let(:type) { create(:type) }
shared_let(:project) { create(:project, types: [type], description: 'My **custom** description') }
diff --git a/modules/dashboards/spec/features/members_spec.rb b/modules/dashboards/spec/features/members_spec.rb
index cc038800ce6..4271a970c33 100644
--- a/modules/dashboards/spec/features/members_spec.rb
+++ b/modules/dashboards/spec/features/members_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Members widget on dashboard', js: true do
+RSpec.describe 'Members widget on dashboard', :js do
let!(:project) { create(:project) }
let!(:other_project) { create(:project) }
@@ -108,7 +108,7 @@ RSpec.describe 'Members widget on dashboard', js: true do
expect_all_members_visible(members_area.area)
expect(page)
- .not_to have_content invisible_user.name
+ .to have_no_content invisible_user.name
within members_area.area do
expect(page)
@@ -125,7 +125,7 @@ RSpec.describe 'Members widget on dashboard', js: true do
within members_area.area do
expect(page)
- .not_to have_link('Member')
+ .to have_no_link('Member')
end
# A user without view permission will not see any members
@@ -143,10 +143,10 @@ RSpec.describe 'Members widget on dashboard', js: true do
.to have_content('No visible members')
expect(page)
- .not_to have_link('Member')
+ .to have_no_link('Member')
expect(page)
- .not_to have_link('View all members')
+ .to have_no_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 4d8e9850c21..fa7a1d0a8ae 100644
--- a/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb
+++ b/modules/dashboards/spec/features/modifying_with_unallowed_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Modifying a dashboard which already has widgets for which permissions are lacking', js: true do
+RSpec.describe 'Modifying a dashboard which already has widgets for which permissions are lacking', :js do
let!(:project) do
create(:project)
end
@@ -90,6 +90,6 @@ RSpec.describe 'Modifying a dashboard which already has widgets for which permis
dashboard_page.visit!
expect(page)
- .not_to have_selector('.grid--area.-widgeted:nth-of-type(2)')
+ .to have_no_css('.grid--area.-widgeted:nth-of-type(2)')
end
end
diff --git a/modules/dashboards/spec/features/navigation_spec.rb b/modules/dashboards/spec/features/navigation_spec.rb
index a1a70270ae2..eabaca0e1bc 100644
--- a/modules/dashboards/spec/features/navigation_spec.rb
+++ b/modules/dashboards/spec/features/navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Navigate to dashboard', js: true do
+RSpec.describe 'Navigate to dashboard', :js do
let(:project) { create(:project) }
let(:permissions) { [:view_dashboards] }
let(:user) do
diff --git a/modules/dashboards/spec/features/news_spec.rb b/modules/dashboards/spec/features/news_spec.rb
index 7873df17ba5..1c395aa6b68 100644
--- a/modules/dashboards/spec/features/news_spec.rb
+++ b/modules/dashboards/spec/features/news_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'News widget on dashboard', js: true do
+RSpec.describe 'News widget on dashboard', :js do
let!(:project) { create(:project) }
let!(:other_project) { create(:project) }
let!(:visible_news) do
diff --git a/modules/dashboards/spec/features/project_description_spec.rb b/modules/dashboards/spec/features/project_description_spec.rb
index 3c54560d0d0..f52f5f92527 100644
--- a/modules/dashboards/spec/features/project_description_spec.rb
+++ b/modules/dashboards/spec/features/project_description_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Project description widget on dashboard', js: true do
+RSpec.describe 'Project description widget on dashboard', :js do
let(:project_description) { "Some text I like to write" }
let!(:project) do
create(:project, description: project_description)
@@ -112,7 +112,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
# The edit field is toggled and the value saved.
expect(page).to have_content('A completely new description which is super cool.')
expect(page).to have_selector(field.selector)
- expect(page).not_to have_selector(field.input_selector)
+ expect(page).to have_no_selector(field.input_selector)
end
end
end
@@ -137,7 +137,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
editor.insert_macro 'Insert create work package button'
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
select 'Task', from: 'selected-type'
find('.spot-modal--submit-button').click
@@ -146,7 +146,7 @@ RSpec.describe 'Project description widget on dashboard', js: true do
dashboard_page.expect_and_dismiss_toaster message: I18n.t('js.notice_successful_update')
within('#content') do
- expect(page).to have_selector("a[href=\"/projects/#{project.identifier}/work_packages/new?type=#{type.id}\"]")
+ expect(page).to have_css("a[href=\"/projects/#{project.identifier}/work_packages/new?type=#{type.id}\"]")
end
end
end
diff --git a/modules/dashboards/spec/features/project_details_spec.rb b/modules/dashboards/spec/features/project_details_spec.rb
index 428ac9a6777..5854a2a3a9d 100644
--- a/modules/dashboards/spec/features/project_details_spec.rb
+++ b/modules/dashboards/spec/features/project_details_spec.rb
@@ -111,7 +111,7 @@ RSpec.describe 'Project details widget on dashboard', :js do
# The edit field is toggled and the value saved.
expect(page).to have_content(new_value)
expect(page).to have_selector(cf.selector)
- expect(page).not_to have_selector(cf.input_selector)
+ expect(page).to have_no_selector(cf.input_selector)
end
before do
diff --git a/modules/dashboards/spec/features/project_status_spec.rb b/modules/dashboards/spec/features/project_status_spec.rb
index 59ced1df618..51e638adc67 100644
--- a/modules/dashboards/spec/features/project_status_spec.rb
+++ b/modules/dashboards/spec/features/project_status_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Project status widget on dashboard', js: true do
+RSpec.describe 'Project status widget on dashboard', :js do
let!(:project) do
create(:project,
status_code: 'on_track',
@@ -120,7 +120,7 @@ RSpec.describe 'Project status widget on dashboard', js: true do
# The edit field is toggled and the value saved.
expect(page).to have_content('AT RISK')
expect(page).to have_selector(field.selector)
- expect(page).not_to have_selector(field.input_selector)
+ expect(page).to have_no_selector(field.input_selector)
# Unset the project status
field.activate!
@@ -130,7 +130,7 @@ RSpec.describe 'Project status widget on dashboard', js: true do
# The edit field is toggled and the value saved.
expect(page).to have_content('NOT SET')
expect(page).to have_selector(field.selector)
- expect(page).not_to have_selector(field.input_selector)
+ expect(page).to have_no_selector(field.input_selector)
# Open explanation field
field = TextEditorField.new dashboard_page, 'statusExplanation'
@@ -145,7 +145,7 @@ RSpec.describe 'Project status widget on dashboard', js: true do
# The edit field is toggled and the value saved.
expect(page).to have_content('A completely new explanation which is super cool.')
expect(page).to have_selector(field.selector)
- expect(page).not_to have_selector(field.input_selector)
+ expect(page).to have_no_selector(field.input_selector)
end
end
end
diff --git a/modules/dashboards/spec/features/read_only_allowed_spec.rb b/modules/dashboards/spec/features/read_only_allowed_spec.rb
index 3d5e1a26266..200fce2baa3 100644
--- a/modules/dashboards/spec/features/read_only_allowed_spec.rb
+++ b/modules/dashboards/spec/features/read_only_allowed_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Read only mode when user lacks edit permission on dashboard', js: true do
+RSpec.describe 'Read only mode when user lacks edit permission on dashboard', :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type]) }
let!(:work_package) do
diff --git a/modules/dashboards/spec/features/subprojects_spec.rb b/modules/dashboards/spec/features/subprojects_spec.rb
index 50988723b84..998df3e57fe 100644
--- a/modules/dashboards/spec/features/subprojects_spec.rb
+++ b/modules/dashboards/spec/features/subprojects_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Subprojects widget on dashboard', js: true do
+RSpec.describe 'Subprojects widget on dashboard', :js do
let!(:project) do
create(:project, parent: parent_project)
end
@@ -89,15 +89,15 @@ RSpec.describe 'Subprojects widget on dashboard', js: true do
expect(page)
.to have_link(child_project.name)
expect(page)
- .not_to have_link(archived_child_project.name)
+ .to have_no_link(archived_child_project.name)
expect(page)
- .not_to have_link(grandchild_project.name)
+ .to have_no_link(grandchild_project.name)
expect(page)
- .not_to have_link(invisible_child_project.name)
+ .to have_no_link(invisible_child_project.name)
expect(page)
- .not_to have_link(parent_project.name)
+ .to have_no_link(parent_project.name)
expect(page)
- .not_to have_link(project.name)
+ .to have_no_link(project.name)
end
end
end
@@ -115,15 +115,15 @@ RSpec.describe 'Subprojects widget on dashboard', js: true do
expect(page)
.to have_link(child_project.name)
expect(page)
- .not_to have_link(archived_child_project.name)
+ .to have_no_link(archived_child_project.name)
expect(page)
- .not_to have_link(grandchild_project.name)
+ .to have_no_link(grandchild_project.name)
expect(page)
.to have_link(invisible_child_project.name) # admins can see projects they are not a member of
expect(page)
- .not_to have_link(parent_project.name)
+ .to have_no_link(parent_project.name)
expect(page)
- .not_to have_link(project.name)
+ .to have_no_link(project.name)
end
end
end
diff --git a/modules/dashboards/spec/features/time_entries_spec.rb b/modules/dashboards/spec/features/time_entries_spec.rb
index 8606ded4b29..8a0216cbe64 100644
--- a/modules/dashboards/spec/features/time_entries_spec.rb
+++ b/modules/dashboards/spec/features/time_entries_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Time entries widget on dashboard', js: true do
+RSpec.describe 'Time entries widget on dashboard', :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type]) }
let!(:other_project) { create(:project, types: [type]) }
@@ -108,24 +108,24 @@ RSpec.describe 'Time entries widget on dashboard', js: true do
expect(page)
.to have_content Date.today.strftime('%m/%d/%Y')
expect(page)
- .to have_selector('.activity', text: visible_time_entry.activity.name)
+ .to have_css('.activity', text: visible_time_entry.activity.name)
expect(page)
- .to have_selector('.subject', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
+ .to have_css('.subject', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
expect(page)
- .to have_selector('.comments', text: visible_time_entry.comments)
+ .to have_css('.comments', text: visible_time_entry.comments)
expect(page)
- .to have_selector('.hours', text: visible_time_entry.hours)
+ .to have_css('.hours', text: visible_time_entry.hours)
expect(page)
.to have_content((Date.today - 1.day).strftime('%m/%d/%Y'))
expect(page)
- .to have_selector('.activity', text: other_visible_time_entry.activity.name)
+ .to have_css('.activity', text: other_visible_time_entry.activity.name)
expect(page)
- .to have_selector('.subject', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
+ .to have_css('.subject', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
expect(page)
- .to have_selector('.comments', text: other_visible_time_entry.comments)
+ .to have_css('.comments', text: other_visible_time_entry.comments)
expect(page)
- .to have_selector('.hours', text: other_visible_time_entry.hours)
+ .to have_css('.hours', text: other_visible_time_entry.hours)
# Allows to edit
page.find_test_selector("edit-time-entry-#{visible_time_entry.id}").click
@@ -143,7 +143,7 @@ RSpec.describe 'Time entries widget on dashboard', js: true do
time_logging_modal.is_visible false
within spent_time_widget.area do
- expect(page).to have_selector('.hours', text: 4)
+ expect(page).to have_css('.hours', text: 4)
end
visible_time_entry.reload
diff --git a/modules/dashboards/spec/features/work_package_calendar_spec.rb b/modules/dashboards/spec/features/work_package_calendar_spec.rb
index 4c37913d78c..f217ef8b7f0 100644
--- a/modules/dashboards/spec/features/work_package_calendar_spec.rb
+++ b/modules/dashboards/spec/features/work_package_calendar_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Work package calendar widget on dashboard',
- js: true do
+RSpec.describe 'Work package calendar widget on dashboard', :js do
let!(:type) { create(:type) }
let!(:priority) { create(:default_priority) }
let!(:project) { create(:project, types: [type]) }
@@ -125,19 +124,19 @@ RSpec.describe 'Work package calendar widget on dashboard',
within(calendar_widget.area) do
expect(page)
- .to have_selector('.fc-event-title', text: spanning_work_package.subject)
+ .to have_css('.fc-event-title', text: spanning_work_package.subject)
expect(page)
- .to have_selector('.fc-event-title', text: starting_work_package.subject)
+ .to have_css('.fc-event-title', text: starting_work_package.subject)
expect(page)
- .to have_selector('.fc-event-title', text: ending_work_package.subject)
+ .to have_css('.fc-event-title', text: ending_work_package.subject)
expect(page)
- .not_to have_selector('.fc-event-title', text: outdated_work_package.subject)
+ .to have_no_css('.fc-event-title', text: outdated_work_package.subject)
expect(page)
- .not_to have_selector('.fc-event-title', text: other_project_work_package.subject)
+ .to have_no_css('.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 68ad32eae7c..d4ce90faaf7 100644
--- a/modules/dashboards/spec/features/work_package_graph_overview_spec.rb
+++ b/modules/dashboards/spec/features/work_package_graph_overview_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Work package overview graph widget on dashboard',
- js: true do
+RSpec.describe 'Work package overview graph widget on dashboard', :js 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_graph_spec.rb b/modules/dashboards/spec/features/work_package_graph_spec.rb
index 2b60220e5df..e92115db6a3 100644
--- a/modules/dashboards/spec/features/work_package_graph_spec.rb
+++ b/modules/dashboards/spec/features/work_package_graph_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Arbitrary WorkPackage query graph widget dashboard',
- js: true, with_ee: %i[grid_widget_wp_graph] do
+RSpec.describe 'Arbitrary WorkPackage query graph widget dashboard', :js, with_ee: %i[grid_widget_wp_graph] do
let!(:type) { create(:type) }
let!(:other_type) { create(:type) }
let!(:priority) { create(:default_priority) }
@@ -172,7 +171,7 @@ RSpec.describe 'Arbitrary WorkPackage query graph widget dashboard',
# At this point the add widget modal is open
expect(page)
- .not_to have_content("Work packages graph")
+ .to have_no_content("Work packages graph")
end
end
end
diff --git a/modules/dashboards/spec/features/work_package_table_spec.rb b/modules/dashboards/spec/features/work_package_table_spec.rb
index ae751a2122a..26165c9f61c 100644
--- a/modules/dashboards/spec/features/work_package_table_spec.rb
+++ b/modules/dashboards/spec/features/work_package_table_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/dashboard'
-RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', js: true do
+RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', :js do
let!(:type) { create(:type) }
let!(:other_type) { create(:type) }
let!(:priority) { create(:default_priority) }
@@ -98,7 +98,7 @@ RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', js: true do
# Using it here as a safeguard to govern speed.
wp_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(1)')
expect(wp_area)
- .to have_selector('.subject', text: type_work_package.subject)
+ .to have_css('.subject', text: type_work_package.subject)
dashboard_page.add_widget(1, 1, :row, "Work packages table")
@@ -108,14 +108,14 @@ RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', js: true do
# At the beginning, the default query is displayed
expect(filter_area.area)
- .to have_selector('.subject', text: type_work_package.subject, wait: 30)
+ .to have_css('.subject', text: type_work_package.subject, wait: 30)
expect(filter_area.area)
- .to have_selector('.subject', text: other_type_work_package.subject)
+ .to have_css('.subject', text: other_type_work_package.subject)
# Work packages from other projects are not displayed as the query is project scoped
expect(filter_area.area)
- .not_to have_selector('.subject', text: other_project_work_package.subject)
+ .to have_no_css('.subject', text: other_project_work_package.subject)
# User has the ability to modify the query
@@ -131,19 +131,19 @@ RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', js: true do
columns.remove 'Subject'
expect(filter_area.area)
- .to have_selector('.id', text: type_work_package.id)
+ .to have_css('.id', text: type_work_package.id)
# as the Subject column is disabled
expect(filter_area.area)
- .not_to have_selector('.subject', text: type_work_package.subject)
+ .to have_no_css('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .not_to have_selector('.id', text: other_type_work_package.id)
+ .to have_no_css('.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)
- .not_to have_selector('.subject', text: other_project_work_package.subject)
+ .to have_no_css('.subject', text: other_project_work_package.subject)
scroll_to_element(filter_area.area)
within filter_area.area do
@@ -162,19 +162,19 @@ RSpec.describe 'Arbitrary WorkPackage query table widget dashboard', js: true do
filter_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(2)')
expect(filter_area.area)
- .to have_selector('.id', text: type_work_package.id)
+ .to have_css('.id', text: type_work_package.id)
# as the Subject column is disabled
expect(filter_area.area)
- .not_to have_selector('.subject', text: type_work_package.subject)
+ .to have_no_css('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .not_to have_selector('.id', text: other_type_work_package.id)
+ .to have_no_css('.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)
- .not_to have_selector('.subject', text: other_project_work_package.subject)
+ .to have_no_css('.subject', text: other_project_work_package.subject)
within filter_area.area do
expect(page).to have_field('editable-toolbar-title', with: 'My WP Filter', wait: 10)
diff --git a/modules/dashboards/spec/requests/api/v3/attachments/grid_spec.rb b/modules/dashboards/spec/requests/api/v3/attachments/grid_spec.rb
index 37ca93750de..3a22d712079 100644
--- a/modules/dashboards/spec/requests/api/v3/attachments/grid_spec.rb
+++ b/modules/dashboards/spec/requests/api/v3/attachments/grid_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require File.join(Rails.root, 'spec', 'requests', 'api', 'v3', 'attachments', 'attachment_resource_shared_examples')
+require Rails.root.join("spec/requests/api/v3/attachments/attachment_resource_shared_examples").to_s
RSpec.describe "grid attachments" do
before do
diff --git a/modules/documents/db/migrate/20180323140208_to_v710_aggregated_documents_migrations.rb b/modules/documents/db/migrate/20180323140208_to_v710_aggregated_documents_migrations.rb
index 9c61b1d39b3..0fb548865ca 100644
--- a/modules/documents/db/migrate/20180323140208_to_v710_aggregated_documents_migrations.rb
+++ b/modules/documents/db/migrate/20180323140208_to_v710_aggregated_documents_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join("db", "migrate", "migration_utils", "migration_squasher").to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
# This migration aggregates the migrations detailed in MIGRATION_FILES
class ToV710AggregatedDocumentsMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
diff --git a/modules/github_integration/lib/open_project/github_integration/hook_handler.rb b/modules/github_integration/lib/open_project/github_integration/hook_handler.rb
index 78fe910053e..13c604b5aee 100644
--- a/modules/github_integration/lib/open_project/github_integration/hook_handler.rb
+++ b/modules/github_integration/lib/open_project/github_integration/hook_handler.rb
@@ -55,7 +55,7 @@ module OpenProject::GithubIntegration
'github_event' => event_type,
'github_delivery' => event_delivery)
- OpenProject::Notifications.send("github.#{event_type}", payload)
+ OpenProject::Notifications.send(:"github.#{event_type}", payload)
200
end
diff --git a/modules/github_integration/lib/open_project/github_integration/notification_handler.rb b/modules/github_integration/lib/open_project/github_integration/notification_handler.rb
index 6bc5619a0df..8efd1e5a51a 100644
--- a/modules/github_integration/lib/open_project/github_integration/notification_handler.rb
+++ b/modules/github_integration/lib/open_project/github_integration/notification_handler.rb
@@ -26,9 +26,9 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './notification_handler/helper'
-require_relative './notification_handler/issue_comment'
-require_relative './notification_handler/pull_request'
+require_relative 'notification_handler/helper'
+require_relative 'notification_handler/issue_comment'
+require_relative 'notification_handler/pull_request'
module OpenProject::GithubIntegration
##
diff --git a/modules/github_integration/lib/open_project/github_integration/services.rb b/modules/github_integration/lib/open_project/github_integration/services.rb
index 6156062f7a7..edecc0f94e1 100644
--- a/modules/github_integration/lib/open_project/github_integration/services.rb
+++ b/modules/github_integration/lib/open_project/github_integration/services.rb
@@ -26,6 +26,6 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './services/upsert_check_run'
-require_relative './services/upsert_github_user'
-require_relative './services/upsert_pull_request'
+require_relative 'services/upsert_check_run'
+require_relative 'services/upsert_github_user'
+require_relative 'services/upsert_pull_request'
diff --git a/modules/github_integration/spec/features/work_package_activity_spec.rb b/modules/github_integration/spec/features/work_package_activity_spec.rb
index df38f3f0095..108889c1cdd 100644
--- a/modules/github_integration/spec/features/work_package_activity_spec.rb
+++ b/modules/github_integration/spec/features/work_package_activity_spec.rb
@@ -114,7 +114,7 @@ RSpec.describe 'Work Package Activity Tab',
github_user_link: pull_request_merging_user.github_login)}
GITHUB_MERGE_COMMENT
- expect(page).to have_selector('.user-comment > .message', text: expected_merge_comment)
+ expect(page).to have_css('.user-comment > .message', text: expected_merge_comment)
end
end
end
@@ -148,7 +148,7 @@ RSpec.describe 'Work Package Activity Tab',
github_user_link: pull_request_author.github_login)}
GITHUB_REFERENCED_COMMENT
- expect(page).to have_selector('.user-comment > .message', text: expected_referenced_comment)
+ expect(page).to have_css('.user-comment > .message', text: expected_referenced_comment)
end
end
end
@@ -182,7 +182,7 @@ RSpec.describe 'Work Package Activity Tab',
github_user_link: pull_request_author.github_login)}
GITHUB_READY_FOR_REVIEW_COMMENT
- expect(page).to have_selector('.user-comment > .message', text: expected_action_comment)
+ expect(page).to have_css('.user-comment > .message', text: expected_action_comment)
end
end
end
diff --git a/modules/github_integration/spec/features/work_package_github_tab_spec.rb b/modules/github_integration/spec/features/work_package_github_tab_spec.rb
index 1ee143ac188..d035f53baaa 100644
--- a/modules/github_integration/spec/features/work_package_github_tab_spec.rb
+++ b/modules/github_integration/spec/features/work_package_github_tab_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative '../support/pages/work_package_github_tab'
-RSpec.describe 'Open the GitHub tab', js: true do
+RSpec.describe 'Open the GitHub tab', :js do
let(:user) do
create(:user,
member_with_roles: { project => role })
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 b1b79cf99c3..c3734768753 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
@@ -95,7 +95,7 @@ RSpec.describe OpenProject::GithubIntegration::NotificationHandler::IssueComment
expect(received_payload.to_h)
.to eql payload
expect(work_packages)
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
end
end
diff --git a/modules/github_integration/spec/models/github_pull_request_spec.rb b/modules/github_integration/spec/models/github_pull_request_spec.rb
index d65bbf2a29b..f8da27d1565 100644
--- a/modules/github_integration/spec/models/github_pull_request_spec.rb
+++ b/modules/github_integration/spec/models/github_pull_request_spec.rb
@@ -71,7 +71,7 @@ RSpec.describe GithubPullRequest do
before { pull_request }
- it { is_expected.to match_array([pull_request]) }
+ it { is_expected.to contain_exactly(pull_request) }
context 'when the pr is linked to a work_package' do
let(:work_packages) { create_list(:work_package, 1) }
diff --git a/modules/github_integration/spec/support/pages/work_package_github_tab.rb b/modules/github_integration/spec/support/pages/work_package_github_tab.rb
index 1d5b83efad5..d4657329b7b 100644
--- a/modules/github_integration/spec/support/pages/work_package_github_tab.rb
+++ b/modules/github_integration/spec/support/pages/work_package_github_tab.rb
@@ -56,7 +56,7 @@ module Pages
end
def expect_tab_not_present
- expect(page).not_to have_selector('.op-tab-row--link', text: 'GITHUB')
+ expect(page).to have_no_css('.op-tab-row--link', text: 'GITHUB')
end
private
diff --git a/modules/github_integration/spec/workers/cron/clear_old_pull_requests_job_spec.rb b/modules/github_integration/spec/workers/cron/clear_old_pull_requests_job_spec.rb
index 2f644508e1a..beb5cc6fbbd 100644
--- a/modules/github_integration/spec/workers/cron/clear_old_pull_requests_job_spec.rb
+++ b/modules/github_integration/spec/workers/cron/clear_old_pull_requests_job_spec.rb
@@ -48,6 +48,6 @@ RSpec.describe Cron::ClearOldPullRequestsJob, type: :job do
expect { job.perform }.to change(GithubPullRequest, :count).by(-1).and(change(GithubCheckRun, :count).by(-1))
expect(GithubPullRequest.all)
- .to match_array([pull_request_with_work_package])
+ .to contain_exactly(pull_request_with_work_package)
end
end
diff --git a/modules/grids/spec/contracts/grids/create_contract_spec.rb b/modules/grids/spec/contracts/grids/create_contract_spec.rb
index a5885a2517d..c5a04e7623b 100644
--- a/modules/grids/spec/contracts/grids/create_contract_spec.rb
+++ b/modules/grids/spec/contracts/grids/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe Grids::CreateContract do
include_context 'grid contract'
@@ -95,7 +95,7 @@ RSpec.describe Grids::CreateContract do
.and_return(false)
expect(instance.assignable_values(:widgets, user))
- .to match_array [:widget1]
+ .to contain_exactly(:widget1)
end
end
diff --git a/modules/grids/spec/contracts/grids/shared_examples.rb b/modules/grids/spec/contracts/grids/shared_examples.rb
index 94a6189d7a8..9c05ad4841f 100644
--- a/modules/grids/spec/contracts/grids/shared_examples.rb
+++ b/modules/grids/spec/contracts/grids/shared_examples.rb
@@ -49,7 +49,7 @@ RSpec.shared_context 'grid contract' do
instance.validate
expect(instance.errors.details[attribute])
- .to match_array [{ error: :greater_than, count: 0 }]
+ .to contain_exactly({ error: :greater_than, count: 0 })
end
end
@@ -60,7 +60,7 @@ RSpec.shared_context 'grid contract' do
instance.validate
expect(instance.errors.details[attribute])
- .to match_array [{ error: :blank }]
+ .to contain_exactly({ error: :blank })
end
end
end
@@ -86,7 +86,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:row_count])
- .to match_array [{ error: :greater_than, count: 0 }]
+ .to contain_exactly({ error: :greater_than, count: 0 })
end
end
end
@@ -107,7 +107,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:column_count])
- .to match_array [{ error: :greater_than, count: 0 }]
+ .to contain_exactly({ error: :greater_than, count: 0 })
end
end
end
@@ -124,7 +124,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'is invalid for the grid superclass itself' do
expect(instance.errors.details[:scope])
- .to match_array [{ error: :inclusion }]
+ .to contain_exactly({ error: :inclusion })
end
end
end
@@ -160,7 +160,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :inclusion }]
+ .to contain_exactly({ error: :inclusion })
end
end
diff --git a/modules/grids/spec/contracts/grids/update_contract_spec.rb b/modules/grids/spec/contracts/grids/update_contract_spec.rb
index c3d9e784499..6bb5114b3d9 100644
--- a/modules/grids/spec/contracts/grids/update_contract_spec.rb
+++ b/modules/grids/spec/contracts/grids/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe Grids::UpdateContract do
include_context 'model contract'
@@ -49,7 +49,7 @@ RSpec.describe Grids::UpdateContract do
instance.validate
# scope because that is what type is called on the outside for grids
expect(instance.errors.details[:scope])
- .to match_array [{ error: :error_readonly }, { error: :inclusion }]
+ .to contain_exactly({ error: :error_readonly }, { error: :inclusion })
end
end
diff --git a/modules/grids/spec/models/grids/grid_spec.rb b/modules/grids/spec/models/grids/grid_spec.rb
index de6a117124b..a1edc503f0a 100644
--- a/modules/grids/spec/models/grids/grid_spec.rb
+++ b/modules/grids/spec/models/grids/grid_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_model'
+require_relative 'shared_model'
RSpec.describe Grids::Grid do
let(:instance) { Grids::Grid.new column_count: 5, row_count: 5 }
diff --git a/modules/grids/spec/support/pages/grid.rb b/modules/grids/spec/support/pages/grid.rb
index bbb98dc4ca2..b0772d00601 100644
--- a/modules/grids/spec/support/pages/grid.rb
+++ b/modules/grids/spec/support/pages/grid.rb
@@ -43,7 +43,7 @@ module Pages
def expect_no_help_mode
expect(page)
- .not_to have_selector('.toolbar-item .icon-add')
+ .to have_no_css('.toolbar-item .icon-add')
end
def expect_unable_to_add_widget(row_number, column_number, location, name = nil)
@@ -60,7 +60,7 @@ module Pages
.to have_content(I18n.t('js.grid.add_widget'))
expect(page)
- .to have_selector('.op-toast.-ee-upsale', text: I18n.t('js.upsale.ee_only'))
+ .to have_css('.op-toast.-ee-upsale', text: I18n.t('js.upsale.ee_only'))
end
end
@@ -99,7 +99,7 @@ module Pages
area.hover
expect(area)
- .not_to have_selector('.grid--widget-add')
+ .to have_no_css('.grid--widget-add')
end
def expect_specific_widget_unaddable(row_number, column_number, location, name)
@@ -108,7 +108,7 @@ module Pages
.to have_content(I18n.t('js.grid.add_widget'))
expect(page)
- .not_to have_selector('[data-test-selector="op-grid--addable-widget"]', text: Regexp.new("^#{name}$"))
+ .to have_no_css('[data-test-selector="op-grid--addable-widget"]', text: Regexp.new("^#{name}$"))
end
end
end
diff --git a/modules/job_status/spec/features/job_status_spec.rb b/modules/job_status/spec/features/job_status_spec.rb
index e2bc1bc4e54..4e6002ae374 100644
--- a/modules/job_status/spec/features/job_status_spec.rb
+++ b/modules/job_status/spec/features/job_status_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Job status', js: true do
+RSpec.describe 'Job status', :js do
shared_let(:admin) { create(:admin) }
before do
@@ -38,7 +38,7 @@ RSpec.describe 'Job status', js: true do
it 'renders a descriptive error in case of 404' do
visit '/job_statuses/something-that-does-not-exist'
- expect(page).to have_selector('.icon-big.icon-help', wait: 10)
+ expect(page).to have_css('.icon-big.icon-help', wait: 10)
expect(page).to have_content I18n.t('js.job_status.generic_messages.not_found')
end
@@ -49,12 +49,12 @@ RSpec.describe 'Job status', js: true do
status.update! payload: { errors: ['Some error', 'Another error'] }
end
- it 'will show a list of these errors' do
+ it 'shows a list of these errors' do
visit "/job_statuses/#{status.job_id}"
- expect(page).to have_selector('.job-status--modal-additional-errors', text: 'Some errors have occurred', wait: 10)
- expect(page).to have_selector('ul li', text: 'Some error')
- expect(page).to have_selector('ul li', text: 'Another error')
+ expect(page).to have_css('.job-status--modal-additional-errors', text: 'Some errors have occurred', wait: 10)
+ expect(page).to have_css('ul li', text: 'Some error')
+ expect(page).to have_css('ul li', text: 'Another error')
end
end
@@ -65,12 +65,12 @@ RSpec.describe 'Job status', js: true do
status.update! payload: { redirect: home_url, errors: ['Some error'] }
end
- it 'will not automatically redirect' do
+ it 'does not automatically redirect' do
visit "/job_statuses/#{status.job_id}"
- expect(page).to have_selector('.job-status--modal-additional-errors', text: 'Some errors have occurred', wait: 10)
- expect(page).to have_selector('ul li', text: 'Some error')
- expect(page).to have_selector("a[href='#{home_url}']", text: 'Please click here to continue')
+ expect(page).to have_css('.job-status--modal-additional-errors', text: 'Some errors have occurred', wait: 10)
+ expect(page).to have_css('ul li', text: 'Some error')
+ expect(page).to have_css("a[href='#{home_url}']", text: 'Please click here to continue')
end
end
end
diff --git a/modules/ldap_groups/spec/features/administration_spec.rb b/modules/ldap_groups/spec/features/administration_spec.rb
index 0ed808dff07..37b94cfafc2 100644
--- a/modules/ldap_groups/spec/features/administration_spec.rb
+++ b/modules/ldap_groups/spec/features/administration_spec.rb
@@ -1,6 +1,6 @@
require_relative '../spec_helper'
-RSpec.describe 'LDAP group sync administration spec', js: true do
+RSpec.describe 'LDAP group sync administration spec', :js do
let(:admin) { create(:admin) }
before do
@@ -10,7 +10,7 @@ RSpec.describe 'LDAP group sync administration spec', js: true do
context 'without EE' do
it 'shows upsale' do
- expect(page).to have_selector('.upsale-notification')
+ expect(page).to have_css('.upsale-notification')
end
end
@@ -19,7 +19,7 @@ RSpec.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).not_to have_selector('.upsale-notification')
+ expect(page).to have_no_css('.upsale-notification')
# Create group
find('.button', text: I18n.t('ldap_groups.synchronized_groups.singular')).click
@@ -31,16 +31,16 @@ RSpec.describe 'LDAP group sync administration spec', js: true do
check 'synchronized_group_sync_users'
click_on 'Create'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_create))
- expect(page).to have_selector('td.dn', text: 'cn=foo,ou=groups,dc=example,dc=com')
- expect(page).to have_selector('td.ldap_auth_source', text: 'ldap')
- expect(page).to have_selector('td.group', text: 'foo')
- expect(page).to have_selector('td.users', text: '0')
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_create))
+ expect(page).to have_css('td.dn', text: 'cn=foo,ou=groups,dc=example,dc=com')
+ expect(page).to have_css('td.ldap_auth_source', text: 'ldap')
+ expect(page).to have_css('td.group', text: 'foo')
+ expect(page).to have_css('td.users', text: '0')
# Show entry
SeleniumHubWaiter.wait
find('td.dn a').click
- expect(page).to have_selector '.generic-table--empty-row'
+ expect(page).to have_css '.generic-table--empty-row'
# Check created group
sync = LdapGroups::SynchronizedGroup.last
@@ -51,7 +51,7 @@ RSpec.describe 'LDAP group sync administration spec', js: true do
# Assume we have a membership
sync.users.create user_id: admin.id
visit ldap_groups_synchronized_group_path(sync)
- expect(page).to have_selector 'td.user', text: admin.name
+ expect(page).to have_css 'td.user', text: admin.name
memberships = sync.users.pluck(:id)
@@ -65,8 +65,8 @@ RSpec.describe 'LDAP group sync administration spec', js: true do
SeleniumHubWaiter.wait
click_on 'Delete'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_delete))
- expect(page).to have_selector '.generic-table--empty-row'
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_delete))
+ expect(page).to have_css '.generic-table--empty-row'
expect(LdapGroups::Membership.where(id: memberships)).to be_empty
end
diff --git a/modules/ldap_groups/spec/features/filter_administration_spec.rb b/modules/ldap_groups/spec/features/filter_administration_spec.rb
index 1f5beada2e6..c8a73e803e2 100644
--- a/modules/ldap_groups/spec/features/filter_administration_spec.rb
+++ b/modules/ldap_groups/spec/features/filter_administration_spec.rb
@@ -1,6 +1,6 @@
require_relative '../spec_helper'
-RSpec.describe 'LDAP group filter administration spec', js: true do
+RSpec.describe 'LDAP group filter administration spec', :js do
let(:admin) { create(:admin) }
before do
@@ -40,8 +40,8 @@ RSpec.describe 'LDAP group filter administration spec', js: true do
page.find('td.name a', text: 'bar').click
expect(page).to have_text I18n.t(:label_seeded_from_env_warning)
- expect(page).not_to have_link 'Edit'
- expect(page).not_to have_link 'Delete'
+ expect(page).to have_no_link 'Edit'
+ expect(page).to have_no_link 'Delete'
end
end
end
diff --git a/modules/ldap_groups/spec/services/synchronization_spec.rb b/modules/ldap_groups/spec/services/synchronization_spec.rb
index 464e33c8cad..2b4bfb5da2d 100644
--- a/modules/ldap_groups/spec/services/synchronization_spec.rb
+++ b/modules/ldap_groups/spec/services/synchronization_spec.rb
@@ -155,7 +155,7 @@ RSpec.describe LdapGroups::SynchronizeGroupsService, with_ee: %i[ldap_groups] do
expect { synced_foo.reload }.to raise_error ActiveRecord::RecordNotFound
expect(group_bar.users)
- .to match_array([user_aa729.reload, user_bb459.reload, user_cc414.reload])
+ .to contain_exactly(user_aa729.reload, user_bb459.reload, user_cc414.reload)
expect(LdapGroups::Membership.where(group_id: synced_foo_id)).to be_empty
end
diff --git a/modules/ldap_groups/spec/services/synchronize_filter_spec.rb b/modules/ldap_groups/spec/services/synchronize_filter_spec.rb
index 08022540f09..77cc5457eed 100644
--- a/modules/ldap_groups/spec/services/synchronize_filter_spec.rb
+++ b/modules/ldap_groups/spec/services/synchronize_filter_spec.rb
@@ -56,8 +56,8 @@ RSpec.describe LdapGroups::SynchronizeFilterService, with_ee: %i[ldap_groups] do
# Expect two synchronized groups added
expect(filter_foo_bar.groups.count).to eq 2
- expect(filter_foo_bar.groups.map(&:dn)).to match_array ['cn=foo,ou=groups,dc=example,dc=com',
- 'cn=bar,ou=groups,dc=example,dc=com']
+ expect(filter_foo_bar.groups.map(&:dn)).to contain_exactly('cn=foo,ou=groups,dc=example,dc=com',
+ 'cn=bar,ou=groups,dc=example,dc=com')
# Expect two actual groups added
op_foo_group = Group.find_by(lastname: 'foo')
diff --git a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
index 039642b0121..88a711c49b0 100644
--- a/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
+++ b/modules/meeting/app/components/meeting_agenda_items/item_component/show_component.rb
@@ -89,7 +89,8 @@ module MeetingAgendaItems
def add_note_action_item(menu)
menu.with_item(label: t("label_agenda_item_add_notes"),
- href: edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item, display_notes_input: true),
+ href: edit_meeting_agenda_item_path(@meeting_agenda_item.meeting, @meeting_agenda_item,
+ display_notes_input: true),
content_arguments: {
data: { 'turbo-stream': true }
}) do |item|
diff --git a/modules/meeting/app/components/meetings/sidebar/details_component.rb b/modules/meeting/app/components/meetings/sidebar/details_component.rb
index ad0df4a3c10..d4d930ccc79 100644
--- a/modules/meeting/app/components/meetings/sidebar/details_component.rb
+++ b/modules/meeting/app/components/meetings/sidebar/details_component.rb
@@ -47,6 +47,7 @@ module Meetings
end
end
end
+
def render_meeting_attribute_row(icon, &)
flex_layout(align_items: :center, justify_content: :space_between) do |flex|
flex.with_column do
diff --git a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb
index 719c53c44b2..40b19297e2b 100644
--- a/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb
+++ b/modules/meeting/app/forms/meeting_agenda_item/meeting_form.rb
@@ -38,7 +38,7 @@ class MeetingAgendaItem::MeetingForm < ApplicationForm
caption: I18n.t("label_meeting_selection_caption"),
autocomplete_options: {
multiple: false,
- decorated: true,
+ decorated: true
}
) do |select|
MeetingAgendaItems::CreateContract
diff --git a/modules/meeting/app/helpers/meeting_contents_helper.rb b/modules/meeting/app/helpers/meeting_contents_helper.rb
index f62eb60699f..e3ab854a459 100644
--- a/modules/meeting/app/helpers/meeting_contents_helper.rb
+++ b/modules/meeting/app/helpers/meeting_contents_helper.rb
@@ -97,7 +97,7 @@ module MeetingContentsHelper
end
end
- def meeting_content_edit_link(content_type)
+ def meeting_content_edit_link(_content_type)
content_tag :li, '', class: 'toolbar-item' do
link_to '',
class: 'button button--edit-agenda',
diff --git a/modules/meeting/app/helpers/meetings_helper.rb b/modules/meeting/app/helpers/meetings_helper.rb
index f69267c7459..a7f7fc1f73f 100644
--- a/modules/meeting/app/helpers/meetings_helper.rb
+++ b/modules/meeting/app/helpers/meetings_helper.rb
@@ -142,7 +142,7 @@ module MeetingsHelper
return '' if journal.initial?
journal_content = render_journal_details(journal, :label_updated_time_by, model, options)
- content_tag 'div', journal_content, id: "change-#{journal.id}", class: 'journal'
+ content_tag 'div', journal_content, id: "change-#{journal.id}", class: 'journal'
end
# This renders a journal entry with a header and details
diff --git a/modules/meeting/app/mailers/meeting_mailer.rb b/modules/meeting/app/mailers/meeting_mailer.rb
index 74b0435252c..7def8247802 100644
--- a/modules/meeting/app/mailers/meeting_mailer.rb
+++ b/modules/meeting/app/mailers/meeting_mailer.rb
@@ -74,7 +74,6 @@ class MeetingMailer < UserMailer
def with_attached_ics(meeting, user)
User.execute_as(user) do
-
call = ::Meetings::ICalService
.new(user:, meeting: @meeting)
.call
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rb
index 0a96881f119..add973eda07 100644
--- a/modules/meeting/app/models/meeting.rb
+++ b/modules/meeting/app/models/meeting.rb
@@ -109,7 +109,7 @@ class Meeting < ApplicationRecord
end
def start_time=(value)
- super value&.to_datetime
+ super(value&.to_datetime)
end
def start_month
@@ -154,7 +154,7 @@ class Meeting < ApplicationRecord
def all_changeable_participants
changeable_participants = participants.select(&:invited).collect(&:user)
changeable_participants = changeable_participants + participants.select(&:attended).collect(&:user)
- changeable_participants = changeable_participants + \
+ changeable_participants = changeable_participants +
User.allowed_members(:view_meetings, project)
changeable_participants
diff --git a/modules/meeting/app/models/meeting_agenda_item.rb b/modules/meeting/app/models/meeting_agenda_item.rb
index f60f50286f4..c0811dfc67b 100644
--- a/modules/meeting/app/models/meeting_agenda_item.rb
+++ b/modules/meeting/app/models/meeting_agenda_item.rb
@@ -35,7 +35,7 @@ class MeetingAgendaItem < ApplicationRecord
enum item_type: ITEM_TYPES
- belongs_to :meeting, foreign_key: 'meeting_id', class_name: 'StructuredMeeting'
+ belongs_to :meeting, class_name: 'StructuredMeeting'
belongs_to :work_package, class_name: '::WorkPackage'
has_one :project, through: :meeting
belongs_to :author, class_name: 'User', optional: false
diff --git a/modules/meeting/db/migrate/20180323135408_to_v710_aggregated_meeting_migrations.rb b/modules/meeting/db/migrate/20180323135408_to_v710_aggregated_meeting_migrations.rb
index d808b4d44f2..9aa249ad92c 100644
--- a/modules/meeting/db/migrate/20180323135408_to_v710_aggregated_meeting_migrations.rb
+++ b/modules/meeting/db/migrate/20180323135408_to_v710_aggregated_meeting_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join("db", "migrate", "migration_utils", "migration_squasher").to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
# This migration aggregates the migrations detailed in MIGRATION_FILES
class ToV710AggregatedMeetingMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
diff --git a/modules/meeting/spec/controllers/meetings_controller_spec.rb b/modules/meeting/spec/controllers/meetings_controller_spec.rb
index 7a59f6944c8..4771ef8cb50 100644
--- a/modules/meeting/spec/controllers/meetings_controller_spec.rb
+++ b/modules/meeting/spec/controllers/meetings_controller_spec.rb
@@ -177,8 +177,8 @@ RSpec.describe MeetingsController do
expect(response).to have_http_status :ok
expect(response).to render_template :new
expect(response.body)
- .to have_selector '#errorExplanation li',
- text: "Date #{I18n.t('activerecord.errors.messages.not_an_iso_date')}"
+ .to have_css '#errorExplanation li',
+ text: "Date #{I18n.t('activerecord.errors.messages.not_an_iso_date')}"
end
end
@@ -191,8 +191,8 @@ RSpec.describe MeetingsController do
expect(response).to have_http_status :ok
expect(response).to render_template :new
expect(response.body)
- .to have_selector '#errorExplanation li',
- text: "Starting time #{I18n.t('activerecord.errors.messages.invalid_time_format')}"
+ .to have_css '#errorExplanation li',
+ text: "Starting time #{I18n.t('activerecord.errors.messages.invalid_time_format')}"
end
end
end
@@ -204,8 +204,8 @@ RSpec.describe MeetingsController do
expect(response).to have_http_status :ok
expect(response).to render_template :new
expect(response.body)
- .to have_selector '#errorExplanation li',
- text: "Project #{I18n.t('activerecord.errors.messages.blank')}"
+ .to have_css '#errorExplanation li',
+ text: "Project #{I18n.t('activerecord.errors.messages.blank')}"
end
end
@@ -217,8 +217,8 @@ RSpec.describe MeetingsController do
expect(response).to have_http_status :ok
expect(response).to render_template :new
expect(response.body)
- .to have_selector '#errorExplanation li',
- text: "Project #{I18n.t('activerecord.errors.messages.blank')}"
+ .to have_css '#errorExplanation li',
+ text: "Project #{I18n.t('activerecord.errors.messages.blank')}"
end
end
end
diff --git a/modules/meeting/spec/features/meetings_activity_spec.rb b/modules/meeting/spec/features/meetings_activity_spec.rb
index 4edbaeb6520..7c623f90905 100644
--- a/modules/meeting/spec/features/meetings_activity_spec.rb
+++ b/modules/meeting/spec/features/meetings_activity_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Meetings', js: true do
+RSpec.describe 'Meetings', :js do
let(:project) { create(:project, enabled_module_names: %w[meetings activity]) }
let(:user) { create(:admin) }
@@ -47,9 +47,9 @@ RSpec.describe 'Meetings', js: true do
check 'Meetings'
click_on 'Apply'
- expect(page).to have_selector('.op-activity-list--item-title', text: 'Minutes: Awesome meeting!')
- expect(page).to have_selector('.op-activity-list--item-title', text: 'Agenda: Awesome meeting!')
- expect(page).to have_selector('.op-activity-list--item-title', text: 'Meeting: Awesome meeting!')
+ expect(page).to have_css('.op-activity-list--item-title', text: 'Minutes: Awesome meeting!')
+ expect(page).to have_css('.op-activity-list--item-title', text: 'Agenda: Awesome meeting!')
+ expect(page).to have_css('.op-activity-list--item-title', text: 'Meeting: Awesome meeting!')
end
end
end
diff --git a/modules/meeting/spec/features/meetings_attachments_spec.rb b/modules/meeting/spec/features/meetings_attachments_spec.rb
index eb9e9b0c536..e1ed93526f3 100644
--- a/modules/meeting/spec/features/meetings_attachments_spec.rb
+++ b/modules/meeting/spec/features/meetings_attachments_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'Add an attachment to a meeting (agenda)', js: true, with_cuprite: false do
+RSpec.describe 'Add an attachment to a meeting (agenda)', :js, with_cuprite: false do
let(:role) do
create(:project_role, permissions: %i[view_meetings edit_meetings create_meeting_agendas])
end
@@ -49,7 +49,7 @@ RSpec.describe 'Add an attachment to a meeting (agenda)', js: true, with_cuprite
content = find_test_selector('op-meeting--meeting_agenda')
- expect(content).to have_selector('img')
+ expect(content).to have_css('img')
expect(content).to have_content('Some image caption')
end
end
diff --git a/modules/meeting/spec/features/meetings_close_spec.rb b/modules/meeting/spec/features/meetings_close_spec.rb
index 438fca6eabb..b0fb0a47d1d 100644
--- a/modules/meeting/spec/features/meetings_close_spec.rb
+++ b/modules/meeting/spec/features/meetings_close_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe 'Meetings close' do
login_as(user)
end
- context 'with permission to close meetings', js: true do
+ context 'with permission to close meetings', :js do
let(:permissions) { %i[view_meetings close_meeting_agendas] }
it 'can delete own and other`s meetings' do
@@ -57,7 +57,7 @@ RSpec.describe 'Meetings close' do
# Go to minutes, expect uneditable
find('.op-tab-row--link', text: 'MINUTES').click
- expect(page).to have_selector('.button', text: 'Close the agenda to begin the Minutes')
+ expect(page).to have_css('.button', text: 'Close the agenda to begin the Minutes')
# Close the meeting
find('.op-tab-row--link', text: 'AGENDA').click
@@ -66,17 +66,17 @@ RSpec.describe 'Meetings close' do
end
# Expect to be on minutes
- expect(page).to have_selector('.op-tab-row--link_selected', text: 'MINUTES')
+ expect(page).to have_css('.op-tab-row--link_selected', text: 'MINUTES')
# Copies the text
- expect(page).to have_selector('#tab-content-minutes', text: 'asdf')
+ expect(page).to have_css('#tab-content-minutes', text: 'asdf')
# Go back to agenda, expect we can open it again
find('.op-tab-row--link', text: 'AGENDA').click
accept_confirm do
find('.button', text: 'Open').click
end
- expect(page).to have_selector('.button', text: 'Close')
+ expect(page).to have_css('.button', text: 'Close')
end
end
@@ -87,7 +87,7 @@ RSpec.describe 'Meetings close' do
visit meetings_path(project)
expect(page)
- .not_to have_link 'Close'
+ .to have_no_link 'Close'
end
end
end
diff --git a/modules/meeting/spec/features/meetings_copy_spec.rb b/modules/meeting/spec/features/meetings_copy_spec.rb
index 8c4c4a098eb..48de9243edf 100644
--- a/modules/meeting/spec/features/meetings_copy_spec.rb
+++ b/modules/meeting/spec/features/meetings_copy_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe 'Meetings copy', :js, :with_cuprite do
login_as user
end
- it 'copying a meeting' do
+ it 'copying a meeting' do
visit project_meetings_path(project)
click_link meeting.title
@@ -99,7 +99,7 @@ RSpec.describe 'Meetings copy', :js, :with_cuprite do
click_button "Create"
# Be on the new meeting's page with copied over attributes
- expect(page).not_to have_current_path meeting_path(meeting.id)
+ expect(page).to have_no_current_path meeting_path(meeting.id)
expect(page)
.to have_content("Added by #{user.name}")
@@ -116,7 +116,7 @@ RSpec.describe 'Meetings copy', :js, :with_cuprite do
# Does not copy the attendees
expect(page)
- .not_to have_content "Attendees: #{other_user.name}"
+ .to have_no_content "Attendees: #{other_user.name}"
expect(page)
.to have_content "Attendees:"
diff --git a/modules/meeting/spec/features/meetings_delete_spec.rb b/modules/meeting/spec/features/meetings_delete_spec.rb
index 62ea1b68837..bfc9ec1d067 100644
--- a/modules/meeting/spec/features/meetings_delete_spec.rb
+++ b/modules/meeting/spec/features/meetings_delete_spec.rb
@@ -48,7 +48,7 @@ RSpec.describe 'Meetings deletion' do
login_as(user)
end
- context 'with permission to delete meetings', js: true do
+ context 'with permission to delete meetings', :js do
let(:permissions) { %i[view_meetings delete_meetings] }
it "can delete own and other's meetings" do
@@ -85,13 +85,13 @@ RSpec.describe 'Meetings deletion' do
click_link meeting.title
expect(page)
- .not_to have_link 'Delete'
+ .to have_no_link 'Delete'
visit index_path
click_link other_meeting.title
expect(page)
- .not_to have_link 'Delete'
+ .to have_no_link 'Delete'
end
end
end
diff --git a/modules/meeting/spec/features/meetings_global_menu_item_spec.rb b/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
index 27acea56141..047878b2482 100644
--- a/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
+++ b/modules/meeting/spec/features/meetings_global_menu_item_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe 'Meetings global menu item',
specify '"Upcoming meetings" is the default filter set' do
within '#main-menu' do
- expect(page).to have_selector('.selected', text: I18n.t(:label_upcoming_meetings))
+ expect(page).to have_css('.selected', text: I18n.t(:label_upcoming_meetings))
end
end
end
@@ -71,7 +71,7 @@ RSpec.describe 'Meetings global menu item',
it 'does not render' do
within '#main-menu' do
- expect(page).not_to have_link(meetings_label)
+ expect(page).to have_no_link(meetings_label)
end
end
end
diff --git a/modules/meeting/spec/features/meetings_locking_spec.rb b/modules/meeting/spec/features/meetings_locking_spec.rb
index 0fd7aab4008..cf4dbac72dc 100644
--- a/modules/meeting/spec/features/meetings_locking_spec.rb
+++ b/modules/meeting/spec/features/meetings_locking_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Meetings locking', js: true do
+RSpec.describe 'Meetings locking', :js do
let(:project) { create(:project, enabled_module_names: %w[meetings]) }
let(:user) { create(:admin) }
let!(:meeting) { create(:meeting) }
diff --git a/modules/meeting/spec/features/meetings_search_spec.rb b/modules/meeting/spec/features/meetings_search_spec.rb
index 489db2ee2ac..dfd6e4165c1 100644
--- a/modules/meeting/spec/features/meetings_search_spec.rb
+++ b/modules/meeting/spec/features/meetings_search_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Meeting search', js: true do
+RSpec.describe 'Meeting search', :js do
include Components::Autocompleter::NgSelectAutocompleteHelpers
let(:project) { create(:project) }
let(:role) { create(:project_role, permissions: %i(view_meetings view_work_packages)) }
diff --git a/modules/meeting/spec/features/meetings_show_spec.rb b/modules/meeting/spec/features/meetings_show_spec.rb
index 28da09a860e..7715a4c020f 100644
--- a/modules/meeting/spec/features/meetings_show_spec.rb
+++ b/modules/meeting/spec/features/meetings_show_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require_relative '../support/pages/meetings/show'
-
-RSpec.describe 'Meetings', js: true do
+RSpec.describe 'Meetings', :js do
let(:project) { create(:project, enabled_module_names: %w[meetings]) }
let(:role) { create(:project_role, permissions:) }
let(:user) do
@@ -50,10 +49,10 @@ RSpec.describe 'Meetings', js: true do
visit meetings_path(project)
find('td.title a', text: 'Awesome meeting!', wait: 10).click
- expect(page).to have_selector('h2', text: 'Meeting: Awesome meeting!')
+ expect(page).to have_css('h2', text: 'Meeting: Awesome meeting!')
expect(page).to have_test_selector('op-meeting--meeting_agenda',
- text: 'There is currently nothing to display')
+ text: 'There is currently nothing to display')
end
context 'with a location' do
@@ -85,12 +84,12 @@ RSpec.describe 'Meetings', js: true do
it 'shows the agenda' do
visit meeting_path(meeting)
expect(page).to have_test_selector('op-meeting--meeting_agenda',
- text: 'foo')
+ text: 'foo')
# May not edit
- expect(page).not_to have_selector('.button--edit-agenda')
+ expect(page).to have_no_css('.button--edit-agenda')
expect(page).not_to have_test_selector('op-meeting--meeting_agenda',
- text: 'Edit')
+ text: 'Edit')
end
it 'can view history' do
@@ -139,7 +138,7 @@ RSpec.describe 'Meetings', js: true do
click_link 'Minutes'
expect(page).not_to have_test_selector('op-meeting--meeting_minutes', text: 'Edit')
expect(page).to have_test_selector('op-meeting--meeting_minutes',
- text: 'There is currently nothing to display')
+ text: 'There is currently nothing to display')
end
end
end
@@ -149,9 +148,9 @@ RSpec.describe 'Meetings', js: true do
it 'shows the minutes when visiting' do
visit meeting_path(meeting)
- expect(page).not_to have_selector('h2', text: 'Agenda')
- expect(page).not_to have_selector('#meeting_minutes_text')
- expect(page).to have_selector('h2', text: 'Minutes')
+ expect(page).to have_no_css('h2', text: 'Agenda')
+ expect(page).to have_no_css('#meeting_minutes_text')
+ expect(page).to have_css('h2', text: 'Minutes')
end
context 'and edit permissions' do
@@ -170,8 +169,8 @@ RSpec.describe 'Meetings', js: true do
click_button 'Save'
expect(page)
- .to have_selector('.op-uc-container',
- text: 'This is what we talked about')
+ .to have_css('.op-uc-container',
+ text: 'This is what we talked about')
end
end
end
diff --git a/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb b/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb
index 00e85a41406..f951b91ba4c 100644
--- a/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/mobile_structure_meeting_spec.rb
@@ -95,7 +95,7 @@ RSpec.describe 'Structured meetings CRUD',
show_page.expect_participant(user, invited: true, attended: false, editable: false)
show_page.expect_participant(other_user, invited: true, attended: false, editable: false)
show_page.expect_available_participants(count: 2)
- expect(page).not_to have_button('Save')
+ expect(page).to have_no_button('Save')
end
show_page.close_dialog
@@ -110,7 +110,7 @@ RSpec.describe 'Structured meetings CRUD',
show_page.expect_participant(user, invited: true, attended: false, editable: false)
show_page.expect_participant(other_user, invited: true, attended: false, editable: false)
show_page.expect_available_participants(count: 2)
- expect(page).not_to have_button('Save')
+ expect(page).to have_no_button('Save')
end
end
end
diff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
index 77a0d6e59a9..000556b07c4 100644
--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
@@ -193,7 +193,7 @@ RSpec.describe 'Structured meetings CRUD',
login_as other_user
show_page.visit!
- expect(page).not_to have_css('#meeting-agenda-items-new-button-component')
+ expect(page).to have_no_css('#meeting-agenda-items-new-button-component')
expect(page).not_to have_test_selector('op-meeting-agenda-actions')
end
@@ -293,7 +293,7 @@ RSpec.describe 'Structured meetings CRUD',
show_page.visit!
show_page.expect_undisclosed_agenda_link agenda_item
- expect(page).not_to have_text 'Private task'
+ expect(page).to have_no_text 'Private task'
end
end
end
diff --git a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb
index 106a8b8fdb7..babcc0349d7 100644
--- a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb
@@ -122,8 +122,8 @@ RSpec.describe 'Open the Meetings tab', :js do
expect(page).to have_content(visible_meeting.title)
expect(page).to have_content(meeting_agenda_item_of_visible_meeting.notes)
- expect(page).not_to have_content(invisible_meeting.title)
- expect(page).not_to have_content(meeting_agenda_item_of_invisible_meeting.notes)
+ expect(page).to have_no_content(invisible_meeting.title)
+ expect(page).to have_no_content(meeting_agenda_item_of_invisible_meeting.notes)
end
end
end
@@ -354,7 +354,7 @@ RSpec.describe 'Open the Meetings tab', :js do
meetings_tab.open_add_to_meeting_dialog
fill_in('meeting_agenda_item_meeting_id', with: past_meeting.title)
- expect(page).not_to have_css('.ng-option-marked', text: past_meeting.title)
+ expect(page).to have_no_css('.ng-option-marked', text: past_meeting.title)
end
it 'does not enable the user to select a closed, upcoming meeting' do
@@ -364,7 +364,7 @@ RSpec.describe 'Open the Meetings tab', :js do
meetings_tab.open_add_to_meeting_dialog
fill_in('meeting_agenda_item_meeting_id', with: closed_upcoming_meeting.title)
- expect(page).not_to have_css('.ng-option-marked', text: closed_upcoming_meeting.title)
+ expect(page).to have_no_css('.ng-option-marked', text: closed_upcoming_meeting.title)
end
it 'requires a meeting to be selected' do
diff --git a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb
index e677d5b1180..73e3e7d3c32 100644
--- a/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb
+++ b/modules/meeting/spec/models/meeting_acts_as_journalized_spec.rb
@@ -92,15 +92,15 @@ RSpec.describe Meeting do
describe 'agenda_items' do
let(:work_package) { nil }
+ let(:agenda_item_attributes) { {} }
+ let(:agenda_item) { meeting.agenda_items.first }
+ let(:agenda_item_journals) { meeting.journals.last.agenda_item_journals }
+
before do
meeting.agenda_items << create(:meeting_agenda_item, meeting:, work_package:, **agenda_item_attributes)
meeting.save
end
- let(:agenda_item_attributes) { {} }
- let(:agenda_item) { meeting.agenda_items.first }
- let(:agenda_item_journals) { meeting.journals.last.agenda_item_journals }
-
context 'for a new agenda item within aggregation time' do
it { expect(meeting.journals.count).to eq(1) }
it { expect(agenda_item_journals.count).to eq(1) }
diff --git a/modules/meeting/spec/support/pages/meetings/edit.rb b/modules/meeting/spec/support/pages/meetings/edit.rb
index ec0b0c8e4d3..92552b59b30 100644
--- a/modules/meeting/spec/support/pages/meetings/edit.rb
+++ b/modules/meeting/spec/support/pages/meetings/edit.rb
@@ -26,8 +26,8 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './base'
-require_relative './show'
+require_relative 'base'
+require_relative 'show'
module Pages::Meetings
class Edit < Base
@@ -44,7 +44,7 @@ module Pages::Meetings
def expect_not_available_participant(user)
expect(page)
- .not_to have_field("#{user} invited")
+ .to have_no_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 971b904434d..2df01c40d59 100644
--- a/modules/meeting/spec/support/pages/meetings/index.rb
+++ b/modules/meeting/spec/support/pages/meetings/index.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './new'
+require_relative 'new'
module Pages::Meetings
class Index < Pages::Page
@@ -47,34 +47,34 @@ module Pages::Meetings
end
def expect_no_main_menu
- expect(page).not_to have_selector '#main-menu'
+ expect(page).to have_no_css '#main-menu'
end
def expect_no_create_new_button
within '.toolbar-items' do
- expect(page).not_to have_selector '#add-meeting-button'
+ expect(page).to have_no_css '#add-meeting-button'
end
end
def expect_no_create_new_buttons
within '.toolbar-items' do
- expect(page).not_to have_selector '#add-meeting-button'
+ expect(page).to have_no_css '#add-meeting-button'
end
within '#main-menu' do
- expect(page).not_to have_button 'Meeting'
+ expect(page).to have_no_button 'Meeting'
end
end
def expect_create_new_button
within '.toolbar-items' do
- expect(page).to have_selector '#add-meeting-button'
+ expect(page).to have_css '#add-meeting-button'
end
end
def expect_create_new_buttons
within '.toolbar-items' do
- expect(page).to have_selector '#add-meeting-button'
+ expect(page).to have_css '#add-meeting-button'
end
within '#main-menu' do
@@ -106,8 +106,8 @@ module Pages::Meetings
def expect_meetings_listed(*meetings)
within '.generic-table tbody' do
meetings.each do |meeting|
- expect(page).to have_selector("td.title",
- text: meeting.title)
+ expect(page).to have_css("td.title",
+ text: meeting.title)
end
end
end
@@ -115,8 +115,8 @@ module Pages::Meetings
def expect_meetings_not_listed(*meetings)
within '#content-wrapper' do
meetings.each do |meeting|
- expect(page).not_to have_selector("td.title",
- text: meeting.title)
+ expect(page).to have_no_css("td.title",
+ text: meeting.title)
end
end
end
@@ -132,8 +132,8 @@ module Pages::Meetings
def expect_plaintext_meeting_location(meeting)
within '#content-wrapper' do
within row_for(meeting) do
- expect(page).to have_selector('td.location', text: meeting.location)
- expect(page).not_to have_link meeting.location
+ expect(page).to have_css('td.location', text: meeting.location)
+ expect(page).to have_no_link meeting.location
end
end
end
@@ -141,15 +141,15 @@ module Pages::Meetings
def expect_no_meeting_location(meeting)
within '#content-wrapper' do
within row_for(meeting) do
- expect(page).to have_selector('td.location', text: '')
+ expect(page).to have_css('td.location', text: '')
end
end
end
def expect_to_be_on_page(number)
expect(page)
- .to have_selector('.op-pagination--item_current',
- text: number)
+ .to have_css('.op-pagination--item_current',
+ text: number)
end
def to_page(number)
diff --git a/modules/meeting/spec/support/pages/meetings/new.rb b/modules/meeting/spec/support/pages/meetings/new.rb
index ee027f8f047..712f9667f3f 100644
--- a/modules/meeting/spec/support/pages/meetings/new.rb
+++ b/modules/meeting/spec/support/pages/meetings/new.rb
@@ -26,15 +26,15 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './base'
-require_relative './show'
+require_relative 'base'
+require_relative 'show'
module Pages::Meetings
class New < Base
include Components::Autocompleter::NgSelectAutocompleteHelpers
def expect_no_main_menu
- expect(page).not_to have_selector '#main-menu'
+ expect(page).to have_no_css '#main-menu'
end
def click_create
@@ -74,7 +74,7 @@ module Pages::Meetings
end
def set_start_time(time)
- input = page.find('#meeting-form-start-time')
+ input = page.find_by_id('meeting-form-start-time')
page.execute_script("arguments[0].value = arguments[1]", input.native, time)
end
diff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rb
index 087659afb70..3a321847559 100644
--- a/modules/meeting/spec/support/pages/meetings/show.rb
+++ b/modules/meeting/spec/support/pages/meetings/show.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './base'
+require_relative 'base'
module Pages::Meetings
class Show < Base
@@ -59,7 +59,7 @@ module Pages::Meetings
users.each do |user|
within(meeting_details_container) do
expect(page)
- .not_to have_link(user.name)
+ .to have_no_link(user.name)
end
end
end
@@ -77,7 +77,7 @@ module Pages::Meetings
def expect_plaintext_location(location)
within(meeting_details_container) do
- expect(page).not_to have_link location
+ expect(page).to have_no_link location
expect(page).to have_text(location)
end
end
diff --git a/modules/meeting/spec/support/pages/structured_meeting/show.rb b/modules/meeting/spec/support/pages/structured_meeting/show.rb
index 2481fcc5a6a..14e43b50cf1 100644
--- a/modules/meeting/spec/support/pages/structured_meeting/show.rb
+++ b/modules/meeting/spec/support/pages/structured_meeting/show.rb
@@ -33,7 +33,7 @@ module Pages::StructuredMeeting
include ::Components::Autocompleter::NgSelectAutocompleteHelpers
def expect_empty
- expect(page).not_to have_css('[id^="meeting-agenda-items-item-component"]')
+ expect(page).to have_no_css('[id^="meeting-agenda-items-item-component"]')
end
def add_agenda_item(type: MeetingAgendaItem, &)
@@ -51,14 +51,14 @@ module Pages::StructuredMeeting
def cancel_add_form
page.within('#meeting-agenda-items-new-component') do
click_link I18n.t(:button_cancel)
- expect(page).not_to have_link I18n.t(:button_cancel)
+ expect(page).to have_no_link I18n.t(:button_cancel)
end
end
def cancel_edit_form(item)
page.within("#meeting-agenda-items-item-component-#{item.id}") do
click_link I18n.t(:button_cancel)
- expect(page).not_to have_link I18n.t(:button_cancel)
+ expect(page).to have_no_link I18n.t(:button_cancel)
end
end
@@ -89,7 +89,7 @@ module Pages::StructuredMeeting
if item.is_a?(WorkPackage)
expect(page).to have_css("[id^='meeting-agenda-items-item-component-']", text: item.subject)
else
- expect(page).to have_selector("#meeting-agenda-items-item-component-#{item.id}", text: item.work_package.subject)
+ expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}", text: item.work_package.subject)
end
end
@@ -98,8 +98,8 @@ module Pages::StructuredMeeting
end
def expect_undisclosed_agenda_link(item)
- expect(page).to have_selector("#meeting-agenda-items-item-component-#{item.id}",
- text: I18n.t(:label_agenda_item_undisclosed_wp, id: item.work_package_id))
+ expect(page).to have_css("#meeting-agenda-items-item-component-#{item.id}",
+ text: I18n.t(:label_agenda_item_undisclosed_wp, id: item.work_package_id))
end
def expect_no_agenda_item(title:)
@@ -115,7 +115,7 @@ module Pages::StructuredMeeting
end
page.within('.Overlay') do
- click_on action # rubocop:disable Capybara/ClickLinkOrButtonStyle
+ click_on action
end
end
diff --git a/modules/meeting/spec/support/pages/work_package_meetings_tab.rb b/modules/meeting/spec/support/pages/work_package_meetings_tab.rb
index f133c216820..4010698bc9e 100644
--- a/modules/meeting/spec/support/pages/work_package_meetings_tab.rb
+++ b/modules/meeting/spec/support/pages/work_package_meetings_tab.rb
@@ -51,7 +51,7 @@ module Pages
end
def expect_tab_not_present
- expect(page).not_to have_css('.op-tab-row--link', text: 'MEETINGS')
+ expect(page).to have_no_css('.op-tab-row--link', text: 'MEETINGS')
end
def expect_tab_content_rendered
@@ -100,7 +100,7 @@ module Pages
def fill_and_submit_meeting_dialog(meeting, notes)
fill_in('meeting_agenda_item_meeting_id', with: meeting.title)
- expect(page).to have_selector('.ng-option-marked', text: meeting.title) # wait for selection
+ expect(page).to have_css('.ng-option-marked', text: meeting.title) # wait for selection
page.find('.ng-option-marked').click
page.find('.ck-editor__editable').set(notes)
diff --git a/modules/my_page/lib/my_page/engine.rb b/modules/my_page/lib/my_page/engine.rb
index b56c68ab706..9da20e2359e 100644
--- a/modules/my_page/lib/my_page/engine.rb
+++ b/modules/my_page/lib/my_page/engine.rb
@@ -7,7 +7,7 @@ module MyPage
end
initializer 'my_page.conversion' do
- require Rails.root.join('config', 'constants', 'ar_to_api_conversions')
+ require Rails.root.join("config/constants/ar_to_api_conversions")
Constants::ARToAPIConversions.add('grids/my_page': 'grid')
end
diff --git a/modules/my_page/spec/contracts/grids/create_contract_spec.rb b/modules/my_page/spec/contracts/grids/create_contract_spec.rb
index 094d134526f..0e49aadc67a 100644
--- a/modules/my_page/spec/contracts/grids/create_contract_spec.rb
+++ b/modules/my_page/spec/contracts/grids/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe Grids::CreateContract do
include_context 'grid contract'
diff --git a/modules/my_page/spec/contracts/grids/shared_examples.rb b/modules/my_page/spec/contracts/grids/shared_examples.rb
index 43f56051a49..00634fc9793 100644
--- a/modules/my_page/spec/contracts/grids/shared_examples.rb
+++ b/modules/my_page/spec/contracts/grids/shared_examples.rb
@@ -76,7 +76,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :inclusion }]
+ .to contain_exactly({ error: :inclusion })
end
end
@@ -102,7 +102,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :overlaps }, { error: :overlaps }]
+ .to contain_exactly({ error: :overlaps }, { error: :overlaps })
end
end
@@ -163,7 +163,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :outside }]
+ .to contain_exactly({ error: :outside })
end
end
@@ -184,7 +184,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :outside }]
+ .to contain_exactly({ error: :outside })
end
end
@@ -220,7 +220,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :end_before_start }]
+ .to contain_exactly({ error: :end_before_start })
end
end
@@ -241,7 +241,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :end_before_start }]
+ .to contain_exactly({ error: :end_before_start })
end
end
@@ -262,7 +262,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :end_before_start }]
+ .to contain_exactly({ error: :end_before_start })
end
end
@@ -283,7 +283,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'notes the error' do
instance.validate
expect(instance.errors.details[:widgets])
- .to match_array [{ error: :end_before_start }]
+ .to contain_exactly({ error: :end_before_start })
end
end
end
@@ -311,7 +311,7 @@ RSpec.shared_examples_for 'shared grid contract attributes' do
it 'is invalid for the grid superclass itself' do
expect(instance.errors.details[:scope])
- .to match_array [{ error: :inclusion }]
+ .to contain_exactly({ error: :inclusion })
end
end
end
diff --git a/modules/my_page/spec/contracts/grids/update_contract_spec.rb b/modules/my_page/spec/contracts/grids/update_contract_spec.rb
index d1ada5c0a78..028653ec539 100644
--- a/modules/my_page/spec/contracts/grids/update_contract_spec.rb
+++ b/modules/my_page/spec/contracts/grids/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe Grids::UpdateContract do
include_context 'model contract'
diff --git a/modules/my_page/spec/features/my/accountable_spec.rb b/modules/my_page/spec/features/my/accountable_spec.rb
index 1febcf70633..a73ec008d80 100644
--- a/modules/my_page/spec/features/my/accountable_spec.rb
+++ b/modules/my_page/spec/features/my/accountable_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'Accountable widget on my page', js: true do
+RSpec.describe 'Accountable widget on my page', :js do
let!(:type) { create(:type) }
let!(:priority) { create(:default_priority) }
let!(:project) { create(:project, types: [type]) }
@@ -82,7 +82,7 @@ RSpec.describe 'Accountable widget on my page', js: true do
# The page starts with a "wp created widget".
created_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(2)')
expect(created_area.area)
- .to have_selector('.subject', text: accountable_work_package.subject)
+ .to have_css('.subject', text: accountable_work_package.subject)
# Add widget below existing widgets
my_page.add_widget(2, 2, :row, "Work packages I am accountable for")
@@ -110,12 +110,12 @@ RSpec.describe 'Accountable widget on my page', js: true do
accountable_area.expect_to_span(2, 1, 3, 2)
expect(accountable_area.area)
- .to have_selector('.subject', text: accountable_work_package.subject)
+ .to have_css('.subject', text: accountable_work_package.subject)
expect(accountable_area.area)
- .not_to have_selector('.subject', text: accountable_by_other_work_package.subject)
+ .to have_no_css('.subject', text: accountable_by_other_work_package.subject)
expect(accountable_area.area)
- .not_to have_selector('.subject', text: accountable_but_invisible_work_package.subject)
+ .to have_no_css('.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 35960b7fd43..9c3cbcea941 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
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'Assigned to me embedded query on my page', js: true do
+RSpec.describe 'Assigned to me embedded query on my page', :js do
let!(:type) { create(:type) }
let!(:priority) { create(:default_priority) }
let!(:project) { create(:project, types: [type]) }
@@ -134,10 +134,10 @@ RSpec.describe 'Assigned to me embedded query on my page', js: true do
assigned_area.expect_to_exist
expect(assigned_area.area)
- .to have_selector('.subject', text: assigned_work_package.subject)
+ .to have_css('.subject', text: assigned_work_package.subject)
expect(assigned_area.area)
- .not_to have_selector('.subject', text: assigned_to_other_work_package.subject)
+ .to have_no_css('.subject', text: assigned_to_other_work_package.subject)
embedded_table.click_inline_create
@@ -177,16 +177,16 @@ RSpec.describe 'Assigned to me embedded query on my page', js: true do
within assigned_area.area do
expect(page)
- .to have_selector('.subject', text: assigned_work_package.subject)
+ .to have_css('.subject', text: assigned_work_package.subject)
expect(page)
- .not_to have_selector('.subject', text: assigned_work_package_2.subject)
+ .to have_no_css('.subject', text: assigned_work_package_2.subject)
page.find('.op-pagination--item button', text: '2').click
expect(page)
- .not_to have_selector('.subject', text: assigned_work_package.subject)
+ .to have_no_css('.subject', text: assigned_work_package.subject)
expect(page)
- .to have_selector('.subject', text: assigned_work_package_2.subject)
+ .to have_css('.subject', text: assigned_work_package_2.subject)
end
assigned_area.resize_to(1, 2)
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 8dd60733188..78d99a34bd5 100644
--- a/modules/my_page/spec/features/my/custom_text_spec.rb
+++ b/modules/my_page/spec/features/my/custom_text_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'Custom text widget on my page', js: true do
+RSpec.describe 'Custom text widget on my page', :js do
let(:permissions) do
[]
end
@@ -72,13 +72,13 @@ RSpec.describe 'Custom text widget on my page', js: true do
within custom_text_widget.area do
find('.inplace-editing--container').click
- expect(page).to have_selector('.op-uc-container_editing', wait: 10)
+ expect(page).to have_css('.op-uc-container_editing', wait: 10)
field.set_value('My own little text')
field.save!
expect(page)
- .to have_selector('.inline-edit--display-field', text: 'My own little text')
+ .to have_css('.inline-edit--display-field', text: 'My own little text')
find('.inplace-editing--container').click
@@ -86,7 +86,7 @@ RSpec.describe 'Custom text widget on my page', js: true do
field.cancel_by_click
expect(page)
- .to have_selector('.inline-edit--display-field', text: 'My own little text')
+ .to have_css('.inline-edit--display-field', text: 'My own little text')
# adding an image
find('.inplace-editing--container').click
@@ -100,12 +100,12 @@ RSpec.describe 'Custom text widget on my page', js: true do
within custom_text_widget.area do
expect(page).to have_test_selector('op-attachment-list-item', text: 'image.png')
- expect(page).not_to have_selector('notifications-upload-progress')
+ expect(page).to have_no_css('notifications-upload-progress')
field.save!
expect(page)
- .to have_selector('#content img', count: 1)
+ .to have_css('#content img', count: 1)
expect(page)
.not_to have_test_selector('op-attachment-list-item', text: 'image.png')
diff --git a/modules/my_page/spec/features/my/documents_spec.rb b/modules/my_page/spec/features/my/documents_spec.rb
index e53616a10ed..f451ccb68ed 100644
--- a/modules/my_page/spec/features/my/documents_spec.rb
+++ b/modules/my_page/spec/features/my/documents_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'My page documents widget', js: true do
+RSpec.describe 'My page documents widget', :js do
let!(:project) { create(:project) }
let!(:other_project) { create(:project) }
let!(:visible_document) do
diff --git a/modules/my_page/spec/features/my/my_spent_time_widget_with_a_negative_time_zone_spec.rb b/modules/my_page/spec/features/my/my_spent_time_widget_with_a_negative_time_zone_spec.rb
index 2a73339e305..02117ee5c7a 100644
--- a/modules/my_page/spec/features/my/my_spent_time_widget_with_a_negative_time_zone_spec.rb
+++ b/modules/my_page/spec/features/my/my_spent_time_widget_with_a_negative_time_zone_spec.rb
@@ -86,11 +86,11 @@ RSpec.describe 'My spent time widget with a negative time zone', :js,
my_page.expect_and_dismiss_toaster message: I18n.t(:notice_successful_update)
aggregate_failures("non-working days are displayed properly") do
- expect(page).not_to have_css('.fc-day-mon.fc-non-working-day', wait: 0)
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day', wait: 0)
expect(page).to have_css('.fc-day-tue.fc-non-working-day', wait: 0)
- expect(page).not_to have_css('.fc-day-wed.fc-non-working-day', wait: 0)
- expect(page).not_to have_css('.fc-day-thu.fc-non-working-day', wait: 0)
- expect(page).not_to have_css('.fc-day-fri.fc-non-working-day', wait: 0)
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day', wait: 0)
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day', wait: 0)
+ expect(page).to have_no_css('.fc-day-fri.fc-non-working-day', wait: 0)
expect(page).to have_css('.fc-day-sat.fc-non-working-day', wait: 0)
expect(page).to have_css('.fc-day-sun.fc-non-working-day', wait: 0)
end
diff --git a/modules/my_page/spec/features/my/news_spec.rb b/modules/my_page/spec/features/my/news_spec.rb
index dc87f73bb6b..a55e7c16f3f 100644
--- a/modules/my_page/spec/features/my/news_spec.rb
+++ b/modules/my_page/spec/features/my/news_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'My page news widget spec', js: true do
+RSpec.describe 'My page news widget spec', :js do
let!(:project) { create(:project) }
let!(:other_project) { create(:project) }
let!(:visible_news) do
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 f7c2052b24e..8827bb28897 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
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'My page time entries current user widget spec', js: true do
+RSpec.describe 'My page time entries current user widget spec', :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type]) }
let!(:activity) { create(:time_entry_activity) }
@@ -130,13 +130,13 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
entries_area.expect_to_span(1, 1, 2, 2)
- 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')
- expect(page).to have_selector('.fc-day-sat.fc-non-working-day')
- expect(page).to have_selector('.fc-day-sun.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-tue.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-fri.fc-non-working-day')
+ expect(page).to have_css('.fc-day-sat.fc-non-working-day')
+ expect(page).to have_css('.fc-day-sun.fc-non-working-day')
expect(page)
.to have_content "Total: 6 h"
@@ -144,12 +144,12 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
expect(page)
.to have_content visible_time_entry.spent_on.strftime('%-m/%-d')
expect(page)
- .to have_selector('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
+ .to have_css('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
expect(page)
.to have_content(other_visible_time_entry.spent_on.strftime('%-m/%-d'))
expect(page)
- .to have_selector('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
+ .to have_css('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
# go to last week
within entries_area.area do
@@ -162,7 +162,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
expect(page)
.to have_content(last_week_visible_time_entry.spent_on.strftime('%-m/%-d'))
expect(page)
- .to have_selector('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
+ .to have_css('.fc-event .fc-event-title', text: "#{project.name} - ##{work_package.id}: #{work_package.subject}")
# go to today again
within entries_area.area do
@@ -177,7 +177,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
end
expect(page)
- .to have_selector('.ui-tooltip', text: "Project: #{project.name}")
+ .to have_css('.ui-tooltip', text: "Project: #{project.name}")
# Adding a time entry
@@ -195,7 +195,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
time_logging_modal.shows_field 'user', false
expect(page)
- .not_to have_selector('.ng-spinner-loader')
+ .to have_no_css('.ng-spinner-loader')
# Expect filtering works
time_logging_modal.work_package_field.autocomplete work_package.subject, select: false
@@ -222,8 +222,8 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
within entries_area.area do
expect(page)
- .to have_selector("td.fc-timegrid-col:nth-of-type(5) .te-calendar--time-entry",
- text: other_work_package.subject)
+ .to have_css("td.fc-timegrid-col:nth-of-type(5) .te-calendar--time-entry",
+ text: other_work_package.subject)
end
expect(page)
@@ -263,16 +263,16 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
end
expect(page)
- .to have_selector('.ui-tooltip', text: "Work package: ##{other_work_package.id}: #{other_work_package.subject}")
+ .to have_css('.ui-tooltip', text: "Work package: ##{other_work_package.id}: #{other_work_package.subject}")
expect(page)
- .to have_selector('.ui-tooltip', text: "Hours: 6 h")
+ .to have_css('.ui-tooltip', text: "Hours: 6 h")
expect(page)
- .to have_selector('.ui-tooltip', text: "Activity: #{other_activity.name}")
+ .to have_css('.ui-tooltip', text: "Activity: #{other_activity.name}")
expect(page)
- .to have_selector('.ui-tooltip', text: "Comment: Some comment")
+ .to have_css('.ui-tooltip', text: "Comment: Some comment")
expect(page)
.to have_content "Total: 13 h"
@@ -286,9 +286,9 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
within entries_area.area do
expect(page)
- .not_to have_selector('.fc-day-header', text: 'Mon')
+ .to have_no_css('.fc-day-header', text: 'Mon')
expect(page)
- .not_to have_selector('.fc-duration', text: "6 h")
+ .to have_no_css('.fc-duration', text: "6 h")
end
## Removing the time entry
@@ -307,7 +307,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
within entries_area.area do
expect(page)
- .not_to have_selector("td.fc-timegrid-col:nth-of-type(5) .te-calendar--time-entry")
+ .to have_no_css("td.fc-timegrid-col:nth-of-type(5) .te-calendar--time-entry")
end
expect(TimeEntry.where(id: other_visible_time_entry.id))
@@ -322,10 +322,10 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
.to have_content(/#{Regexp.escape(I18n.t('js.grid.widgets.time_entries_current_user.title'))}/i)
expect(page)
- .to have_selector(".te-calendar--time-entry", count: 1)
+ .to have_css(".te-calendar--time-entry", count: 1)
expect(page)
- .not_to have_selector('.fc-col-header-cell', text: 'Mon')
+ .to have_no_css('.fc-col-header-cell', text: 'Mon')
end
# Removing the widget
@@ -338,7 +338,7 @@ RSpec.describe 'My page time entries current user widget spec', js: true do
within nucleus_area.area do
expect(page)
- .to have_selector(".grid--widget-add")
+ .to have_css(".grid--widget-add")
end
end
end
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 eb7ac2a9dd1..05b3b564014 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
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../../support/pages/my/page'
-RSpec.describe 'Arbitrary WorkPackage query table widget on my page', js: true do
+RSpec.describe 'Arbitrary WorkPackage query table widget on my page', :js do
let!(:type) { create(:type) }
let!(:other_type) { create(:type) }
let!(:priority) { create(:default_priority) }
@@ -78,7 +78,7 @@ RSpec.describe 'Arbitrary WorkPackage query table widget on my page', js: true d
# Using it here as a safeguard to govern speed.
created_by_me_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(2)')
expect(created_by_me_area.area)
- .to have_selector('.subject', text: type_work_package.subject)
+ .to have_css('.subject', text: type_work_package.subject)
my_page.add_widget(1, 2, :column, "Work packages table")
@@ -94,10 +94,10 @@ RSpec.describe 'Arbitrary WorkPackage query table widget on my page', js: true d
# At the beginning, the default query is displayed
expect(filter_area.area)
- .to have_selector('.subject', text: type_work_package.subject)
+ .to have_css('.subject', text: type_work_package.subject)
expect(filter_area.area)
- .to have_selector('.subject', text: other_type_work_package.subject)
+ .to have_css('.subject', text: other_type_work_package.subject)
# User has the ability to modify the query
@@ -113,15 +113,15 @@ RSpec.describe 'Arbitrary WorkPackage query table widget on my page', js: true d
columns.remove 'Subject'
expect(filter_area.area)
- .to have_selector('.id', text: type_work_package.id)
+ .to have_css('.id', text: type_work_package.id)
# as the Subject column is disabled
expect(filter_area.area)
- .not_to have_selector('.subject', text: type_work_package.subject)
+ .to have_no_css('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .not_to have_selector('.id', text: other_type_work_package.id)
+ .to have_no_css('.id', text: other_type_work_package.id)
scroll_to_element(filter_area.area)
within filter_area.area do
@@ -142,15 +142,15 @@ RSpec.describe 'Arbitrary WorkPackage query table widget on my page', js: true d
filter_area = Components::Grids::GridArea.new('.grid--area.-widgeted:nth-of-type(3)')
expect(filter_area.area)
- .to have_selector('.id', text: type_work_package.id)
+ .to have_css('.id', text: type_work_package.id)
# as the Subject column is disabled
expect(filter_area.area)
- .not_to have_selector('.subject', text: type_work_package.subject)
+ .to have_no_css('.subject', text: type_work_package.subject)
# As other_type is filtered out
expect(filter_area.area)
- .not_to have_selector('.id', text: other_type_work_package.id)
+ .to have_no_css('.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/my_page/spec/models/grids/my_page_spec.rb b/modules/my_page/spec/models/grids/my_page_spec.rb
index df79c23d3aa..c6e763ec938 100644
--- a/modules/my_page/spec/models/grids/my_page_spec.rb
+++ b/modules/my_page/spec/models/grids/my_page_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-require_relative './shared_model'
+require_relative 'shared_model'
RSpec.describe Grids::MyPage do
let(:instance) { described_class.new(row_count: 5, column_count: 5) }
diff --git a/modules/my_page/spec/queries/grids/query_integration_spec.rb b/modules/my_page/spec/queries/grids/query_integration_spec.rb
index e373376d9e7..1197ed5c1bd 100644
--- a/modules/my_page/spec/queries/grids/query_integration_spec.rb
+++ b/modules/my_page/spec/queries/grids/query_integration_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe Grids::Query, type: :model do
context 'without a filter' do
describe '#results' do
it 'is the same as getting all the grids visible to the user' do
- expect(instance.results).to match_array [my_page_grid]
+ expect(instance.results).to contain_exactly(my_page_grid)
end
end
end
@@ -58,7 +58,7 @@ RSpec.describe Grids::Query, type: :model do
describe '#results' do
it 'is the same as handwriting the query' do
- expect(instance.results).to match_array [my_page_grid]
+ expect(instance.results).to contain_exactly(my_page_grid)
end
end
diff --git a/modules/my_page/spec/requests/api/v3/grids/grids_resource_spec.rb b/modules/my_page/spec/requests/api/v3/grids/grids_resource_spec.rb
index 9e954eb3a06..7ab52ed79da 100644
--- a/modules/my_page/spec/requests/api/v3/grids/grids_resource_spec.rb
+++ b/modules/my_page/spec/requests/api/v3/grids/grids_resource_spec.rb
@@ -252,8 +252,7 @@ RSpec.describe 'API v3 Grids resource', content_type: :json do
expect(subject.status).to eq 422
expect(JSON.parse(subject.body)['_embedded']['errors'].map { |e| e['message'] })
- .to match_array ["Widgets is outside of the grid.",
- "Number of rows must be greater than 0."]
+ .to contain_exactly("Widgets is outside of the grid.", "Number of rows must be greater than 0.")
end
it 'does not persist the changes to widgets' do
@@ -380,9 +379,8 @@ RSpec.describe 'API v3 Grids resource', content_type: :json do
.at_path('_type')
expect(JSON.parse(subject.body)['_embedded']['errors'].map { |e| e['message'] })
- .to match_array ["Widgets is outside of the grid.",
- "Number of rows must be greater than 0.",
- "Number of columns must be greater than 0."]
+ .to contain_exactly("Widgets is outside of the grid.", "Number of rows must be greater than 0.",
+ "Number of columns must be greater than 0.")
end
end
end
diff --git a/modules/openid_connect/lib/open_project/openid_connect/hooks/hook.rb b/modules/openid_connect/lib/open_project/openid_connect/hooks/hook.rb
index e951af3648b..c3411f64c7d 100644
--- a/modules/openid_connect/lib/open_project/openid_connect/hooks/hook.rb
+++ b/modules/openid_connect/lib/open_project/openid_connect/hooks/hook.rb
@@ -24,7 +24,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
-#+
+# +
module OpenProject::OpenIDConnect
module Hooks
diff --git a/modules/openid_connect/spec/requests/openid_connect_spec.rb b/modules/openid_connect/spec/requests/openid_connect_spec.rb
index 7cda8236786..9b5f4687973 100644
--- a/modules/openid_connect/spec/requests/openid_connect_spec.rb
+++ b/modules/openid_connect/spec/requests/openid_connect_spec.rb
@@ -33,8 +33,7 @@ RSpec.configure do |c|
c.include OpenIDConnectSpecHelpers
end
-RSpec.describe 'OpenID Connect',
- skip_2fa_stage: true, # Prevent redirects to 2FA stage
+RSpec.describe 'OpenID Connect', :skip_2fa_stage, # Prevent redirects to 2FA stage
type: :rails_request,
with_ee: %i[openid_providers] do
let(:host) { OmniAuth::OpenIDConnect::Heroku.new('foo', {}).host }
@@ -180,7 +179,7 @@ RSpec.describe 'OpenID Connect',
)
end
- it 'will show no option unless EE', with_ee: false do
+ it 'shows no option unless EE', with_ee: false do
get '/login'
expect(response.body).not_to match /Google/i
expect(response.body).not_to match /Azure/i
diff --git a/modules/overviews/spec/features/low_permissions_page_creation_spec.rb b/modules/overviews/spec/features/low_permissions_page_creation_spec.rb
index 078928a6f52..283c24cc60e 100644
--- a/modules/overviews/spec/features/low_permissions_page_creation_spec.rb
+++ b/modules/overviews/spec/features/low_permissions_page_creation_spec.rb
@@ -30,8 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/overview'
-RSpec.describe 'Overview page on the fly creation if user lacks :mange_overview permission',
- js: true do
+RSpec.describe 'Overview page on the fly creation if user lacks :mange_overview permission', :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type]) }
let!(:open_status) { create(:default_status) }
diff --git a/modules/overviews/spec/features/managing_overview_page_spec.rb b/modules/overviews/spec/features/managing_overview_page_spec.rb
index 7445fa80aa5..22fe1ae5da6 100644
--- a/modules/overviews/spec/features/managing_overview_page_spec.rb
+++ b/modules/overviews/spec/features/managing_overview_page_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative '../support/pages/overview'
-RSpec.describe 'Overview page managing', js: true do
+RSpec.describe 'Overview page managing', :js do
let!(:type) { create(:type) }
let!(:project) { create(:project, types: [type], description: 'My **custom** description') }
let!(:open_status) { create(:default_status) }
diff --git a/modules/overviews/spec/features/navigation_spec.rb b/modules/overviews/spec/features/navigation_spec.rb
index b9a595db258..3390a8719b6 100644
--- a/modules/overviews/spec/features/navigation_spec.rb
+++ b/modules/overviews/spec/features/navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Navigate to overview', js: true do
+RSpec.describe 'Navigate to overview', :js do
let(:project) { create(:project) }
let(:permissions) { [] }
let(:user) do
diff --git a/modules/recaptcha/app/controllers/recaptcha/request_controller.rb b/modules/recaptcha/app/controllers/recaptcha/request_controller.rb
index 5e5115469ee..162b29141d2 100644
--- a/modules/recaptcha/app/controllers/recaptcha/request_controller.rb
+++ b/modules/recaptcha/app/controllers/recaptcha/request_controller.rb
@@ -44,13 +44,13 @@ module ::Recaptcha
private
- def set_captcha_settings(&block)
+ def set_captcha_settings(&)
if OpenProject::Recaptcha::Configuration.use_hcaptcha?
Recaptcha.with_configuration(verify_url: OpenProject::Recaptcha.hcaptcha_verify_url,
api_server_url: OpenProject::Recaptcha.hcaptcha_api_server_url,
- &block)
+ &)
else
- block.call
+ yield
end
end
diff --git a/modules/recaptcha/lib/open_project/recaptcha/engine.rb b/modules/recaptcha/lib/open_project/recaptcha/engine.rb
index e283b4a3d14..312cc01b444 100644
--- a/modules/recaptcha/lib/open_project/recaptcha/engine.rb
+++ b/modules/recaptcha/lib/open_project/recaptcha/engine.rb
@@ -12,7 +12,7 @@ module OpenProject::Recaptcha
settings: {
default: {
recaptcha_type: ::OpenProject::Recaptcha::TYPE_DISABLED,
- response_limit: 5000,
+ response_limit: 5000
}
},
bundled: true do
diff --git a/modules/reporting/app/controllers/cost_reports_controller.rb b/modules/reporting/app/controllers/cost_reports_controller.rb
index 8713085fe52..f6afb7d2c62 100644
--- a/modules/reporting/app/controllers/cost_reports_controller.rb
+++ b/modules/reporting/app/controllers/cost_reports_controller.rb
@@ -117,7 +117,7 @@ class CostReportsController < ApplicationController
def create
@query.name = params[:query_name].presence || ::I18n.t(:label_default)
@query.public! if make_query_public?
- @query.send("#{user_key}=", current_user.id)
+ @query.send(:"#{user_key}=", current_user.id)
@query.save!
redirect_params = { action: 'show', id: @query.id }
@@ -466,7 +466,7 @@ class CostReportsController < ApplicationController
rows = params[:groups]['rows']
columns = params[:groups]['columns']
end
- { rows: (rows || []), columns: (columns || []) }
+ { rows: rows || [], columns: columns || [] }
end
##
diff --git a/modules/reporting/app/models/cost_query.rb b/modules/reporting/app/models/cost_query.rb
index 1b327ad6b06..795b1798cfa 100644
--- a/modules/reporting/app/models/cost_query.rb
+++ b/modules/reporting/app/models/cost_query.rb
@@ -87,7 +87,7 @@ class CostQuery < ApplicationRecord
def serialize
# have to take the reverse group_bys to retain the original order when deserializing
- self.serialized = { filters: (filters.map(&:serialize).reject(&:nil?).sort_by(&:first)),
+ self.serialized = { filters: filters.map(&:serialize).reject(&:nil?).sort_by(&:first),
group_bys: group_bys.map(&:serialize).reject(&:nil?).reverse }
end
@@ -215,7 +215,7 @@ class CostQuery < ApplicationRecord
def cache_key
deserialize unless @chain
parts = [self.class.table_name.sub('_reports', '')]
- parts.concat [filters.sort, group_bys].map { |l| l.map(&:cache_key).join(' ') }
+ parts.concat([filters.sort, group_bys].map { |l| l.map(&:cache_key).join(' ') })
parts.join '/'
end
diff --git a/modules/reporting/app/models/cost_query/filter/user_id.rb b/modules/reporting/app/models/cost_query/filter/user_id.rb
index c0c5b1bad45..215e593850c 100644
--- a/modules/reporting/app/models/cost_query/filter/user_id.rb
+++ b/modules/reporting/app/models/cost_query/filter/user_id.rb
@@ -39,7 +39,6 @@ class CostQuery::Filter::UserId < Report::Filter::Base
# Map the special 'me' value
super
.filter_map { |val| replace_me_value(val) }
-
end
def replace_me_value(value)
diff --git a/modules/reporting/app/models/cost_query/sql_statement.rb b/modules/reporting/app/models/cost_query/sql_statement.rb
index fd48cba0b00..d7ebfd3d2a8 100644
--- a/modules/reporting/app/models/cost_query/sql_statement.rb
+++ b/modules/reporting/app/models/cost_query/sql_statement.rb
@@ -93,7 +93,7 @@ class CostQuery::SqlStatement < Report::SqlStatement
})
# FIXME: build this subquery from a sql_statement
query.from "(SELECT *, #{typed :text, model.model_name.to_s} AS type FROM #{table}) AS #{table}"
- send("unify_#{table}", query)
+ send(:"unify_#{table}", query)
end
end
diff --git a/modules/reporting/app/models/entry.rb b/modules/reporting/app/models/entry.rb
index 5ef2975e0f7..17a4f515aad 100644
--- a/modules/reporting/app/models/entry.rb
+++ b/modules/reporting/app/models/entry.rb
@@ -42,9 +42,9 @@ module Entry
TimeEntry === obj or CostEntry === obj
end
- def calculate(type, *args)
- a = TimeEntry.calculate(type, *args)
- b = CostEntry.calculate(type, *args)
+ def calculate(type, *)
+ a = TimeEntry.calculate(type, *)
+ b = CostEntry.calculate(type, *)
case type
when :sum, :count then a + b
when :avg then (a + b) / 2
@@ -81,16 +81,16 @@ module Entry
def find_from_ids(_args, options) find_many :find_from_ids, options end
- def find_one(*args)
- TimeEntry.send(*args) || CostEntry.send(*args)
+ def find_one(*)
+ TimeEntry.send(*) || CostEntry.send(*)
end
- def find_many(*args)
- TimeEntry.send(*args) + CostEntry.send(*args)
+ def find_many(*)
+ TimeEntry.send(*) + CostEntry.send(*)
end
- def send_all(*args)
- [TimeEntry.send(*args), CostEntry.send(*args)]
+ def send_all(*)
+ [TimeEntry.send(*), CostEntry.send(*)]
end
end
end
diff --git a/modules/reporting/db/migrate/20180323130704_to_v710_aggregated_reporting_migrations.rb b/modules/reporting/db/migrate/20180323130704_to_v710_aggregated_reporting_migrations.rb
index 5495ac51f42..7b4b581cea3 100644
--- a/modules/reporting/db/migrate/20180323130704_to_v710_aggregated_reporting_migrations.rb
+++ b/modules/reporting/db/migrate/20180323130704_to_v710_aggregated_reporting_migrations.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
-require Rails.root.join("db", "migrate", "migration_utils", "migration_squasher").to_s
+require Rails.root.join("db/migrate/migration_utils/migration_squasher").to_s
# This migration aggregates the migrations detailed in MIGRATION_FILES
class ToV710AggregatedReportingMigrations < ActiveRecord::Migration[5.1]
MIGRATION_FILES = <<-MIGRATIONS
diff --git a/modules/reporting/lib/open_project/reporting/patches/custom_fields_controller_patch.rb b/modules/reporting/lib/open_project/reporting/patches/custom_fields_controller_patch.rb
index cf3e93130bf..213b275ec3b 100644
--- a/modules/reporting/lib/open_project/reporting/patches/custom_fields_controller_patch.rb
+++ b/modules/reporting/lib/open_project/reporting/patches/custom_fields_controller_patch.rb
@@ -73,7 +73,7 @@ module OpenProject::Reporting::Patches
end
def remove_custom_field_from_session(id)
- custom_field_name = "custom_field#{id}".to_sym
+ custom_field_name = :"custom_field#{id}"
report_engine_name = CostQuery.name.underscore.to_sym
cookie = session[report_engine_name]
diff --git a/modules/reporting/lib/report/chainable.rb b/modules/reporting/lib/report/chainable.rb
index 1634fa74e48..ebf31f7b80d 100644
--- a/modules/reporting/lib/report/chainable.rb
+++ b/modules/reporting/lib/report/chainable.rb
@@ -176,7 +176,7 @@ module Report
unless self.class.extra_options.include? key
raise ArgumentError, "may not set #{key}" unless engine.accepted_properties.include? key.to_s
- send "#{key}=", value
+ send :"#{key}=", value
end
end
if child
@@ -218,14 +218,14 @@ module Report
end
end
- def chain_collect(name, *args, &)
- top.subchain_collect(name, *args, &)
+ def chain_collect(name, *, &)
+ top.subchain_collect(name, *, &)
end
# See #chain_collect
- def subchain_collect(name, *args, &)
- subchain = child.subchain_collect(name, *args, &) unless bottom?
- [* send(name, *args, &)].push(*subchain).compact.uniq
+ def subchain_collect(name, *, &)
+ subchain = child.subchain_collect(name, *, &) unless bottom?
+ [* send(name, *, &)].push(*subchain).compact.uniq
end
# overwrite in subclass to maintain constisten state
diff --git a/modules/reporting/lib/report/inherited_attribute.rb b/modules/reporting/lib/report/inherited_attribute.rb
index d64936ebb87..cae9aef5dac 100644
--- a/modules/reporting/lib/report/inherited_attribute.rb
+++ b/modules/reporting/lib/report/inherited_attribute.rb
@@ -43,7 +43,7 @@ module Report::InheritedAttribute
return get_inherited_attribute(name, default, list, uniq) if values.empty?
if list
- old = instance_variable_get("@#{name}") if merge
+ old = instance_variable_get(:"@#{name}") if merge
old ||= []
return set_inherited_attribute(name, values.map(&map) + old)
end
@@ -58,13 +58,13 @@ module Report::InheritedAttribute
def define_singleton_method(name, &)
singleton_class.send :attr_writer, name
singleton_class.class_eval { define_method(name, &) }
- define_method(name) { instance_variable_get("@#{name}") or singleton_class.send(name) }
+ define_method(name) { instance_variable_get(:"@#{name}") or singleton_class.send(name) }
end
def get_inherited_attribute(name, default = nil, list = false, uniq = false)
return get_inherited_attribute(name, default, list, false).uniq if list and uniq
- result = instance_variable_get("@#{name}")
+ result = instance_variable_get(:"@#{name}")
super_result = superclass.get_inherited_attribute(name, default, list) if inherit? name
if result.nil?
super_result || default
@@ -86,6 +86,6 @@ module Report::InheritedAttribute
end
def set_inherited_attribute(name, value)
- instance_variable_set "@#{name}", value
+ instance_variable_set :"@#{name}", value
end
end
diff --git a/modules/reporting/lib/report/operator.rb b/modules/reporting/lib/report/operator.rb
index 8fb161bab2e..35654636dbe 100644
--- a/modules/reporting/lib/report/operator.rb
+++ b/modules/reporting/lib/report/operator.rb
@@ -60,7 +60,7 @@ class Report::Operator
new '>t-', label: :label_less_than_ago do
include DateRange
def modify(query, field, value)
- super query, field, -value.to_i, 0
+ super(query, field, -value.to_i, 0)
end
end
@@ -82,7 +82,7 @@ class Report::Operator
new 't+', label: :label_in do
include DateRange
def modify(query, field, *values)
- super query, field, values.first.to_i, values.first.to_i
+ super(query, field, values.first.to_i, values.first.to_i)
end
end
@@ -101,7 +101,7 @@ class Report::Operator
new 't-', label: :label_ago do
include DateRange
def modify(query, field, *values)
- super query, field, -values.first.to_i, -values.first.to_i
+ super(query, field, -values.first.to_i, -values.first.to_i)
end
end
@@ -137,14 +137,14 @@ class Report::Operator
new '<t+', label: :label_in_less_than do
include DateRange
def modify(query, field, value)
- super query, field, 0, value.to_i
+ super(query, field, 0, value.to_i)
end
end
new 't', label: :label_today do
include DateRange
def modify(query, field)
- super query, field, 0, 0
+ super(query, field, 0, 0)
end
end
@@ -155,14 +155,14 @@ class Report::Operator
new '<t-', label: :label_more_than_ago do
include DateRange
def modify(query, field, value)
- super query, field, nil, -value.to_i
+ super(query, field, nil, -value.to_i)
end
end
new '>t+', label: :label_in_more_than do
include DateRange
def modify(query, field, value)
- super query, field, value.to_i, nil
+ super(query, field, value.to_i, nil)
end
end
diff --git a/modules/reporting/lib/report/result.rb b/modules/reporting/lib/report/result.rb
index 445860c23f8..7b3375f25a6 100644
--- a/modules/reporting/lib/report/result.rb
+++ b/modules/reporting/lib/report/result.rb
@@ -42,8 +42,8 @@ class Report::Result
@value = value
end
- def recursive_each_with_level(level = 0, _depth_first = true, &block)
- block.call(level, self)
+ def recursive_each_with_level(level = 0, _depth_first = true)
+ yield(level, self)
end
def recursive_each
@@ -229,10 +229,10 @@ class Report::Result
@sum_for[field] ||= sum { |v| v.send(field) || 0 }
end
- def recursive_each_with_level(level = 0, depth_first = true, &block)
+ def recursive_each_with_level(level = 0, depth_first = true, &)
if depth_first
super
- each { |c| c.recursive_each_with_level(level + 1, depth_first, &block) }
+ each { |c| c.recursive_each_with_level(level + 1, depth_first, &) }
else # width-first
to_evaluate = [self]
lvl = level
@@ -240,7 +240,7 @@ class Report::Result
# evaluate all stored results and find the results we need to evaluate soon
to_evaluate_soon = []
to_evaluate.each do |r|
- block.call(lvl, r)
+ yield(lvl, r)
to_evaluate_soon.concat r.values if r.size > 0
end
# take new results to evaluate
@@ -292,9 +292,9 @@ class Report::Result
def self.new(value, fields = {}, type = nil, important_fields = [])
result = case value
- when ActiveRecord::Result, Array then engine::Result::WrappedResult.new value.map { |e|
+ when ActiveRecord::Result, Array then engine::Result::WrappedResult.new(value.map do |e|
new e, {}, nil, important_fields
- }
+ end)
when Hash then engine::Result::DirectResult.new value.with_indifferent_access
when Base then value
else raise ArgumentError, "Cannot create Result from #{value.inspect}"
diff --git a/modules/reporting/lib/report/sql_statement.rb b/modules/reporting/lib/report/sql_statement.rb
index 3553c7b99c2..00417cbe07d 100644
--- a/modules/reporting/lib/report/sql_statement.rb
+++ b/modules/reporting/lib/report/sql_statement.rb
@@ -214,7 +214,7 @@ class Report::SqlStatement
if f.size == 2 and f.first.respond_to? :table_name then select field_name_for(f)
else select(*f)
end
- when Hash then select f.map { |k, v| "#{field_name_for v} as #{field_name_for k}" }
+ when Hash then select(f.map { |k, v| "#{field_name_for v} as #{field_name_for k}" })
when String, Symbol then @select << field_name_for(f)
when engine::SqlStatement then @select << f.to_s
else raise ArgumentError, "cannot handle #{f.inspect}"
diff --git a/modules/reporting/lib/widget/filters/operators.rb b/modules/reporting/lib/widget/filters/operators.rb
index 65f241ebdbd..91057075a24 100644
--- a/modules/reporting/lib/widget/filters/operators.rb
+++ b/modules/reporting/lib/widget/filters/operators.rb
@@ -29,7 +29,7 @@
class Widget::Filters::Operators < Widget::Filters::Base
def render
write(content_tag(:div, class: 'advanced-filters--filter-operator') do
- hide_select_box = (filter_class.available_operators.count == 1 || filter_class.heavy?)
+ hide_select_box = filter_class.available_operators.count == 1 || filter_class.heavy?
options = { class: 'advanced-filters--select filters-select filter_operator',
id: "operators[#{filter_class.underscore_name}]",
name: "operators[#{filter_class.underscore_name}]",
diff --git a/modules/reporting/lib/widget/filters/option.rb b/modules/reporting/lib/widget/filters/option.rb
index cf0642a60e6..194dd4ecc74 100644
--- a/modules/reporting/lib/widget/filters/option.rb
+++ b/modules/reporting/lib/widget/filters/option.rb
@@ -37,7 +37,7 @@ class Widget::Filters::Option < Widget::Filters::Base
options = args.first || {} # optional configuration for values
level = options[:level] # nesting_level is optional for values
name = I18n.t(name) if name.is_a? Symbol
- name = name.empty? ? I18n.t(:label_none) : name
+ name = I18n.t(:label_none) if name.empty?
name_prefix = (level && level > 0 ? ((' ' * 2 * level) + '> ') : '')
if options[:optgroup]
tag :optgroup, label: I18n.t(:label_sector)
diff --git a/modules/reporting/lib/widget/reporting_widget.rb b/modules/reporting/lib/widget/reporting_widget.rb
index e73b96f4353..d894bd98195 100644
--- a/modules/reporting/lib/widget/reporting_widget.rb
+++ b/modules/reporting/lib/widget/reporting_widget.rb
@@ -52,8 +52,8 @@ class Widget::ReportingWidget < ActionView::Base
false
end
- def method_missing(name, *args, &)
- controller.send(name, *args, &)
+ def method_missing(name, *, &)
+ controller.send(name, *, &)
rescue NoMethodError
raise NoMethodError, "undefined method `#{name}' for #<#{self.class}:0x#{object_id}>"
end
diff --git a/modules/reporting/spec/factories/cost_query_factory.rb b/modules/reporting/spec/factories/cost_query_factory.rb
index a1e12900ae4..e407fc5e841 100644
--- a/modules/reporting/spec/factories/cost_query_factory.rb
+++ b/modules/reporting/spec/factories/cost_query_factory.rb
@@ -28,8 +28,8 @@
FactoryBot.define do
factory :cost_query do
- association :user, factory: :user
- association :project, factory: :project
+ association :user
+ association :project
sequence(:name) { |n| "Cost Query #{n}" }
factory :private_cost_query do
is_public { false }
diff --git a/modules/reporting/spec/features/custom_fields_spec.rb b/modules/reporting/spec/features/custom_fields_spec.rb
index 1cd7456f3bd..45314078722 100644
--- a/modules/reporting/spec/features/custom_fields_spec.rb
+++ b/modules/reporting/spec/features/custom_fields_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Custom fields reporting', js: true do
+RSpec.describe 'Custom fields reporting', :js do
let(:type) { create(:type) }
let(:project) { create(:project, types: [type]) }
@@ -90,24 +90,24 @@ RSpec.describe 'Custom fields reporting', js: true do
end
it 'filters by the multi CF' do
- expect(page).to have_selector('#add_filter_select option', text: 'List CF')
+ expect(page).to have_css('#add_filter_select option', text: 'List CF')
select 'List CF', from: 'add_filter_select'
# Adds filter to page, filtering out the time entries on the work package
- expect(page).to have_selector("label##{cf_id}")
+ expect(page).to have_css("label##{cf_id}")
custom_field_selector = "##{cf_id}_arg_1_val"
select = find(custom_field_selector)
- expect(select).to have_selector('option', text: 'First option')
- expect(select).to have_selector('option', text: 'Second option')
+ expect(select).to have_css('option', text: 'First option')
+ expect(select).to have_css('option', text: 'Second option')
select.find('option', text: 'Second option').select_option
click_link 'Apply'
# Expect empty result table
within('#result-table') do
- expect(page).not_to have_selector('.top.result', text: '12.50 hours')
+ expect(page).to have_no_css('.top.result', text: '12.50 hours')
end
- expect(page).to have_selector('.generic-table--no-results-title')
+ expect(page).to have_css('.generic-table--no-results-title')
# Update filter to value the work package has
select = find(custom_field_selector)
@@ -116,13 +116,13 @@ RSpec.describe 'Custom fields reporting', js: true do
# Expect row of work package
within('#result-table') do
- expect(page).to have_selector('.top.result', text: '12.50 hours')
+ expect(page).to have_css('.top.result', text: '12.50 hours')
end
end
it 'groups by the multi CF (Regression #26050)' do
- expect(page).to have_selector('#group-by--add-columns')
- expect(page).to have_selector('#group-by--add-rows')
+ expect(page).to have_css('#group-by--add-columns')
+ expect(page).to have_css('#group-by--add-rows')
select 'List CF', from: 'group-by--add-columns'
select 'Work package', from: 'group-by--add-rows'
@@ -131,13 +131,13 @@ RSpec.describe 'Custom fields reporting', js: true do
# Expect row of work package
within('#result-table') do
- expect(page).to have_selector('a.work_package', text: "#{work_package.type} ##{work_package.id}")
+ expect(page).to have_css('a.work_package', text: "#{work_package.type} ##{work_package.id}")
# There used to be additional and unwanted text after the option name being rendered.
- expect(page).to have_selector('th.inner', text: /^First option$/)
- expect(page).not_to have_selector('th.inner', text: 'Second option')
+ expect(page).to have_css('th.inner', text: /^First option$/)
+ expect(page).to have_no_css('th.inner', text: 'Second option')
# Only first option should have content for the work package
- expect(page).to have_selector('table.report tbody tr', count: 1)
+ expect(page).to have_css('table.report tbody tr', count: 1)
row_elements = page.all('table.report tr.odd th')
expect(row_elements[0].text).to eq(project.name)
@@ -183,8 +183,8 @@ RSpec.describe 'Custom fields reporting', js: true do
it 'groups by the raw values when an invalid value exists' do
expect(work_package2.send(custom_field_2.attribute_getter)).to eq(['invalid not found'])
- expect(page).to have_selector('#group-by--add-columns')
- expect(page).to have_selector('#group-by--add-rows')
+ expect(page).to have_css('#group-by--add-columns')
+ expect(page).to have_css('#group-by--add-rows')
select 'Invalid List CF', from: 'group-by--add-columns'
select 'Work package', from: 'group-by--add-rows'
@@ -194,9 +194,9 @@ RSpec.describe 'Custom fields reporting', js: true do
# Expect row of work package
within('#result-table') do
- expect(page).to have_selector('a.work_package', text: "#{work_package.type} ##{work_package.id}")
- expect(page).to have_selector('th.inner', text: '1')
- expect(page).not_to have_selector('th.inner', text: 'invalid!')
+ expect(page).to have_css('a.work_package', text: "#{work_package.type} ##{work_package.id}")
+ expect(page).to have_css('th.inner', text: '1')
+ expect(page).to have_no_css('th.inner', text: 'invalid!')
end
end
end
@@ -217,8 +217,8 @@ RSpec.describe 'Custom fields reporting', js: true do
end
it 'groups by a text CF' do
- expect(page).to have_selector('#group-by--add-columns')
- expect(page).to have_selector('#group-by--add-rows')
+ expect(page).to have_css('#group-by--add-columns')
+ expect(page).to have_css('#group-by--add-rows')
select 'Text CF', from: 'group-by--add-columns'
select 'Work package', from: 'group-by--add-rows'
@@ -227,12 +227,12 @@ RSpec.describe 'Custom fields reporting', js: true do
# Expect row of work package
within('#result-table') do
- expect(page).to have_selector('a.work_package', text: "#{work_package.type} ##{work_package.id}")
- expect(page).to have_selector('th.inner', text: 'foo')
- expect(page).not_to have_selector('th.inner', text: 'None')
+ expect(page).to have_css('a.work_package', text: "#{work_package.type} ##{work_package.id}")
+ expect(page).to have_css('th.inner', text: 'foo')
+ expect(page).to have_no_css('th.inner', text: 'None')
# Only first option should have content for the work package
- expect(page).to have_selector('table.report tbody tr', count: 1)
+ expect(page).to have_css('table.report tbody tr', count: 1)
row_elements = page.all('table.report tr.odd th')
expect(row_elements[0].text).to eq(project.name)
diff --git a/modules/reporting/spec/features/export_cost_report_spec.rb b/modules/reporting/spec/features/export_cost_report_spec.rb
index b4f2fcb84ba..aac374de311 100644
--- a/modules/reporting/spec/features/export_cost_report_spec.rb
+++ b/modules/reporting/spec/features/export_cost_report_spec.rb
@@ -29,7 +29,7 @@
require_relative '../spec_helper'
require_relative 'support/pages/cost_report_page'
-RSpec.describe "Cost reports XLS export", js: true do
+RSpec.describe "Cost reports XLS export", :js do
shared_let(:project) { create(:project) }
shared_let(:user) { create(:admin) }
shared_let(:cost_type) { create(:cost_type, name: 'Post-war', unit: 'cap', unit_plural: 'caps') }
diff --git a/modules/reporting/spec/features/filter_spec.rb b/modules/reporting/spec/features/filter_spec.rb
index 503e84111d0..708398e9176 100644
--- a/modules/reporting/spec/features/filter_spec.rb
+++ b/modules/reporting/spec/features/filter_spec.rb
@@ -23,32 +23,32 @@ RSpec.describe 'Cost report calculations', :js, :with_cuprite do
it 'provides filtering' do
# Then filter "spent_on" should be visible
# And filter "user_id" should be visible
- expect(page).to have_selector("#filter_project_id")
- expect(page).to have_selector("#filter_spent_on")
- expect(page).to have_selector("#filter_user_id")
+ expect(page).to have_css("#filter_project_id")
+ expect(page).to have_css("#filter_spent_on")
+ expect(page).to have_css("#filter_user_id")
# Regression #48633
# Remove filter:
# And I click on the filter's "Clear" button
clear_project_filter
# Then filter "project_id" should not be visible
- expect(page).not_to have_selector('#filter_project_id')
+ expect(page).to have_no_css('#filter_project_id')
# Remove filters:
# And I click on "Clear"
click_on 'Clear'
# Then filter "spent_on" should not be visible
# And filter "user_id" should not be visible
- expect(page).not_to have_selector("#filter_spent_on")
- expect(page).not_to have_selector("#filter_user_id")
+ expect(page).to have_no_css("#filter_spent_on")
+ expect(page).to have_no_css("#filter_user_id")
# Reload restores the query
# And the user with the login "developer" should be selected for "User Value"
# And "!" should be selected for "User Operator Open this filter with 'ALT' and arrow keys."
reload_page
- expect(page).to have_selector("#filter_spent_on")
- expect(page).to have_selector("#filter_user_id")
+ expect(page).to have_css("#filter_spent_on")
+ expect(page).to have_css("#filter_user_id")
- expect(page).to have_selector("#user_id_arg_1_val", text: 'me')
+ expect(page).to have_css("#user_id_arg_1_val", text: 'me')
end
end
diff --git a/modules/reporting/spec/features/main_menu_item_spec.rb b/modules/reporting/spec/features/main_menu_item_spec.rb
index f22025a6eba..1a90c2f992d 100644
--- a/modules/reporting/spec/features/main_menu_item_spec.rb
+++ b/modules/reporting/spec/features/main_menu_item_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe 'Cost and Reports Main Menu Item', :js, :with_cuprite do
it 'is not rendered' do
within '#main-menu' do
- expect(page).not_to have_link(I18n.t(:cost_reports_title))
+ expect(page).to have_no_link(I18n.t(:cost_reports_title))
end
end
end
diff --git a/modules/reporting/spec/features/me_value_spec.rb b/modules/reporting/spec/features/me_value_spec.rb
index 6355cc4c470..7c969b0c225 100644
--- a/modules/reporting/spec/features/me_value_spec.rb
+++ b/modules/reporting/spec/features/me_value_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Cost report showing my own times', js: true do
+RSpec.describe 'Cost report showing my own times', :js do
let(:project) { create(:project) }
let(:user) { create(:admin) }
let(:user2) { create(:admin) }
@@ -39,9 +39,9 @@ RSpec.describe 'Cost report showing my own times', js: true do
check 'query_is_public'
find_by_id('query-icon-save-button').click
# wait until the save is complete
- expect(page).to have_selector('h2', text: 'Query ME value')
+ expect(page).to have_css('h2', text: 'Query ME value')
- expect(page).to have_selector('.report', text: '10.00')
+ expect(page).to have_css('.report', text: '10.00')
report = nil
retry_block do
@@ -57,8 +57,8 @@ RSpec.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).not_to have_selector('.report', text: '10.00')
- expect(page).to have_selector('.report', text: '15.00')
+ expect(page).to have_no_css('.report', text: '10.00')
+ expect(page).to have_css('.report', text: '15.00')
expect(page).to have_field(filter_selector, text: 'me')
end
diff --git a/modules/reporting/spec/features/menu_spec.rb b/modules/reporting/spec/features/menu_spec.rb
index ad472424c00..7813f0117ab 100644
--- a/modules/reporting/spec/features/menu_spec.rb
+++ b/modules/reporting/spec/features/menu_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe 'project menu' do
find("#main-menu #{test_selector('op-menu--item-action')}", text: 'Time and costs').click
# to make sure we're not seeing the project cost reports:
- expect(page).not_to have_text('Ponyo')
+ expect(page).to have_no_text('Ponyo')
end
end
diff --git a/modules/reporting/spec/features/my_time_spec.rb b/modules/reporting/spec/features/my_time_spec.rb
index e232bc3ef35..f3d6e42c4d1 100644
--- a/modules/reporting/spec/features/my_time_spec.rb
+++ b/modules/reporting/spec/features/my_time_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Cost report showing my own times', js: true do
+RSpec.describe 'Cost report showing my own times', :js do
let(:project) { create(:project) }
let(:user) { create(:admin) }
let(:user2) { create(:admin) }
@@ -25,7 +25,7 @@ RSpec.describe 'Cost report showing my own times', js: true do
let(:current_user) { user }
it 'shows my time' do
- expect(page).to have_selector('.report', text: '10.0')
+ expect(page).to have_css('.report', text: '10.0')
end
end
@@ -33,9 +33,9 @@ RSpec.describe 'Cost report showing my own times', js: true do
let(:current_user) { user2 }
it 'shows my time' do
- 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
+ expect(page).to have_no_css('.report')
+ expect(page).to have_css('.generic-table--no-results-title')
+ expect(page).to have_no_text '10.0' # 1 EUR x 10
end
end
end
diff --git a/modules/reporting/spec/features/permissions_spec.rb b/modules/reporting/spec/features/permissions_spec.rb
index d90e78bbf05..1567a9889fb 100644
--- a/modules/reporting/spec/features/permissions_spec.rb
+++ b/modules/reporting/spec/features/permissions_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative 'support/pages/cost_report_page'
-RSpec.describe 'Cost report calculations', js: true do
+RSpec.describe 'Cost report calculations', :js do
let(:project) { create(:project) }
let(:admin) { create(:admin) }
@@ -86,7 +86,7 @@ RSpec.describe 'Cost report calculations', js: true do
expect(page).to have_content '5.00 hours'
expect(page).to have_content '10.00 hours'
report_page.switch_to_type 'Translations'
- expect(page).to have_selector('td.units', text: '3.0 plural_unit', wait: 10)
+ expect(page).to have_css('td.units', text: '3.0 plural_unit', wait: 10)
end
end
@@ -107,9 +107,9 @@ RSpec.describe 'Cost report calculations', js: true do
it 'shows his own costs' do
expect(page).to have_content '5.00 hours'
- expect(page).not_to have_content '10.00 hours'
+ expect(page).to have_no_content '10.00 hours'
report_page.switch_to_type 'Translations'
- expect(page).to have_selector('td.units', text: '3.0 plural_unit', wait: 10)
+ expect(page).to have_css('td.units', text: '3.0 plural_unit', wait: 10)
end
end
@@ -121,11 +121,11 @@ RSpec.describe 'Cost report calculations', js: true do
it 'shows his own time only' do
expect(page).to have_content '5.00 hours'
- expect(page).not_to have_content '10.00 hours'
+ expect(page).to have_no_content '10.00 hours'
report_page.switch_to_type 'Translations'
- expect(page).to have_selector('.generic-table--no-results-title')
- expect(page).not_to have_selector('td.unit', text: '3.0 plural_unit')
+ expect(page).to have_css('.generic-table--no-results-title')
+ expect(page).to have_no_css('td.unit', text: '3.0 plural_unit')
end
end
@@ -136,11 +136,11 @@ RSpec.describe 'Cost report calculations', js: true do
end
it 'shows his own costs' do
- expect(page).to have_selector('.generic-table--no-results-title')
- expect(page).not_to have_content '5.00 hours'
- expect(page).not_to have_content '10.00 hours'
+ expect(page).to have_css('.generic-table--no-results-title')
+ expect(page).to have_no_content '5.00 hours'
+ expect(page).to have_no_content '10.00 hours'
report_page.switch_to_type 'Translations'
- expect(page).not_to have_selector('td.unit', text: '3.0 plural_unit')
+ expect(page).to have_no_css('td.unit', text: '3.0 plural_unit')
end
end
end
diff --git a/modules/reporting/spec/features/project_context_spec.rb b/modules/reporting/spec/features/project_context_spec.rb
index 806e57d9067..a28f9ffc94e 100644
--- a/modules/reporting/spec/features/project_context_spec.rb
+++ b/modules/reporting/spec/features/project_context_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative 'support/pages/cost_report_page'
-RSpec.describe 'Cost report project context', js: true do
+RSpec.describe 'Cost report project context', :js do
let(:project1) { create(:project) }
let(:project2) { create(:project) }
let(:admin) { create(:admin) }
@@ -16,9 +16,9 @@ RSpec.describe 'Cost report project context', js: true do
it "switches the project context when visiting another project's cost report" do
visit cost_reports_path(project1)
- expect(page).to have_selector('.ng-value-label', text: project1.name)
+ expect(page).to have_css('.ng-value-label', text: project1.name)
visit cost_reports_path(project2)
- expect(page).to have_selector('.ng-value-label', text: project2.name)
+ expect(page).to have_css('.ng-value-label', text: project2.name)
end
end
diff --git a/modules/reporting/spec/features/saving_spec.rb b/modules/reporting/spec/features/saving_spec.rb
index 564701d88b6..7351eb6bcb7 100644
--- a/modules/reporting/spec/features/saving_spec.rb
+++ b/modules/reporting/spec/features/saving_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative 'support/pages/cost_report_page'
-RSpec.describe 'Cost report saving', js: true do
+RSpec.describe 'Cost report saving', :js do
let(:project) { create(:project) }
let(:user) { create(:admin) }
@@ -21,9 +21,9 @@ RSpec.describe 'Cost report saving', js: true do
report_page.save as: 'Testreport'
# Check if the category is displayed
- expect(page).to have_selector('.op-sidemenu--title', text: I18n.t(:label_private_report_plural).upcase)
+ expect(page).to have_css('.op-sidemenu--title', text: I18n.t(:label_private_report_plural).upcase)
# Check if the new report is displayed
- expect(page).to have_selector('.op-sidemenu--item-title', text: 'Testreport')
+ expect(page).to have_css('.op-sidemenu--item-title', text: 'Testreport')
report_page.expect_column_element 'Work package'
report_page.expect_row_element 'Project'
@@ -38,9 +38,9 @@ RSpec.describe 'Cost report saving', js: true do
report_page.save as: 'Public report', public: true
# Check if the category is displayed
- expect(page).to have_selector('.op-sidemenu--title', text: I18n.t(:label_public_report_plural).upcase)
+ expect(page).to have_css('.op-sidemenu--title', text: I18n.t(:label_public_report_plural).upcase)
# Check if the new report is displayed
- expect(page).to have_selector('.op-sidemenu--item-title', text: 'Public report')
+ expect(page).to have_css('.op-sidemenu--item-title', text: 'Public report')
report_page.expect_column_element 'Work package'
report_page.expect_row_element 'Project'
@@ -54,7 +54,7 @@ RSpec.describe 'Cost report saving', js: true do
end
it 'cannot save reports' do
- expect(page).not_to have_selector('.buttons', text: 'Save')
+ expect(page).to have_no_css('.buttons', text: 'Save')
end
end
end
diff --git a/modules/reporting/spec/features/subproject_spec.rb b/modules/reporting/spec/features/subproject_spec.rb
index b28cac3c4df..8e32ca47c97 100644
--- a/modules/reporting/spec/features/subproject_spec.rb
+++ b/modules/reporting/spec/features/subproject_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Cost report in subproject', js: true do
+RSpec.describe 'Cost report in subproject', :js do
let!(:project) { create(:project) }
let!(:subproject) { create(:project, parent: project) }
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 86d81194e74..8bda2bb010b 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
@@ -39,19 +39,19 @@ module Components
end
def rows_count(count)
- expect(page).to have_selector('#result-table tbody tr', count:)
+ expect(page).to have_css('#result-table tbody tr', count:)
end
def expect_action_icon(icon, row, present: true)
if present
- expect(page).to have_selector("#{row_selector(row)} .icon-#{icon}")
+ expect(page).to have_css("#{row_selector(row)} .icon-#{icon}")
else
- expect(page).not_to have_selector("#{row_selector(row)} .icon-#{icon}")
+ expect(page).to have_no_css("#{row_selector(row)} .icon-#{icon}")
end
end
def expect_value(value, row)
- expect(page).to have_selector("#{row_selector(row)} .units", text: value)
+ expect(page).to have_css("#{row_selector(row)} .units", text: value)
end
def edit_time_entry(new_value, row)
@@ -78,7 +78,7 @@ module Components
SeleniumHubWaiter.wait
fill_in('cost_entry_units', with: new_value)
click_button 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
end
def delete_entry(row)
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 740ffd940b4..2cb80cbe168 100644
--- a/modules/reporting/spec/features/support/pages/cost_report_page.rb
+++ b/modules/reporting/spec/features/support/pages/cost_report_page.rb
@@ -14,7 +14,7 @@ module Pages
# Safeguard to force waiting for the form to be cleared
expect(page)
- .not_to have_selector('.group-by--selected-element')
+ .to have_no_css('.group-by--selected-element')
end
end
@@ -65,25 +65,25 @@ module Pages
def expect_row_element(text, present: true)
if present
- expect(page).to have_selector('#group-by--selected-rows .group-by--selected-element', text:)
+ expect(page).to have_css('#group-by--selected-rows .group-by--selected-element', text:)
else
- expect(page).not_to have_selector('#group-by--selected-rows .group-by--selected-element', text:)
+ expect(page).to have_no_css('#group-by--selected-rows .group-by--selected-element', text:)
end
end
def expect_column_element(text, present: true)
if present
- expect(page).to have_selector('#group-by--selected-columns .group-by--selected-element', text:)
+ expect(page).to have_css('#group-by--selected-columns .group-by--selected-element', text:)
else
- expect(page).not_to have_selector('#group-by--selected-columns .group-by--selected-element', text:)
+ expect(page).to have_no_css('#group-by--selected-columns .group-by--selected-element', text:)
end
end
def show_loading_indicator(present: true)
if present
- expect(page).to have_selector('#ajax-indicator')
+ expect(page).to have_css('#ajax-indicator')
else
- expect(page).not_to have_selector('#ajax-indicator')
+ expect(page).to have_no_css('#ajax-indicator')
end
end
diff --git a/modules/reporting/spec/features/top_menu_item_spec.rb b/modules/reporting/spec/features/top_menu_item_spec.rb
index f77915cf93e..dfac4711d12 100644
--- a/modules/reporting/spec/features/top_menu_item_spec.rb
+++ b/modules/reporting/spec/features/top_menu_item_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe 'Top menu items', :js do
def expect_no_menu_item(*labels)
within '.op-app-header' do
labels.each do |l|
- expect(page).not_to have_link(l)
+ expect(page).to have_no_link(l)
end
end
end
@@ -53,7 +53,7 @@ RSpec.describe 'Top menu items', :js do
# the click might be ignored
within '.op-app-menu--item_has-dropdown .op-app-menu--dropdown[aria-expanded=true]' do
- expect(page).not_to have_css('[style~=overflow]')
+ expect(page).to have_no_css('[style~=overflow]')
page.click_link(title)
end
diff --git a/modules/reporting/spec/features/update_cost_report_spec.rb b/modules/reporting/spec/features/update_cost_report_spec.rb
index 4550780b3ea..1c2ef81a5c3 100644
--- a/modules/reporting/spec/features/update_cost_report_spec.rb
+++ b/modules/reporting/spec/features/update_cost_report_spec.rb
@@ -29,7 +29,7 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
require_relative 'support/pages/cost_report_page'
-RSpec.describe "updating a cost report's cost type", js: true do
+RSpec.describe "updating a cost report's cost type", :js do
let(:project) { create(:project_with_types, members: { user => create(:project_role) }) }
let(:user) do
create(:admin)
diff --git a/modules/reporting/spec/features/update_entries_spec.rb b/modules/reporting/spec/features/update_entries_spec.rb
index e72d6f2a458..d3c2ae2fe84 100644
--- a/modules/reporting/spec/features/update_entries_spec.rb
+++ b/modules/reporting/spec/features/update_entries_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require_relative 'support/pages/cost_report_page'
require_relative 'support/components/cost_reports_base_table'
-RSpec.describe 'Updating entries within the cost report', js: true do
+RSpec.describe 'Updating entries within the cost report', :js do
let(:project) { create(:project) }
let(:user) { create(:admin, member_with_permissions: { project => %i[work_package_assigned] }) }
let(:work_package) { create(:work_package, project:) }
diff --git a/modules/reporting/spec/features/work_package_costlog_spec.rb b/modules/reporting/spec/features/work_package_costlog_spec.rb
index 85b8daa9e01..8bb034a5b29 100644
--- a/modules/reporting/spec/features/work_package_costlog_spec.rb
+++ b/modules/reporting/spec/features/work_package_costlog_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Cost report showing my own times', js: true do
+RSpec.describe 'Cost report showing my own times', :js do
let(:project) { create(:project) }
let(:user) do
create(:user, member_with_roles: { project => role })
@@ -38,9 +38,9 @@ RSpec.describe 'Cost report showing my own times', js: true do
end
within_window new_window do
- expect(page).to have_selector('#query_saved_name', text: 'New cost report')
+ expect(page).to have_css('#query_saved_name', text: 'New cost report')
expect(page).to have_field('values[work_package_id][]', with: work_package.id)
- expect(page).to have_selector('td.units', text: '10.0 Foobars')
+ expect(page).to have_css('td.units', text: '10.0 Foobars')
end
end
end
diff --git a/modules/reporting/spec/models/cost_query/chaining_spec.rb b/modules/reporting/spec/models/cost_query/chaining_spec.rb
index f75e9b9ed34..65cd5d4f238 100644
--- a/modules/reporting/spec/models/cost_query/chaining_spec.rb
+++ b/modules/reporting/spec/models/cost_query/chaining_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
let(:project) { create(:project) }
minimal_query
diff --git a/modules/reporting/spec/models/cost_query/group_by_spec.rb b/modules/reporting/spec/models/cost_query/group_by_spec.rb
index 7b683f20323..4fbb9c0d451 100644
--- a/modules/reporting/spec/models/cost_query/group_by_spec.rb
+++ b/modules/reporting/spec/models/cost_query/group_by_spec.rb
@@ -29,7 +29,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
require File.join(File.dirname(__FILE__), '..', '..', 'support', 'custom_field_filter')
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
let!(:type) { create(:type) }
let!(:project1) { create(:project_with_types, types: [type]) }
let!(:work_package1) { create(:work_package, project: project1, type:) }
diff --git a/modules/reporting/spec/models/cost_query/integration_spec.rb b/modules/reporting/spec/models/cost_query/integration_spec.rb
index ff836f13797..3af98ccf1df 100644
--- a/modules/reporting/spec/models/cost_query/integration_spec.rb
+++ b/modules/reporting/spec/models/cost_query/integration_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
minimal_query
let!(:project1) { create(:project_with_types) }
diff --git a/modules/reporting/spec/models/cost_query/operator_spec.rb b/modules/reporting/spec/models/cost_query/operator_spec.rb
index ab90a132ee1..0adef7845b0 100644
--- a/modules/reporting/spec/models/cost_query/operator_spec.rb
+++ b/modules/reporting/spec/models/cost_query/operator_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
minimal_query
let!(:project1) { create(:project, name: "project1", created_at: 5.minutes.ago) }
@@ -261,7 +261,7 @@ RSpec.describe CostQuery, reporting_query_helper: true do
# y/n seem are for filtering overridden costs
it "does y" do
- expect(query_on_entries('overridden_costs', 'y').size).to eq(Entry.all.count { |e| !(e.overridden_costs.nil?) })
+ expect(query_on_entries('overridden_costs', 'y').size).to eq(Entry.all.count { |e| !e.overridden_costs.nil? })
end
it "does n" do
diff --git a/modules/reporting/spec/models/cost_query/result_spec.rb b/modules/reporting/spec/models/cost_query/result_spec.rb
index 99036a6e615..28f6c3c3842 100644
--- a/modules/reporting/spec/models/cost_query/result_spec.rb
+++ b/modules/reporting/spec/models/cost_query/result_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
before do
create(:admin)
project = create(:project_with_types)
diff --git a/modules/reporting/spec/models/cost_query/walker_spec.rb b/modules/reporting/spec/models/cost_query/walker_spec.rb
index 0cb342f2597..a157fb26cb6 100644
--- a/modules/reporting/spec/models/cost_query/walker_spec.rb
+++ b/modules/reporting/spec/models/cost_query/walker_spec.rb
@@ -28,7 +28,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper")
-RSpec.describe CostQuery, reporting_query_helper: true do
+RSpec.describe CostQuery, :reporting_query_helper do
minimal_query
before do
diff --git a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/folder_files_file_ids_deep_query.rb b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/folder_files_file_ids_deep_query.rb
index 1ebe250557c..3da2b94fe5e 100644
--- a/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/folder_files_file_ids_deep_query.rb
+++ b/modules/storages/app/common/storages/peripherals/storage_interaction/nextcloud/folder_files_file_ids_deep_query.rb
@@ -30,7 +30,6 @@
module Storages::Peripherals::StorageInteraction::Nextcloud
class FolderFilesFileIdsDeepQuery
-
def self.call(storage:, path:)
::Storages::Peripherals::Registry
.resolve("queries.nextcloud.propfind")
diff --git a/modules/storages/app/validator/nextcloud_compatible_host_validator.rb b/modules/storages/app/validator/nextcloud_compatible_host_validator.rb
index 51cdcb0f080..206045b4ae8 100644
--- a/modules/storages/app/validator/nextcloud_compatible_host_validator.rb
+++ b/modules/storages/app/validator/nextcloud_compatible_host_validator.rb
@@ -150,10 +150,8 @@ class NextcloudCompatibleHostValidator < ActiveModel::EachValidator
end
def json_response_with_version?(response)
- (
- response['content-type'].split(';').first.strip.downcase == 'application/json' \
- && read_version(response)
- )
+ response['content-type'].split(';').first.strip.downcase == 'application/json' \
+ && read_version(response)
rescue JSON::ParserError
false
end
diff --git a/modules/storages/spec/components/project_storages/row_component_spec.rb b/modules/storages/spec/components/project_storages/row_component_spec.rb
index 8e0e706a773..b4bc90554af 100644
--- a/modules/storages/spec/components/project_storages/row_component_spec.rb
+++ b/modules/storages/spec/components/project_storages/row_component_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe Storages::ProjectStorages::RowComponent,
render_inline(component)
- expect(page).not_to have_css('a.icon.icon-group')
+ expect(page).to have_no_css('a.icon.icon-group')
expect(page).to have_css('a.icon.icon-edit')
expect(page).to have_css('a.icon.icon-delete')
end
diff --git a/modules/storages/spec/contracts/storages/storages/one_drive_contract_spec.rb b/modules/storages/spec/contracts/storages/storages/one_drive_contract_spec.rb
index d8ada082ce7..befc0362011 100644
--- a/modules/storages/spec/contracts/storages/storages/one_drive_contract_spec.rb
+++ b/modules/storages/spec/contracts/storages/storages/one_drive_contract_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe Storages::Storages::NextcloudContract, :storage_server_helpers, webmock: true do
+RSpec.describe Storages::Storages::NextcloudContract, :storage_server_helpers, :webmock do
let(:current_user) { create(:admin) }
let(:storage) { build(:one_drive_storage) }
diff --git a/modules/storages/spec/factories/storage_file_info_factory.rb b/modules/storages/spec/factories/storage_file_info_factory.rb
index a10cbdc0374..fee2918c3eb 100644
--- a/modules/storages/spec/factories/storage_file_info_factory.rb
+++ b/modules/storages/spec/factories/storage_file_info_factory.rb
@@ -30,7 +30,6 @@ FactoryBot.define do
factory :storage_file_info, class: '::Storages::StorageFileInfo' do
status { "OK" }
status_code { 200 }
- sequence(:id) { |n| "20000#{n}" }
sequence(:name) { |n| "file_name_#{n}.txt" }
last_modified_at { Time.zone.now }
created_at { Time.zone.now }
diff --git a/modules/storages/spec/factories/webdav_data_factory.rb b/modules/storages/spec/factories/webdav_data_factory.rb
index cda554278a4..02e50453f22 100644
--- a/modules/storages/spec/factories/webdav_data_factory.rb
+++ b/modules/storages/spec/factories/webdav_data_factory.rb
@@ -55,7 +55,7 @@ FactoryBot.define do
xml['oc'].size('20028269')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:27:36 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send(:"owner-display-name", url_safe_user_id)
+ xml['oc'].send(:'owner-display-name', url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -74,7 +74,7 @@ FactoryBot.define do
xml['oc'].size('6592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send(:"owner-display-name", url_safe_user_id)
+ xml['oc'].send(:'owner-display-name', url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -93,7 +93,7 @@ FactoryBot.define do
xml['oc'].size('8592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:43:26 GMT')
xml['oc'].permissions('RGDNV')
- xml['oc'].send(:"owner-display-name", url_safe_user_id)
+ xml['oc'].send(:'owner-display-name', url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -113,7 +113,7 @@ FactoryBot.define do
xml['d'].getcontenttype('text/markdown')
xml['d'].getlastmodified('Thu, 14 Jul 2022 08:42:15 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send(:"owner-display-name", url_safe_user_id)
+ xml['oc'].send(:'owner-display-name', url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -127,7 +127,7 @@ FactoryBot.define do
xml['d'].getcontenttype('application/pdf')
xml['d'].getlastmodified('Thu, 14 Jul 2022 08:42:15 GMT')
xml['oc'].permissions('RGDNV')
- xml['oc'].send(:"owner-display-name", url_safe_user_id)
+ xml['oc'].send(:'owner-display-name', url_safe_user_id)
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -156,7 +156,7 @@ FactoryBot.define do
xml['oc'].size('6592')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVCK')
- xml['oc'].send(:"owner-display-name", 'admin')
+ xml['oc'].send(:'owner-display-name', 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -176,7 +176,7 @@ FactoryBot.define do
xml['d'].getcontenttype('image/png')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send(:"owner-display-name", 'admin')
+ xml['oc'].send(:'owner-display-name', 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -190,7 +190,7 @@ FactoryBot.define do
xml['d'].getcontenttype('audio/ogg')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send(:"owner-display-name", 'admin')
+ xml['oc'].send(:'owner-display-name', 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
@@ -204,7 +204,7 @@ FactoryBot.define do
xml['d'].getcontenttype('text/plain')
xml['d'].getlastmodified('Fri, 28 Oct 2022 14:31:26 GMT')
xml['oc'].permissions('RGDNVW')
- xml['oc'].send(:"owner-display-name", 'admin')
+ xml['oc'].send(:'owner-display-name', 'admin')
end
xml['d'].status('HTTP/1.1 200 OK')
end
diff --git a/modules/storages/spec/features/admin_storages_spec.rb b/modules/storages/spec/features/admin_storages_spec.rb
index c164e675aaa..4fd4776462e 100644
--- a/modules/storages/spec/features/admin_storages_spec.rb
+++ b/modules/storages/spec/features/admin_storages_spec.rb
@@ -401,7 +401,7 @@ RSpec.describe 'Admin storages',
storage_delete_button.click
- expect(page).not_to have_text("Foo Nextcloud")
+ expect(page).to have_no_text("Foo Nextcloud")
expect(page).to have_text('Successful deletion.')
expect(page).to have_current_path(admin_settings_storages_path)
end
diff --git a/modules/storages/spec/features/create_file_links_spec.rb b/modules/storages/spec/features/create_file_links_spec.rb
index cad0b66038a..c7d23aa4422 100644
--- a/modules/storages/spec/features/create_file_links_spec.rb
+++ b/modules/storages/spec/features/create_file_links_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe 'Managing file links in work package', js: true, webmock: true do
+RSpec.describe 'Managing file links in work package', :js, :webmock do
let(:permissions) { %i(view_work_packages edit_work_packages view_file_links manage_file_links) }
let(:project) { create(:project) }
let(:current_user) { create(:user, member_with_permissions: { project => permissions }) }
diff --git a/modules/storages/spec/features/delete_project_storage_and_file_links_spec.rb b/modules/storages/spec/features/delete_project_storage_and_file_links_spec.rb
index b34711d1939..c5000e2e331 100644
--- a/modules/storages/spec/features/delete_project_storage_and_file_links_spec.rb
+++ b/modules/storages/spec/features/delete_project_storage_and_file_links_spec.rb
@@ -76,8 +76,8 @@ RSpec.describe 'Delete ProjectStorage with FileLinks', :js, :webmock do
page.find('.icon.icon-delete').click
# Danger zone confirmation flow
- expect(page).to have_selector('.form--section-title', text: "DELETE FILE STORAGE")
- expect(page).to have_selector('.danger-zone--warning', text: "Deleting a file storage is an irreversible action.")
+ expect(page).to have_css('.form--section-title', text: "DELETE FILE STORAGE")
+ expect(page).to have_css('.danger-zone--warning', text: "Deleting a file storage is an irreversible action.")
expect(page).to have_button('Delete', disabled: true)
# Cancel Confirmation
diff --git a/modules/storages/spec/features/manage_project_storage_spec.rb b/modules/storages/spec/features/manage_project_storage_spec.rb
index bb0012d0582..f022db3f0f5 100644
--- a/modules/storages/spec/features/manage_project_storage_spec.rb
+++ b/modules/storages/spec/features/manage_project_storage_spec.rb
@@ -153,14 +153,14 @@ RSpec.describe 'Activation of storages in projects', :js, :webmock, with_setting
expect(page).to have_current_path edit_project_settings_project_storage_path(project_id: project,
id: Storages::ProjectStorage.last)
expect(page).to have_text('Edit the file storage to this project')
- expect(page).not_to have_select('storages_project_storage_storage_id')
+ expect(page).to have_no_select('storages_project_storage_storage_id')
expect(page).to have_text(storage.name)
expect(page).to have_checked_field('storages_project_storage_project_folder_mode_manual')
expect(page).to have_text('Folder1')
# Change the project folder mode to inactive, project folder is hidden but retained
page.find_by_id('storages_project_storage_project_folder_mode_inactive').click
- expect(page).not_to have_text('Folder1')
+ expect(page).to have_no_text('Folder1')
page.click_button('Save')
# The list of enabled file storages should still contain Storage 1
@@ -207,7 +207,7 @@ RSpec.describe 'Activation of storages in projects', :js, :webmock, with_setting
it 'automatic option is not available' do
visit edit_project_settings_project_storage_path(project_id: project, id: project_storage)
- expect(page).not_to have_content('New folder with automatically managed permissions')
+ expect(page).to have_no_content('New folder with automatically managed permissions')
end
end
@@ -236,8 +236,8 @@ RSpec.describe 'Activation of storages in projects', :js, :webmock, with_setting
aggregate_failures 'select field options' do
expect(page).to have_select('storages_project_storage_storage_id',
options: ["#{configured_storage.name} (#{configured_storage.short_provider_type})"])
- expect(page).not_to have_select('storages_project_storage_storage_id',
- options: ["#{unconfigured_storage.name} (#{unconfigured_storage.short_provider_type})"])
+ expect(page).to have_no_select('storages_project_storage_storage_id',
+ options: ["#{unconfigured_storage.name} (#{unconfigured_storage.short_provider_type})"])
end
end
end
diff --git a/modules/storages/spec/features/show_file_links_spec.rb b/modules/storages/spec/features/show_file_links_spec.rb
index 2a126c669b0..449a675832f 100644
--- a/modules/storages/spec/features/show_file_links_spec.rb
+++ b/modules/storages/spec/features/show_file_links_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe 'Showing of file links in work package', js: true do
+RSpec.describe 'Showing of file links in work package', :js do
let(:permissions) { %i(view_work_packages edit_work_packages view_file_links manage_file_links) }
let(:project) { create(:project) }
let(:current_user) { create(:user, member_with_permissions: { project => permissions }) }
diff --git a/modules/storages/spec/features/storages_menu_links_spec.rb b/modules/storages/spec/features/storages_menu_links_spec.rb
index 0abeac527d1..3a076332ced 100644
--- a/modules/storages/spec/features/storages_menu_links_spec.rb
+++ b/modules/storages/spec/features/storages_menu_links_spec.rb
@@ -56,8 +56,8 @@ RSpec.describe 'Storage links in project menu', :js do
expect(page).to have_link(storage_configured_linked1.name, href: ensure_connection_path(project_storage1))
expect(page).to have_link(storage_configured_linked2.name, href: ensure_connection_path(project_storage2))
- expect(page).not_to have_link(storage_configured_unlinked.name)
- expect(page).not_to have_link(storage_unconfigured_linked.name)
+ expect(page).to have_no_link(storage_configured_unlinked.name)
+ expect(page).to have_no_link(storage_unconfigured_linked.name)
end
context 'if user is an admin but not a member of the project' do
@@ -66,10 +66,10 @@ RSpec.describe 'Storage links in project menu', :js do
it 'has no links to enabled storage' do
visit(project_path(id: project.id))
- expect(page).not_to have_link(storage_configured_linked1.name)
- expect(page).not_to have_link(storage_configured_linked2.name)
- expect(page).not_to have_link(storage_configured_unlinked.name)
- expect(page).not_to have_link(storage_unconfigured_linked.name)
+ expect(page).to have_no_link(storage_configured_linked1.name)
+ expect(page).to have_no_link(storage_configured_linked2.name)
+ expect(page).to have_no_link(storage_configured_unlinked.name)
+ expect(page).to have_no_link(storage_unconfigured_linked.name)
end
end
end
@@ -80,10 +80,10 @@ RSpec.describe 'Storage links in project menu', :js do
it 'has no links to enabled storages' do
visit(project_path(id: project.id))
- expect(page).not_to have_link(storage_configured_linked1.name)
- expect(page).not_to have_link(storage_configured_linked2.name)
- expect(page).not_to have_link(storage_configured_unlinked.name)
- expect(page).not_to have_link(storage_unconfigured_linked.name)
+ expect(page).to have_no_link(storage_configured_linked1.name)
+ expect(page).to have_no_link(storage_configured_linked2.name)
+ expect(page).to have_no_link(storage_configured_unlinked.name)
+ expect(page).to have_no_link(storage_unconfigured_linked.name)
end
end
end
diff --git a/modules/storages/spec/features/storages_module_spec.rb b/modules/storages/spec/features/storages_module_spec.rb
index 4e7fc9b13d4..5b17f8fe2d2 100644
--- a/modules/storages/spec/features/storages_module_spec.rb
+++ b/modules/storages/spec/features/storages_module_spec.rb
@@ -31,7 +31,7 @@
require 'spec_helper'
require_module_spec_helper
-RSpec.describe 'Storages module', js: true do
+RSpec.describe 'Storages module', :js do
current_user { create(:admin) }
let(:role) { create(:project_role, permissions: %i[manage_storages_in_project select_project_modules edit_project]) }
@@ -137,7 +137,7 @@ RSpec.describe 'Storages module', js: true do
end
it 'mustn\'t show the page' do
- expect(page).not_to have_text(I18n.t('storages.page_titles.project_settings.index'))
+ expect(page).to have_no_text(I18n.t('storages.page_titles.project_settings.index'))
end
end
end
diff --git a/modules/storages/spec/features/view_project_storage_members_spec.rb b/modules/storages/spec/features/view_project_storage_members_spec.rb
index e7a1647a7da..24a2f9d4438 100644
--- a/modules/storages/spec/features/view_project_storage_members_spec.rb
+++ b/modules/storages/spec/features/view_project_storage_members_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe 'Project storage members connection status view' do
visit project_settings_project_storage_members_path(project, project_storage_id: project_storage.id)
expect(page).to have_title('Sign in | OpenProject')
- expect(page).not_to have_text('Members connection status')
+ expect(page).to have_no_text('Members connection status')
end
it 'lists project members connection statuses' do
@@ -78,8 +78,8 @@ RSpec.describe 'Project storage members connection status view' do
[connected_no_permissions_user, 'User role has no storages permissions'],
[disconnected_user, 'Not connected. The user should login to the storage via the following link.']
].each do |(principal, status)|
- expect(page).to have_selector("#member-#{principal.id} .name", text: principal.name)
- expect(page).to have_selector("#member-#{principal.id} .status", text: status)
+ expect(page).to have_css("#member-#{principal.id} .name", text: principal.name)
+ expect(page).to have_css("#member-#{principal.id} .status", text: status)
end
end
end
diff --git a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
index 6245f42f644..c308a6c039a 100644
--- a/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
+++ b/modules/storages/spec/models/storages/nextcloud_storage_spec.rb
@@ -175,7 +175,7 @@ RSpec.describe Storages::NextcloudStorage do
context "with a new value of 'foo'" do
it "sets the value to 'foo'" do
- storage.public_send("#{attribute}=", 'foo')
+ storage.public_send(:"#{attribute}=", 'foo')
expect(storage.public_send(attribute)).to eq('foo')
end
end
diff --git a/modules/storages/spec/requests/api/v3/project_storages/project_storages_spec.rb b/modules/storages/spec/requests/api/v3/project_storages/project_storages_spec.rb
index d3ae60e18a2..3bb926c3fbf 100644
--- a/modules/storages/spec/requests/api/v3/project_storages/project_storages_spec.rb
+++ b/modules/storages/spec/requests/api/v3/project_storages/project_storages_spec.rb
@@ -34,7 +34,6 @@ RSpec.describe 'API v3 project storages resource', :webmock, content_type: :json
let(:view_permissions) { %i(view_work_packages view_file_links) }
- # rubocop:disable RSpec/IndexedLet
shared_let(:project1) { create(:project) }
shared_let(:project2) { create(:project) }
shared_let(:project3) { create(:project) }
@@ -47,8 +46,6 @@ RSpec.describe 'API v3 project storages resource', :webmock, content_type: :json
shared_let(:project_storage23) { create(:project_storage, project: project2, storage: storage3) }
shared_let(:project_storage21) { create(:project_storage, project: project2, storage: storage1) }
shared_let(:project_storage31) { create(:project_storage, project: project3, storage: storage1) }
- # rubocop:enable RSpec/IndexedLet
-
subject(:last_response) do
get path
end
@@ -271,6 +268,7 @@ RSpec.describe 'API v3 project storages resource', :webmock, content_type: :json
project_folder_mode: 'manual'
)
end
+
after(:all) do
project_storage12.update(
project_folder_id: nil,
diff --git a/modules/storages/spec/requests/api/v3/work_packages/work_packages_linked_filter_spec.rb b/modules/storages/spec/requests/api/v3/work_packages/work_packages_linked_filter_spec.rb
index 235c708cfb6..0808fbc1e67 100644
--- a/modules/storages/spec/requests/api/v3/work_packages/work_packages_linked_filter_spec.rb
+++ b/modules/storages/spec/requests/api/v3/work_packages/work_packages_linked_filter_spec.rb
@@ -35,7 +35,6 @@ RSpec.describe 'API v3 work packages resource with filters for linked storage fi
let(:file_link_permissions) { %i(view_work_packages view_file_links) }
- # rubocop:disable RSpec/IndexedLet
let(:role1) { create(:project_role, permissions: file_link_permissions) }
let(:role2) { create(:project_role, permissions: file_link_permissions) }
diff --git a/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb b/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb
index 68e4c11fc20..961a1650b3c 100644
--- a/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb
+++ b/modules/storages/spec/services/storages/group_folder_properties_sync_service_spec.rb
@@ -32,7 +32,6 @@ require 'spec_helper'
require_module_spec_helper
RSpec.describe Storages::GroupFolderPropertiesSyncService, :webmock do
- # rubocop:disable RSpec/IndexedLet
let(:group_users_response_body) do
<<~XML
<?xml version="1.0"?>
diff --git a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb
index d40cda34f6f..6aa33fa5f59 100644
--- a/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb
+++ b/modules/storages/spec/services/storages/project_storages/delete_service_spec.rb
@@ -31,7 +31,7 @@ require_module_spec_helper
require 'services/base_services/behaves_like_delete_service'
require_relative 'shared_event_gun_examples'
-RSpec.describe Storages::ProjectStorages::DeleteService, type: :model, webmock: true do
+RSpec.describe Storages::ProjectStorages::DeleteService, :webmock, type: :model do
context 'with records written to DB' do
let(:user) { create(:user) }
let(:role) { create(:project_role, permissions: [:manage_storages_in_project]) }
diff --git a/modules/storages/spec/support/components/file_picker_dialog.rb b/modules/storages/spec/support/components/file_picker_dialog.rb
index 22d060f1ecc..507ed9e6d92 100644
--- a/modules/storages/spec/support/components/file_picker_dialog.rb
+++ b/modules/storages/spec/support/components/file_picker_dialog.rb
@@ -55,7 +55,7 @@ module Components
def wait_for_folder_loaded
page.within(container) do
- expect(page).not_to have_selector('[data-test-selector="op-file-list--loading-indicator"]')
+ expect(page).to have_no_css('[data-test-selector="op-file-list--loading-indicator"]')
end
end
diff --git a/modules/team_planner/spec/features/team_planner_dates_spec.rb b/modules/team_planner/spec/features/team_planner_dates_spec.rb
index c7d4c2efb45..e429e6b3b75 100644
--- a/modules/team_planner/spec/features/team_planner_dates_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_dates_spec.rb
@@ -27,10 +27,9 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
-RSpec.describe 'Team planner working days',
- js: true,
+RSpec.describe 'Team planner working days', :js,
with_ee: %i[team_planner_view],
with_settings: { start_of_week: 1 } do
include_context 'with team planner full access'
@@ -49,37 +48,37 @@ RSpec.describe 'Team planner working days',
end
# Initially, in the "Work week" view, non working days are hidden
- expect(page).to have_selector('.fc-day-mon')
- expect(page).to have_selector('.fc-day-tue')
- expect(page).to have_selector('.fc-day-wed')
- expect(page).to have_selector('.fc-day-thu')
- expect(page).to have_selector('.fc-day-fri')
+ expect(page).to have_css('.fc-day-mon')
+ expect(page).to have_css('.fc-day-tue')
+ expect(page).to have_css('.fc-day-wed')
+ expect(page).to have_css('.fc-day-thu')
+ expect(page).to have_css('.fc-day-fri')
- expect(page).not_to have_selector('.fc-day-sat')
- expect(page).not_to have_selector('.fc-day-sun')
+ expect(page).to have_no_css('.fc-day-sat')
+ expect(page).to have_no_css('.fc-day-sun')
# In the "1-week" view, non working days are displayed but marked
team_planner.switch_view_mode '1-week'
- 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_css('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
+ expect(page).to have_css('.fc-day-sun.fc-non-working-day', minimum: 1)
- 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')
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-tue.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day')
+ expect(page).to have_no_css('.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_css('.fc-day-sat.fc-non-working-day', minimum: 1, wait: 10)
+ expect(page).to have_css('.fc-day-sun.fc-non-working-day', minimum: 1)
- 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')
+ expect(page).to have_no_css('.fc-day-mon.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-tue.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-wed.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-thu.fc-non-working-day')
+ expect(page).to have_no_css('.fc-day-fri.fc-non-working-day')
end
end
end
diff --git a/modules/team_planner/spec/features/team_planner_error_handling_spec.rb b/modules/team_planner/spec/features/team_planner_error_handling_spec.rb
index 409854c2f75..923ed716765 100644
--- a/modules/team_planner/spec/features/team_planner_error_handling_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_error_handling_spec.rb
@@ -27,10 +27,9 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
-RSpec.describe 'Team planner error handling',
- js: true,
+RSpec.describe 'Team planner error handling', :js,
with_settings: { start_of_week: 1 } do
include_context 'with team planner full access'
diff --git a/modules/team_planner/spec/features/team_planner_project_include_spec.rb b/modules/team_planner/spec/features/team_planner_project_include_spec.rb
index ec8c2f0f0f8..30391f5ef5a 100644
--- a/modules/team_planner/spec/features/team_planner_project_include_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_project_include_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require 'features/work_packages/project_include/project_include_shared_examples'
require_relative '../support/pages/team_planner'
-RSpec.describe 'Team planner project include', js: true, with_ee: %i[team_planner_view] do
+RSpec.describe 'Team planner project include', :js, with_ee: %i[team_planner_view] do
shared_let(:enabled_modules) { %w[work_package_tracking team_planner_view] }
shared_let(:permissions) do
%w[view_work_packages edit_work_packages add_work_packages
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 621efed667e..173b02309d9 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
@@ -27,9 +27,9 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
-RSpec.describe 'Team planner split view navigation', js: true, with_ee: %i[team_planner_view] do
+RSpec.describe 'Team planner split view navigation', :js, with_ee: %i[team_planner_view] do
include_context 'with team planner full access'
let!(:view) { create(:view_team_planner, query:) }
@@ -66,7 +66,7 @@ RSpec.describe 'Team planner split view navigation', js: true, with_ee: %i[team_
# Expect clicking on a work package does not open the details
page.find_test_selector('op-wp-single-card--content-subject', text: work_package1.subject).click
- expect(page).not_to have_current_path /team_planners\/new\/details\/#{work_package1.id}/
+ expect(page).to have_no_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/features/team_planner_upsale_spec.rb b/modules/team_planner/spec/features/team_planner_upsale_spec.rb
index 7662de8d59e..f93714bdcac 100644
--- a/modules/team_planner/spec/features/team_planner_upsale_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_upsale_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
RSpec.describe 'Team planner index', :js, :with_cuprite do
include_context 'with team planner full access'
diff --git a/modules/team_planner/spec/features/team_planner_view_modes_spec.rb b/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
index 8938e16cbf4..e7e786cc355 100644
--- a/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
@@ -27,9 +27,9 @@
#++
require 'spec_helper'
-require_relative './shared_context'
+require_relative 'shared_context'
-RSpec.describe 'Team planner', js: true, with_ee: %i[team_planner_view] do
+RSpec.describe 'Team planner', :js, with_ee: %i[team_planner_view] do
include_context 'with team planner full access'
it 'allows switching of view modes', with_settings: { working_days: [1, 2, 3, 4, 5] } do
@@ -43,22 +43,22 @@ RSpec.describe 'Team planner', js: true, with_ee: %i[team_planner_view] do
end
team_planner.expect_view_mode 'Work week'
- expect(page).to have_selector('.fc-timeline-slot-frame', count: 5)
+ expect(page).to have_css('.fc-timeline-slot-frame', count: 5)
# weekly: Expect 7 slots
team_planner.switch_view_mode '1-week'
- expect(page).to have_selector('.fc-timeline-slot-frame', count: 7)
+ expect(page).to have_css('.fc-timeline-slot-frame', count: 7)
# 2 weeks: expect 14 slots
team_planner.switch_view_mode '2-week'
- expect(page).to have_selector('.fc-timeline-slot-frame', count: 14)
+ expect(page).to have_css('.fc-timeline-slot-frame', count: 14)
start_of_week = Time.zone.today.beginning_of_week(:sunday)
start_date = start_of_week.strftime('%d %a')
end_date = (start_of_week + 13.days).strftime('%d %a')
- expect(page).to have_selector('.fc-timeline-slot', text: start_date)
- expect(page).to have_selector('.fc-timeline-slot', text: end_date)
+ expect(page).to have_css('.fc-timeline-slot', text: start_date)
+ expect(page).to have_css('.fc-timeline-slot', text: end_date)
# Click next button, advance one week
find('.fc-next-button').click
@@ -67,7 +67,7 @@ RSpec.describe 'Team planner', js: true, with_ee: %i[team_planner_view] do
start_date = start_of_week.strftime('%d %a')
end_date = (start_of_week + 13.days).strftime('%d %a')
- expect(page).to have_selector('.fc-timeline-slot', text: start_date)
- expect(page).to have_selector('.fc-timeline-slot', text: end_date)
+ expect(page).to have_css('.fc-timeline-slot', text: start_date)
+ expect(page).to have_css('.fc-timeline-slot', text: end_date)
end
end
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 197872ead1b..49e0867a465 100644
--- a/modules/team_planner/spec/support/components/add_existing_pane.rb
+++ b/modules/team_planner/spec/support/components/add_existing_pane.rb
@@ -46,11 +46,11 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector(selector)
+ expect(page).to have_no_selector(selector)
end
def expect_empty
- expect(page).to have_selector("[data-test-selector='op-add-existing-pane--empty-state']")
+ expect(page).to have_css("[data-test-selector='op-add-existing-pane--empty-state']")
end
def search(term)
@@ -60,10 +60,10 @@ module Components
def expect_result(work_package, visible: true)
if visible
expect(page)
- .to have_selector("[data-test-selector='op-add-existing-pane--wp-#{work_package.id}']", wait: 10)
+ .to have_css("[data-test-selector='op-add-existing-pane--wp-#{work_package.id}']", wait: 10)
else
expect(page)
- .not_to have_selector("[data-test-selector='op-add-existing-pane--wp-#{work_package.id}']")
+ .to have_no_css("[data-test-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 6037bd32b06..6baa9156782 100644
--- a/modules/team_planner/spec/support/pages/team_planner.rb
+++ b/modules/team_planner/spec/support/pages/team_planner.rb
@@ -46,7 +46,7 @@ module Pages
end
def expect_title(title = 'Unnamed team planner')
- expect(page).to have_selector('.editable-toolbar-title--input') { |node| node.value == title }
+ expect(page).to have_css('.editable-toolbar-title--input') { |node| node.value == title }
end
def save_as(name)
@@ -72,7 +72,7 @@ module Pages
end
def expect_view_mode(text)
- expect(page).to have_selector('[data-test-selector="op-team-planner--view-select-dropdown"]', text:)
+ expect(page).to have_css('[data-test-selector="op-team-planner--view-select-dropdown"]', text:)
param = {
'Work week' => :resourceTimelineWorkWeek,
@@ -131,17 +131,17 @@ module Pages
def expect_event(work_package, present: true)
if present
- expect(page).to have_selector('.fc-event', text: work_package.subject, wait: 10)
+ expect(page).to have_css('.fc-event', text: work_package.subject, wait: 10)
else
- expect(page).not_to have_selector('.fc-event', text: work_package.subject)
+ expect(page).to have_no_css('.fc-event', text: work_package.subject)
end
end
def expect_resizable(work_package, resizable: true)
if resizable
- expect(page).to have_selector('.fc-event.fc-event-resizable', text: work_package.subject, wait: 10)
+ expect(page).to have_css('.fc-event.fc-event-resizable', text: work_package.subject, wait: 10)
else
- expect(page).to have_selector('.fc-event:not(.fc-event-resizable)', text: work_package.subject, wait: 10)
+ expect(page).to have_css('.fc-event:not(.fc-event-resizable)', text: work_package.subject, wait: 10)
end
end
@@ -157,18 +157,18 @@ module Pages
def expect_delete_buttons_for(*queries)
queries.each do |query|
- expect(page).to have_selector "[data-test-selector='team-planner-remove-#{query.id}']"
+ expect(page).to have_css "[data-test-selector='team-planner-remove-#{query.id}']"
end
end
def expect_no_delete_buttons_for(*queries)
queries.each do |query|
- expect(page).not_to have_selector "[data-test-selector='team-planner-remove-#{query.id}']"
+ expect(page).to have_no_css "[data-test-selector='team-planner-remove-#{query.id}']"
end
end
def expect_view_not_rendered(query)
- expect(page).not_to have_selector 'td', text: query.name
+ expect(page).to have_no_css 'td', text: query.name
end
def expect_create_button
@@ -179,7 +179,7 @@ module Pages
def expect_no_create_button
within '.toolbar-items' do
- expect(page).not_to have_link text: 'Team planner'
+ expect(page).to have_no_link text: 'Team planner'
end
end
@@ -293,9 +293,9 @@ module Pages
drag_element_to(dropzone)
if expect_removable
- expect(page).to have_selector('span', text: I18n.t('js.team_planner.drag_here_to_remove'))
+ expect(page).to have_css('span', text: I18n.t('js.team_planner.drag_here_to_remove'))
else
- expect(page).to have_selector('span', text: I18n.t('js.team_planner.cannot_drag_here'))
+ expect(page).to have_css('span', text: I18n.t('js.team_planner.cannot_drag_here'))
end
drag_release
@@ -322,15 +322,15 @@ module Pages
end
def expect_wp_not_resizable(work_package)
- expect(page).to have_selector('.fc-event:not(.fc-event-resizable)', text: work_package.subject)
+ expect(page).to have_css('.fc-event:not(.fc-event-resizable)', text: work_package.subject)
end
def expect_wp_not_draggable(work_package)
- expect(page).to have_selector('.fc-event:not(.fc-event-draggable)', text: work_package.subject)
+ expect(page).to have_css('.fc-event:not(.fc-event-draggable)', text: work_package.subject)
end
def expect_no_menu_item(name)
- expect(page).not_to have_selector('.op-sidemenu--item-title', text: name)
+ expect(page).to have_no_css('.op-sidemenu--item-title', text: name)
end
def y_distance(from:, to:)
@@ -342,7 +342,7 @@ module Pages
end
def wait_for_loaded
- expect(page).to have_selector('.op-team-planner--wp-loading-skeleton')
+ expect(page).to have_css('.op-team-planner--wp-loading-skeleton')
retry_block do
raise "Should not be there" if page.has_selector?('.op-team-planner--wp-loading-skeleton')
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
index 0f234c54c8f..9a8c54ee6ac 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
@@ -71,7 +71,7 @@ module TwoFactorAuthentication
end
def channel=(value)
- super value.to_sym
+ super(value.to_sym)
end
def channel
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
index 94cd8f924ba..8c335727dce 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
@@ -61,7 +61,7 @@ module TwoFactorAuthentication
end
def totp
- @totp ||= ::ROTP::TOTP.new otp_secret, issuer: (Setting.app_title.presence || 'OpenProject')
+ @totp ||= ::ROTP::TOTP.new otp_secret, issuer: Setting.app_title.presence || 'OpenProject'
end
end
end
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
index 615438bb00e..3f6bff7fa0a 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
@@ -36,7 +36,7 @@ module OpenProject::TwoFactorAuthentication
@token = create_mobile_otp
end
- send "send_#{channel}"
+ send :"send_#{channel}"
end
def identifier
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
index a4840d225a0..eef8f1387ac 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
@@ -111,7 +111,7 @@ module OpenProject::TwoFactorAuthentication
##
# Select a matching language from the available languages
def build_localized_message(params)
- locale_key = (user.language.presence || Setting.default_language)
+ locale_key = user.language.presence || Setting.default_language
# Check if the translation exist or fall back to english
language =
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
index 45b439fddf9..a8233f4c85d 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
@@ -1,5 +1,5 @@
require_relative '../../spec_helper'
-require_relative './authentication_controller_shared_examples'
+require_relative 'authentication_controller_shared_examples'
RSpec.describe TwoFactorAuthentication::AuthenticationController, with_settings: { login_required?: true } do
let(:valid_credentials) do
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
index da243fc8bfe..3bdd4bb7c32 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
@@ -1,5 +1,5 @@
require_relative '../../../spec_helper'
-require_relative './../authentication_controller_shared_examples'
+require_relative '../authentication_controller_shared_examples'
RSpec.describe TwoFactorAuthentication::ForcedRegistration::TwoFactorDevicesController do
let(:user) { create(:user, login: 'foobar') }
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
index 2501f3256c9..61ecaf90aa4 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
@@ -1,5 +1,5 @@
require_relative '../../../spec_helper'
-require_relative './../authentication_controller_shared_examples'
+require_relative '../authentication_controller_shared_examples'
RSpec.describe TwoFactorAuthentication::My::RememberCookieController do
let(:user) { create(:user, login: 'foobar') }
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
index 09b463c8d99..7eb1064e14f 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
@@ -1,5 +1,5 @@
require_relative '../../../spec_helper'
-require_relative './../authentication_controller_shared_examples'
+require_relative '../authentication_controller_shared_examples'
RSpec.describe TwoFactorAuthentication::My::TwoFactorDevicesController do
let(:user) { create(:user, login: 'foobar') }
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
index abca0305a7d..6f61cf1cf84 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
@@ -1,5 +1,5 @@
require_relative '../../../spec_helper'
-require_relative './../authentication_controller_shared_examples'
+require_relative '../authentication_controller_shared_examples'
RSpec.describe TwoFactorAuthentication::Users::TwoFactorDevicesController do
let(:admin) { create(:admin) }
diff --git a/modules/two_factor_authentication/spec/features/account_activation_spec.rb b/modules/two_factor_authentication/spec/features/account_activation_spec.rb
index 6d29e707592..c89014c1a97 100644
--- a/modules/two_factor_authentication/spec/features/account_activation_spec.rb
+++ b/modules/two_factor_authentication/spec/features/account_activation_spec.rb
@@ -1,8 +1,7 @@
require_relative '../spec_helper'
-require_relative './shared_2fa_examples'
+require_relative 'shared_2fa_examples'
-RSpec.describe 'activating an invited account',
- js: true,
+RSpec.describe 'activating an invited account', :js,
with_settings: {
plugin_openproject_two_factor_authentication: { 'active_strategies' => [:developer] }
} do
@@ -33,7 +32,7 @@ RSpec.describe 'activating an invited account',
activate!
visit my_account_path
- expect(page).to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_css('.form--field-container', text: user.login)
end
end
@@ -51,20 +50,20 @@ RSpec.describe 'activating an invited account',
activate!
- expect(page).to have_selector('.op-toast.-success', text: 'Developer strategy generated the following one-time password:')
+ expect(page).to have_css('.op-toast.-success', text: 'Developer strategy generated the following one-time password:')
SeleniumHubWaiter.wait
fill_in I18n.t(:field_otp), with: sms_token
click_button I18n.t(:button_login)
visit my_account_path
- expect(page).to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_css('.form--field-container', text: user.login)
end
it 'handles faulty user input on two factor authentication' do
activate!
- expect(page).to have_selector('.op-toast.-success', text: 'Developer strategy generated the following one-time password:')
+ expect(page).to have_css('.op-toast.-success', text: 'Developer strategy generated the following one-time password:')
fill_in I18n.t(:field_otp), with: 'asdf' # faulty token
click_button I18n.t(:button_login)
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 5ea672922a0..205aa53ded8 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,9 +1,8 @@
require_relative '../spec_helper'
-RSpec.describe 'Admin 2FA management',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- } do
+RSpec.describe 'Admin 2FA management', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
+} do
let(:dialog) { Components::PasswordConfirmationDialog.new }
let(:user_password) { 'admin!' * 4 }
let(:other_user) { create(:user, login: 'bob') }
@@ -19,12 +18,12 @@ RSpec.describe 'Admin 2FA management',
it 'forbids the admin editing his own account' do
visit edit_user_path(admin, tab: :two_factor_authentication)
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.on-off-status.-disabled')
- expect(page).not_to have_selector('.generic-table--empty-row', wait: 1)
+ expect(page).to have_no_css('.generic-table--empty-row', wait: 1)
page.find('.admin--edit-section a').click
- expect(page).to have_selector('.generic-table--empty-row')
+ expect(page).to have_css('.generic-table--empty-row')
expect(page).to have_current_path my_2fa_devices_path
end
@@ -32,9 +31,9 @@ RSpec.describe 'Admin 2FA management',
visit edit_user_path(other_user, tab: :two_factor_authentication)
# Visit empty index
- expect(page).to have_selector('.generic-table--empty-row',
- text: I18n.t('two_factor_authentication.admin.no_devices_for_user'))
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.generic-table--empty-row',
+ text: I18n.t('two_factor_authentication.admin.no_devices_for_user'))
+ expect(page).to have_css('.on-off-status.-disabled')
# Visit inline create
find('.button', text: I18n.t('two_factor_authentication.admin.button_register_mobile_phone_for_user')).click
@@ -45,23 +44,23 @@ RSpec.describe 'Admin 2FA management',
click_button I18n.t(:button_continue)
# Enter valid phone number
- expect(page).to have_selector('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
+ expect(page).to have_css('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
SeleniumHubWaiter.wait
fill_in 'device_phone_number', with: '+49 123456789'
click_button I18n.t(:button_continue)
- expect(page).to have_selector('.mobile-otp--two-factor-device-row td', text: 'Mobile phone (bob) (+49 123456789)')
- expect(page).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
- expect(page).to have_selector('.on-off-status.-enabled')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row td', text: 'Mobile phone (bob) (+49 123456789)')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
+ expect(page).to have_css('.on-off-status.-enabled')
SeleniumHubWaiter.wait
# Delete the one
find('.two-factor--delete-button').click
dialog.confirm_flow_with user_password, should_fail: false
- expect(page).to have_selector('.mobile-otp--two-factor-device-row', count: 0)
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row', count: 0)
+ expect(page).to have_css('.on-off-status.-disabled')
expect(other_user.otp_devices.count).to eq 0
end
@@ -71,15 +70,15 @@ RSpec.describe 'Admin 2FA management',
it 'allows to delete all' do
visit edit_user_path(other_user, tab: :two_factor_authentication)
- expect(page).to have_selector('.mobile-otp--two-factor-device-row', count: 2)
- expect(page).to have_selector('.on-off-status.-enabled')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row', count: 2)
+ expect(page).to have_css('.on-off-status.-enabled')
find('.button', text: I18n.t('two_factor_authentication.admin.button_delete_all_devices')).click
page.driver.browser.switch_to.alert.accept
- expect(page).to have_selector('.generic-table--empty-row',
- text: I18n.t('two_factor_authentication.admin.no_devices_for_user'), wait: 20)
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.generic-table--empty-row',
+ text: I18n.t('two_factor_authentication.admin.no_devices_for_user'), wait: 20)
+ expect(page).to have_css('.on-off-status.-disabled')
end
end
end
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 5e6465c1b94..d0941661608 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,7 +1,7 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Generate 2FA backup codes', js: true, with_config: { '2fa': { active_strategies: [:developer] } } do
+RSpec.describe 'Generate 2FA backup codes', :js, with_config: { '2fa': { active_strategies: [:developer] } } do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -27,18 +27,18 @@ RSpec.describe 'Generate 2FA backup codes', js: true, with_config: { '2fa': { ac
end
# Confirm with wrong password
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.backup_codes.plural'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.backup_codes.plural'))
click_on I18n.t('two_factor_authentication.backup_codes.generate.title')
dialog.confirm_flow_with 'wrong_password', should_fail: true
# Confirm with correct password
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.backup_codes.plural'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.backup_codes.plural'))
click_on I18n.t('two_factor_authentication.backup_codes.generate.title')
dialog.confirm_flow_with user_password, should_fail: false
- expect(page).to have_selector('.op-toast.-warning')
+ expect(page).to have_css('.op-toast.-warning')
backup_codes.each do |code|
- expect(page).to have_selector('.two-factor-authentication--backup-codes li', text: code)
+ expect(page).to have_css('.two-factor-authentication--backup-codes li', text: code)
end
end
end
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 f11c4f69a4e..8fb4295fbd2 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,7 +1,7 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login with 2FA backup code', js: true, with_settings: {
+RSpec.describe 'Login with 2FA backup code', :js, with_settings: {
plugin_openproject_two_factor_authentication: { 'active_strategies' => [:developer] }
} do
let(:user_password) { 'bob!' * 4 }
@@ -19,7 +19,7 @@ RSpec.describe 'Login with 2FA backup code', js: true, with_settings: {
# Open other options
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'))
+ expect(page).to have_no_css('a', text: I18n.t('two_factor_authentication.backup_codes.enter_backup_code_title'))
end
end
@@ -31,7 +31,7 @@ RSpec.describe 'Login with 2FA backup code', js: true, with_settings: {
first_login_step
- expect(page).to have_selector('#toggle_resend_form', wait: 10)
+ expect(page).to have_css('#toggle_resend_form', wait: 10)
# Wait for the frontend to be loaded and initialized
# On downstream configurations, this might take longer than marionette selecting the element
@@ -44,13 +44,13 @@ RSpec.describe 'Login with 2FA backup code', js: true, with_settings: {
SeleniumHubWaiter.wait
find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'), wait: 2).click
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))
SeleniumHubWaiter.wait
fill_in 'backup_code', with: 'whatever'
click_on 'Submit'
# Expect failure
- expect(page).to have_selector('.op-toast.-error', text: I18n.t('two_factor_authentication.error_invalid_backup_code'))
+ expect(page).to have_css('.op-toast.-error', text: I18n.t('two_factor_authentication.error_invalid_backup_code'))
expect(page).to have_current_path signin_path
# Try again!
@@ -60,7 +60,7 @@ RSpec.describe 'Login with 2FA backup code', js: true, with_settings: {
SeleniumHubWaiter.wait
find('a', text: I18n.t('two_factor_authentication.login.enter_backup_code_title')).click
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.login.enter_backup_code_title'))
SeleniumHubWaiter.wait
fill_in 'backup_code', with: valid_backup_codes.first
click_on 'Submit'
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 3fb00516c0b..d98ce73f099 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
@@ -1,13 +1,12 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login with enforced 2FA',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: {
- 'active_strategies' => [:developer],
- 'enforced' => true
- }
- } do
+RSpec.describe 'Login with enforced 2FA', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ 'active_strategies' => [:developer],
+ 'enforced' => true
+ }
+} do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -37,7 +36,7 @@ RSpec.describe 'Login with enforced 2FA',
first_login_step
two_factor_step('whatever')
- expect(page).to have_selector('.op-toast.-error', text: I18n.t(:notice_account_otp_invalid))
+ expect(page).to have_css('.op-toast.-error', text: I18n.t(:notice_account_otp_invalid))
expect(page).to have_current_path signin_path
end
end
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 6740359dc65..14dafa042d5 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
@@ -1,12 +1,11 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login with 2FA device',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: {
- 'active_strategies' => [:developer]
- }
- } do
+RSpec.describe 'Login with 2FA device', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ 'active_strategies' => [:developer]
+ }
+} do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -36,7 +35,7 @@ RSpec.describe 'Login with 2FA device',
first_login_step
two_factor_step('whatever')
- expect(page).to have_selector('.op-toast.-error', text: I18n.t(:notice_account_otp_invalid))
+ expect(page).to have_css('.op-toast.-error', text: I18n.t(:notice_account_otp_invalid))
expect(page).to have_current_path signin_path
end
end
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 6b1acc6851a..b328710607c 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,7 +1,7 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login with no required OTP', js: true, with_config: { '2fa': { active_strategies: [:developer] } } do
+RSpec.describe 'Login with no required OTP', :js, 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 98e8a290a62..5b35d5e456e 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
@@ -1,10 +1,9 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login by switching 2FA device',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- } do
+RSpec.describe 'Login by switching 2FA device', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
+} do
let(:user_password) { 'bob!' * 4 }
let(:user) do
create(:user,
@@ -20,7 +19,7 @@ RSpec.describe 'Login by switching 2FA device',
it 'requests a 2FA and allows switching' do
first_login_step
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('input#otp')
SeleniumHubWaiter.wait
# Toggle device to TOTP
@@ -29,8 +28,8 @@ RSpec.describe 'Login by switching 2FA device',
SeleniumHubWaiter.wait
find(".button--link[value='#{device2.redacted_identifier}']").click
- expect(page).to have_selector('input#otp')
- expect(page).to have_selector('#submit_otp p', text: device2.redacted_identifier)
+ expect(page).to have_css('input#otp')
+ expect(page).to have_css('#submit_otp p', text: device2.redacted_identifier)
two_factor_step(device2.totp.now)
expect_logged_in
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 22d240c59ea..bb9dd288611 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,9 +1,8 @@
require_relative '../spec_helper'
-RSpec.describe 'My Account 2FA configuration',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
- } do
+RSpec.describe 'My Account 2FA configuration', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: { 'active_strategies' => %i[developer totp] }
+} do
let(:dialog) { Components::PasswordConfirmationDialog.new }
let(:user_password) { 'boB!4' * 4 }
let(:user) do
@@ -20,12 +19,12 @@ RSpec.describe 'My Account 2FA configuration',
it 'allows 2FA device management' do
# Visit empty index
visit my_2fa_devices_path
- expect(page).to have_selector('.generic-table--empty-row', text: I18n.t('two_factor_authentication.devices.not_existing'))
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.generic-table--empty-row', text: I18n.t('two_factor_authentication.devices.not_existing'))
+ expect(page).to have_css('.on-off-status.-disabled')
# Visit inline create
find('.wp-inline-create--add-link').click
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.add_new'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.add_new'))
expect(page).to have_current_path new_my_2fa_device_path
# Select SMS
@@ -36,7 +35,7 @@ RSpec.describe 'My Account 2FA configuration',
click_button I18n.t(:button_continue)
# Enter valid phone number
- expect(page).to have_selector('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
+ expect(page).to have_css('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
fill_in 'device_phone_number', with: '+49 123456789'
click_button I18n.t(:button_continue)
@@ -54,25 +53,25 @@ RSpec.describe 'My Account 2FA configuration',
click_button I18n.t(:button_continue)
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
- expect(page).to have_selector('input#otp')
- expect(page).to have_selector('.op-toast.-error',
- text: I18n.t('two_factor_authentication.devices.registration_failed_token_invalid'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
+ expect(page).to have_css('input#otp')
+ expect(page).to have_css('.op-toast.-error',
+ text: I18n.t('two_factor_authentication.devices.registration_failed_token_invalid'))
# Fill in correct token
fill_in 'otp', with: sms_token
click_button I18n.t(:button_continue)
# Assert that it exists and is default
- expect(page).to have_selector('.mobile-otp--two-factor-device-row td', text: 'Mobile phone (bob) (+49 123456789)')
- expect(page).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
- expect(page).to have_selector('.on-off-status.-enabled')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row td', text: 'Mobile phone (bob) (+49 123456789)')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
+ expect(page).to have_css('.on-off-status.-enabled')
# Create another one as totp
# Visit create button
visit my_2fa_devices_path
find('.toolbar-item .button', text: '2FA device').click
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.add_new'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.add_new'))
expect(page).to have_current_path new_my_2fa_device_path, ignore_query: true
# Select totp
@@ -83,8 +82,8 @@ RSpec.describe 'My Account 2FA configuration',
click_button I18n.t(:button_continue)
# Confirm token
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
+ expect(page).to have_css('input#otp')
device = user.otp_devices.order(:id).last
expect(device.identifier).to eq 'custom identifier'
@@ -94,11 +93,11 @@ RSpec.describe 'My Account 2FA configuration',
fill_in 'otp', with: device.totp.now
click_button I18n.t(:button_continue)
- expect(page).to have_selector('.mobile-otp--two-factor-device-row', count: 2)
+ expect(page).to have_css('.mobile-otp--two-factor-device-row', count: 2)
rows = page.all('.mobile-otp--two-factor-device-row')
- expect(rows[0]).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
- expect(rows[1]).to have_selector('.mobile-otp--two-factor-device-row td', text: 'custom identifier')
- expect(rows[1]).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 1)
+ expect(rows[0]).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
+ expect(rows[1]).to have_css('.mobile-otp--two-factor-device-row td', text: 'custom identifier')
+ expect(rows[1]).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 1)
device.reload
expect(device.active).to be_truthy
@@ -113,10 +112,10 @@ RSpec.describe 'My Account 2FA configuration',
find('.two-factor--mark-default-button').click
dialog.confirm_flow_with user_password, should_fail: false
- expect(page).to have_selector('.mobile-otp--two-factor-device-row', count: 2)
+ expect(page).to have_css('.mobile-otp--two-factor-device-row', count: 2)
rows = page.all('.mobile-otp--two-factor-device-row')
- expect(rows[0]).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 1)
- expect(rows[1]).to have_selector('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
+ expect(rows[0]).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 1)
+ expect(rows[1]).to have_css('.mobile-otp--two-factor-device-row td .icon-yes', count: 2)
device.reload
expect(device.default).to be_truthy
@@ -125,16 +124,16 @@ RSpec.describe 'My Account 2FA configuration',
rows[0].find('.two-factor--delete-button').click
dialog.confirm_flow_with user_password, should_fail: false
- expect(page).to have_selector('.mobile-otp--two-factor-device-row', count: 1)
- expect(page).to have_selector('.on-off-status.-enabled')
+ expect(page).to have_css('.mobile-otp--two-factor-device-row', count: 1)
+ expect(page).to have_css('.on-off-status.-enabled')
expect(user.otp_devices.count).to eq 1
# Delete the totp device
find('.two-factor--delete-button').click
dialog.confirm_flow_with user_password, should_fail: false
- expect(page).to have_selector('.generic-table--empty-row', text: I18n.t('two_factor_authentication.devices.not_existing'))
- expect(page).to have_selector('.on-off-status.-disabled')
+ expect(page).to have_css('.generic-table--empty-row', text: I18n.t('two_factor_authentication.devices.not_existing'))
+ expect(page).to have_css('.on-off-status.-disabled')
expect(user.otp_devices.count).to eq 0
end
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 89a4ccf050d..90a22195cec 100644
--- a/modules/two_factor_authentication/spec/features/password_change_spec.rb
+++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb
@@ -1,11 +1,10 @@
require_relative '../spec_helper'
-RSpec.describe 'Password change with OTP',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: {
- 'active_strategies' => [:developer]
- }
- } do
+RSpec.describe 'Password change with OTP', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ 'active_strategies' => [:developer]
+ }
+} do
let(:user_password) { 'boB&' * 4 }
let(:new_user_password) { '%obB' * 4 }
let(:user) do
@@ -32,7 +31,7 @@ RSpec.describe 'Password change with OTP',
end
# rubocop:enable RSpec/AnyInstance
- expect(page).to have_selector('h2', text: I18n.t(:button_change_password))
+ expect(page).to have_css('h2', text: I18n.t(:button_change_password))
within('#content') do
SeleniumHubWaiter.wait
fill_in('password', with: user_password)
@@ -42,7 +41,7 @@ RSpec.describe 'Password change with OTP',
end
if requires_otp
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('input#otp')
SeleniumHubWaiter.wait
fill_in 'otp', with: sms_token
click_button I18n.t(:button_login)
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 01e2e270ffe..af0ce3b0e71 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
@@ -1,13 +1,12 @@
require_relative '../../spec_helper'
require_relative '../shared_2fa_examples'
-RSpec.describe 'Login with 2FA remember cookie',
- js: true, with_settings: {
- plugin_openproject_two_factor_authentication: {
- active_strategies: [:developer],
- allow_remember_for_days: 30
- }
- } do
+RSpec.describe 'Login with 2FA remember cookie', :js, with_settings: {
+ plugin_openproject_two_factor_authentication: {
+ active_strategies: [:developer],
+ allow_remember_for_days: 30
+ }
+} do
let(:user_password) do
"user!user!"
end
@@ -27,7 +26,7 @@ RSpec.describe 'Login with 2FA remember cookie',
first_login_step
- expect(page).to have_selector('input#remember_me')
+ expect(page).to have_css('input#remember_me')
SeleniumHubWaiter.wait
check 'remember_me'
@@ -38,7 +37,7 @@ RSpec.describe 'Login with 2FA remember cookie',
def expect_no_autologin
first_login_step
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('input#otp')
expect_not_logged_in
end
@@ -51,7 +50,7 @@ RSpec.describe 'Login with 2FA remember cookie',
} do
it 'does not show the save form' do
first_login_step
- expect(page).not_to have_selector('input#remember_me')
+ expect(page).to have_no_css('input#remember_me')
end
end
@@ -61,8 +60,8 @@ RSpec.describe 'Login with 2FA remember cookie',
visit my_2fa_devices_path
find('.two-factor-authentication--remove-remember-cookie-link').click
- expect(page).to have_selector('.op-toast.-success')
- expect(page).not_to have_selector('.two-factor-authentication--remove-remember-cookie-link')
+ expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_no_css('.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 d28ff83ca27..998043be12e 100644
--- a/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
+++ b/modules/two_factor_authentication/spec/features/shared_2fa_examples.rb
@@ -9,7 +9,7 @@ def first_login_step
end
def two_factor_step(token)
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('input#otp')
SeleniumHubWaiter.wait
fill_in 'otp', with: token
click_button I18n.t(:button_login)
@@ -18,12 +18,12 @@ end
def expect_logged_in
visit my_account_path
SeleniumHubWaiter.wait
- expect(page).to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_css('.form--field-container', text: user.login)
end
def expect_not_logged_in
visit my_account_path
- expect(page).not_to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_no_css('.form--field-container', text: user.login)
end
RSpec.shared_examples 'login without 2FA' do
@@ -35,8 +35,8 @@ end
RSpec.shared_examples 'create enforced sms device' do
it do
- expect(page).to have_selector('.op-toast.-info',
- text: I18n.t('two_factor_authentication.forced_registration.required_to_add_device'))
+ expect(page).to have_css('.op-toast.-info',
+ text: I18n.t('two_factor_authentication.forced_registration.required_to_add_device'))
SeleniumHubWaiter.wait
# Create SMS device
@@ -46,15 +46,15 @@ RSpec.shared_examples 'create enforced sms device' do
click_on 'Continue'
# Expect error on invalid phone
- expect(page).to have_selector('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
+ expect(page).to have_css('#errorExplanation', text: 'Phone number must be of format +XX XXXXXXXXX')
SeleniumHubWaiter.wait
fill_in 'device_phone_number', with: '+49 123456789'
click_on 'Continue'
# Confirm page
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
- expect(page).to have_selector('input#otp')
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
+ expect(page).to have_css('input#otp')
SeleniumHubWaiter.wait
# Fill in wrong token
@@ -69,10 +69,10 @@ RSpec.shared_examples 'create enforced sms device' do
click_button I18n.t(:button_continue)
- expect(page).to have_selector('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
- expect(page).to have_selector('input#otp')
- expect(page).to have_selector('.op-toast.-error',
- text: I18n.t('two_factor_authentication.devices.registration_failed_token_invalid'))
+ expect(page).to have_css('h2', text: I18n.t('two_factor_authentication.devices.confirm_device'))
+ expect(page).to have_css('input#otp')
+ expect(page).to have_css('.op-toast.-error',
+ text: I18n.t('two_factor_authentication.devices.registration_failed_token_invalid'))
SeleniumHubWaiter.wait
# Fill in wrong token
diff --git a/modules/two_factor_authentication/spec/models/login_token_spec.rb b/modules/two_factor_authentication/spec/models/login_token_spec.rb
index a13e74cb045..558d85fb31e 100644
--- a/modules/two_factor_authentication/spec/models/login_token_spec.rb
+++ b/modules/two_factor_authentication/spec/models/login_token_spec.rb
@@ -1,6 +1,6 @@
require_relative '../spec_helper'
-RSpec.describe TwoFactorAuthentication::LoginToken, with_2fa_ee: true do
+RSpec.describe TwoFactorAuthentication::LoginToken, :with_2fa_ee do
shared_let(:user) { create(:user) }
let!(:token) { described_class.new user: }
diff --git a/modules/webhooks/spec/components/webhooks/outgoing/deliveries/table_component_spec.rb b/modules/webhooks/spec/components/webhooks/outgoing/deliveries/table_component_spec.rb
index 79c9bf3d785..d463d231b71 100644
--- a/modules/webhooks/spec/components/webhooks/outgoing/deliveries/table_component_spec.rb
+++ b/modules/webhooks/spec/components/webhooks/outgoing/deliveries/table_component_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Webhooks::Outgoing::Deliveries::TableComponent, type: :component
response_headers_node = page.find('pre.webhooks--response-headers')
aggregate_failures do
- expect(response_headers_node).not_to have_selector('b', text: 'evil')
+ expect(response_headers_node).to have_no_css('b', text: 'evil')
expect(response_headers_node.text).to include(header_name)
expect(response_headers_node.text).to include(header_value)
end
diff --git a/modules/webhooks/spec/features/manage_webhooks_spec.rb b/modules/webhooks/spec/features/manage_webhooks_spec.rb
index 679686f9aa1..4fe0679c5b5 100644
--- a/modules/webhooks/spec/features/manage_webhooks_spec.rb
+++ b/modules/webhooks/spec/features/manage_webhooks_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Manage webhooks through UI', js: true do
+RSpec.describe 'Manage webhooks through UI', :js do
before do
login_as user
end
@@ -20,7 +20,7 @@ RSpec.describe 'Manage webhooks through UI', js: true do
it 'allows the management flow' do
visit admin_outgoing_webhooks_path
- expect(page).to have_selector('.generic-table--empty-row')
+ expect(page).to have_css('.generic-table--empty-row')
# Visit inline create
find('.wp-inline-create--add-link').click
@@ -40,16 +40,16 @@ RSpec.describe 'Manage webhooks through UI', js: true do
# 1st webhook created
#
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_create))
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .name', text: 'My webhook')
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_create))
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .name', text: 'My webhook')
webhook = Webhooks::Webhook.last
expect(webhook.event_names).to eq %w(work_package:created)
expect(webhook.all_projects).to be_truthy
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .enabled .icon-yes')
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .selected_projects', text: '(all)')
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .events', text: 'Work packages')
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .description', text: webhook.description)
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .enabled .icon-yes')
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .selected_projects', text: '(all)')
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .events', text: 'Work packages')
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .description', text: webhook.description)
SeleniumHubWaiter.wait
# Edit this webhook
@@ -65,8 +65,8 @@ RSpec.describe 'Manage webhooks through UI', js: true do
find(".webhooks--selected-project-ids[value='#{project.id}']").set true
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
- expect(page).to have_selector('.webhooks--outgoing-webhook-row .name', text: 'My webhook')
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.webhooks--outgoing-webhook-row .name', text: 'My webhook')
webhook = Webhooks::Webhook.last
expect(webhook.event_names).to eq %w(work_package:updated)
expect(webhook.projects.all).to eq [project]
@@ -77,8 +77,8 @@ RSpec.describe 'Manage webhooks through UI', js: true do
find(".webhooks--outgoing-webhook-row-#{webhook.id} .icon-delete").click
page.driver.browser.switch_to.alert.accept
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_delete))
- expect(page).to have_selector('.generic-table--empty-row')
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_delete))
+ expect(page).to have_css('.generic-table--empty-row')
end
context 'with existing webhook' do
@@ -90,17 +90,17 @@ RSpec.describe 'Manage webhooks through UI', js: true do
SeleniumHubWaiter.wait
find('.webhooks--outgoing-webhook-row .name a', text: 'testing').click
- expect(page).to have_selector('.on-off-status.-enabled')
- expect(page).to have_selector('td.event_name', text: 'foo')
- expect(page).to have_selector('td.response_code', text: '200')
+ expect(page).to have_css('.on-off-status.-enabled')
+ expect(page).to have_css('td.event_name', text: 'foo')
+ expect(page).to have_css('td.response_code', text: '200')
# Open modal
SeleniumHubWaiter.wait
find('td.response_body a', text: 'Show').click
page.within('.spot-modal') do
- expect(page).to have_selector('.webhooks--response-headers strong', text: 'test')
- expect(page).to have_selector('.webhooks--response-body', text: log.response_body)
+ expect(page).to have_css('.webhooks--response-headers strong', text: 'test')
+ expect(page).to have_css('.webhooks--response-body', text: log.response_body)
end
end
@@ -123,7 +123,7 @@ RSpec.describe 'Manage webhooks through UI', js: true do
end
page.within('.spot-modal') do
- expect(page).to have_selector('.webhooks--response-body', text: matching_log.response_body)
+ expect(page).to have_css('.webhooks--response-body', text: matching_log.response_body)
click_button('Close')
end
end
diff --git a/modules/webhooks/spec/workers/attachment_webhook_job_spec.rb b/modules/webhooks/spec/workers/attachment_webhook_job_spec.rb
index 0a5e1c3c6c8..5ab63be0d1b 100644
--- a/modules/webhooks/spec/workers/attachment_webhook_job_spec.rb
+++ b/modules/webhooks/spec/workers/attachment_webhook_job_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe AttachmentWebhookJob, type: :job, webmock: true do
+RSpec.describe AttachmentWebhookJob, :webmock, type: :job do
shared_let(:user) { create(:admin) }
shared_let(:request_url) { "http://example.net/test/42" }
shared_let(:project) { create(:project, name: 'Foo Bar') }
diff --git a/modules/webhooks/spec/workers/project_webhook_job_spec.rb b/modules/webhooks/spec/workers/project_webhook_job_spec.rb
index beece23b1ec..1b1c8eada27 100644
--- a/modules/webhooks/spec/workers/project_webhook_job_spec.rb
+++ b/modules/webhooks/spec/workers/project_webhook_job_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe ProjectWebhookJob, type: :job, webmock: true do
+RSpec.describe ProjectWebhookJob, :webmock, type: :job do
shared_let(:user) { create(:admin) }
shared_let(:request_url) { "http://example.net/test/42" }
shared_let(:project) { create(:project, name: 'Foo Bar') }
diff --git a/modules/webhooks/spec/workers/time_entry_webhook_job_spec.rb b/modules/webhooks/spec/workers/time_entry_webhook_job_spec.rb
index 94089fe208d..6f82a98e39a 100644
--- a/modules/webhooks/spec/workers/time_entry_webhook_job_spec.rb
+++ b/modules/webhooks/spec/workers/time_entry_webhook_job_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe TimeEntryWebhookJob, type: :job, webmock: true do
+RSpec.describe TimeEntryWebhookJob, :webmock, type: :job do
shared_let(:user) { create(:admin) }
shared_let(:request_url) { "http://example.net/test/42" }
shared_let(:time_entry) { create(:time_entry, hours: 10) }
diff --git a/modules/webhooks/spec/workers/work_package_webhook_job_spec.rb b/modules/webhooks/spec/workers/work_package_webhook_job_spec.rb
index 58263c47110..260bd650950 100644
--- a/modules/webhooks/spec/workers/work_package_webhook_job_spec.rb
+++ b/modules/webhooks/spec/workers/work_package_webhook_job_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe WorkPackageWebhookJob, type: :model, webmock: true do
+RSpec.describe WorkPackageWebhookJob, :webmock, type: :model do
shared_let(:user) { create(:admin) }
shared_let(:title) { "Some workpackage subject" }
shared_let(:request_url) { "http://example.net/test/42" }
diff --git a/script/github_pr_errors b/script/github_pr_errors
index b9d0d94bc23..b6480c37ec6 100755
--- a/script/github_pr_errors
+++ b/script/github_pr_errors
@@ -200,7 +200,7 @@ end
def path_to_cache_key(path)
path
.gsub(/\?.*$/, '') # remove query parameter
- .gsub(/^#{GITHUB_API_OPENPROJECT_PREFIX}\/?/, '') # remove https://.../
+ .gsub(/^#{GITHUB_API_OPENPROJECT_PREFIX}\/?/o, '') # remove https://.../
.gsub(/\W/, '_') # transform non alphanum chars
end
diff --git a/spec/components/activities/item_component_spec.rb b/spec/components/activities/item_component_spec.rb
index 4a9d738e653..140b31cdf6f 100644
--- a/spec/components/activities/item_component_spec.rb
+++ b/spec/components/activities/item_component_spec.rb
@@ -99,7 +99,7 @@ RSpec.describe Activities::ItemComponent, type: :component do
render_inline(component)
expect(component.project_suffix).to be_nil
- expect(page).not_to have_css('.op-activity-list--item-title', text: '(Project: My project)')
+ expect(page).to have_no_css('.op-activity-list--item-title', text: '(Project: My project)')
end
it 'adds "(Subproject: ...)" suffix for activities of subprojects of the current project' do
@@ -118,7 +118,7 @@ RSpec.describe Activities::ItemComponent, type: :component do
allow(event.journal).to receive(:details).and_return(i_do_not_have_a_formatter_associated: ['old', 'new'])
render_inline(described_class.new(event:))
- expect(page).not_to have_css('.op-activity-list--item-detail')
+ expect(page).to have_no_css('.op-activity-list--item-detail')
end
end
diff --git a/spec/components/attribute_groups/attribute_key_value_component_spec.rb b/spec/components/attribute_groups/attribute_key_value_component_spec.rb
index 1c3557c785e..dfa482ee538 100644
--- a/spec/components/attribute_groups/attribute_key_value_component_spec.rb
+++ b/spec/components/attribute_groups/attribute_key_value_component_spec.rb
@@ -41,7 +41,7 @@ RSpec.describe AttributeGroups::AttributeKeyValueComponent, type: :component do
it "preserve html in the value if it's a safe string" do
render_inline(described_class.new(key: 'Attribute Key', value: '<div>Some value</div>'.html_safe))
- expect(page).not_to have_css('.attributes-key-value--value.-text', text: "<div>Some value</div>")
+ expect(page).to have_no_css('.attributes-key-value--value.-text', text: "<div>Some value</div>")
expect(page).to have_css('.attributes-key-value--value.-text', text: "Some value")
end
diff --git a/spec/components/settings/time_zone_setting_component_spec.rb b/spec/components/settings/time_zone_setting_component_spec.rb
index 9b43165bd5f..230102be93f 100644
--- a/spec/components/settings/time_zone_setting_component_spec.rb
+++ b/spec/components/settings/time_zone_setting_component_spec.rb
@@ -36,9 +36,9 @@ RSpec.describe Settings::TimeZoneSettingComponent, type: :component do
it "renders the timezones as options, grouping cities with the same identifier" do
subject
- expect(page).to have_selector("option[value=\"America/Los_Angeles\"]",
- text: "(UTC-08:00) Pacific Time (US & Canada)")
- expect(page).to have_selector("option[value=\"Europe/Berlin\"]", text: "(UTC+01:00) Berlin, Copenhagen, Stockholm")
- expect(page).to have_selector("option[value=\"Asia/Shanghai\"]", text: "(UTC+08:00) Beijing, Chongqing")
+ expect(page).to have_css("option[value=\"America/Los_Angeles\"]",
+ text: "(UTC-08:00) Pacific Time (US & Canada)")
+ expect(page).to have_css("option[value=\"Europe/Berlin\"]", text: "(UTC+01:00) Berlin, Copenhagen, Stockholm")
+ expect(page).to have_css("option[value=\"Asia/Shanghai\"]", text: "(UTC+08:00) Beijing, Chongqing")
end
end
diff --git a/spec/constants/settings/definition_spec.rb b/spec/constants/settings/definition_spec.rb
index 769bd6dc066..d43f4499b7b 100644
--- a/spec/constants/settings/definition_spec.rb
+++ b/spec/constants/settings/definition_spec.rb
@@ -368,12 +368,12 @@ RSpec.describe Settings::Definition, :settings_reset do
end
end
- it 'will not handle ENV vars for which no definition exists',
+ it 'does not handle ENV vars for which no definition exists',
with_env: { 'OPENPROJECT_BOGUS' => '1234' } do
expect(all[:bogus]).to be_nil
end
- it 'will handle ENV vars for definitions added after #all was called (e.g. in a module)',
+ it 'handles ENV vars for definitions added after #all was called (e.g. in a module)',
with_env: { 'OPENPROJECT_BOGUS' => '1' } do
described_class.add(:bogus, default: 0)
expect(all[:bogus].value).to eq 1
@@ -485,7 +485,6 @@ RSpec.describe Settings::Definition, :settings_reset do
context 'when overwritten from ENV',
with_env: { 'OPENPROJECT_SENDMAIL__LOCATION' => 'env location' } do
-
it 'overrides from ENV' do
reset(:sendmail_location)
expect(all[:sendmail_location].value).to eql 'env location'
diff --git a/spec/contracts/messages/create_contract_spec.rb b/spec/contracts/messages/create_contract_spec.rb
index 8345fe6dd95..77cce4ab669 100644
--- a/spec/contracts/messages/create_contract_spec.rb
+++ b/spec/contracts/messages/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Messages::CreateContract do
it_behaves_like 'message contract' do
diff --git a/spec/contracts/messages/update_contract_spec.rb b/spec/contracts/messages/update_contract_spec.rb
index c9293a92bdf..1cb7557c3b2 100644
--- a/spec/contracts/messages/update_contract_spec.rb
+++ b/spec/contracts/messages/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Messages::UpdateContract do
it_behaves_like 'message contract' do
diff --git a/spec/contracts/projects/update_contract_spec.rb b/spec/contracts/projects/update_contract_spec.rb
index 64aad7c0228..5e427df6e41 100644
--- a/spec/contracts/projects/update_contract_spec.rb
+++ b/spec/contracts/projects/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Projects::UpdateContract do
it_behaves_like 'project contract' do
diff --git a/spec/contracts/versions/create_contract_spec.rb b/spec/contracts/versions/create_contract_spec.rb
index 26f949b89e0..b06af305095 100644
--- a/spec/contracts/versions/create_contract_spec.rb
+++ b/spec/contracts/versions/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Versions::CreateContract do
it_behaves_like 'version contract' do
diff --git a/spec/contracts/versions/update_contract_spec.rb b/spec/contracts/versions/update_contract_spec.rb
index 87b29807855..a80ab2a32fe 100644
--- a/spec/contracts/versions/update_contract_spec.rb
+++ b/spec/contracts/versions/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Versions::UpdateContract do
it_behaves_like 'version contract' do
diff --git a/spec/contracts/views/create_contract_work_packages_table_spec.rb b/spec/contracts/views/create_contract_work_packages_table_spec.rb
index a1cc0ec0d5d..05167c53fb1 100644
--- a/spec/contracts/views/create_contract_work_packages_table_spec.rb
+++ b/spec/contracts/views/create_contract_work_packages_table_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Views::CreateContract do
it_behaves_like 'view contract' do
diff --git a/spec/contracts/views/update_contract_spec.rb b/spec/contracts/views/update_contract_spec.rb
index ff7bd42db51..613203a5e23 100644
--- a/spec/contracts/views/update_contract_spec.rb
+++ b/spec/contracts/views/update_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe Views::UpdateContract do
# TODO: this is just a stub to ensure that the type is not altered
diff --git a/spec/contracts/wiki_pages/create_contract_spec.rb b/spec/contracts/wiki_pages/create_contract_spec.rb
index df617bc18c8..a24d078eae4 100644
--- a/spec/contracts/wiki_pages/create_contract_spec.rb
+++ b/spec/contracts/wiki_pages/create_contract_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_contract_examples'
+require_relative 'shared_contract_examples'
RSpec.describe WikiPages::CreateContract do
it_behaves_like 'wiki page contract' do
diff --git a/spec/contracts/work_packages/create_note_contract_spec.rb b/spec/contracts/work_packages/create_note_contract_spec.rb
index dbe0d7a6c86..67270182fe8 100644
--- a/spec/contracts/work_packages/create_note_contract_spec.rb
+++ b/spec/contracts/work_packages/create_note_contract_spec.rb
@@ -73,7 +73,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
it 'is invalid' do
expect(contract.errors.symbols_for(:journal_notes))
- .to match_array([:error_unauthorized])
+ .to contain_exactly(:error_unauthorized)
end
end
end
@@ -89,7 +89,7 @@ RSpec.describe WorkPackages::CreateNoteContract do
it 'is invalid' do
expect(contract.errors.symbols_for(:subject))
- .to match_array([:error_readonly])
+ .to contain_exactly(:error_readonly)
end
end
end
diff --git a/spec/contracts/work_packages/shared_base_contract.rb b/spec/contracts/work_packages/shared_base_contract.rb
index 1fd08b2e205..2decb41b412 100644
--- a/spec/contracts/work_packages/shared_base_contract.rb
+++ b/spec/contracts/work_packages/shared_base_contract.rb
@@ -83,7 +83,7 @@ RSpec.shared_examples_for 'work package contract' do
it 'is not a valid assignee' do
error = I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
property: I18n.t('attributes.assignee'))
- expect(validated_contract.errors[:assigned_to]).to match_array [error]
+ expect(validated_contract.errors[:assigned_to]).to contain_exactly(error)
end
end
@@ -109,7 +109,7 @@ RSpec.shared_examples_for 'work package contract' do
it 'is not a valid responsible' do
error = I18n.t('api_v3.errors.validation.invalid_user_assigned_to_work_package',
property: I18n.t('attributes.responsible'))
- expect(validated_contract.errors[:responsible]).to match_array [error]
+ expect(validated_contract.errors[:responsible]).to contain_exactly(error)
end
end
diff --git a/spec/controllers/account_controller_spec.rb b/spec/controllers/account_controller_spec.rb
index 4450464cea9..0d7b01e0e75 100644
--- a/spec/controllers/account_controller_spec.rb
+++ b/spec/controllers/account_controller_spec.rb
@@ -30,8 +30,7 @@
require 'spec_helper'
-RSpec.describe AccountController,
- skip_2fa_stage: true do
+RSpec.describe AccountController, :skip_2fa_stage do
let(:user_hook_class) do
Class.new(OpenProject::Hook::ViewListener) do
attr_reader :registered_user, :first_login_user
@@ -340,7 +339,7 @@ RSpec.describe AccountController,
end
context 'with no provider' do
- it 'will redirect to default' do
+ it 'redirects to default' do
get :logout
expect(response).to redirect_to home_path
end
@@ -357,7 +356,7 @@ RSpec.describe AccountController,
context 'with direct login and redirecting callback',
with_config: { omniauth_direct_login_provider: 'foo' }, with_settings: { login_required?: true } do
- it 'will still call the callback' do
+ it 'stills call the callback' do
# Set the previous session
session[:foo] = 'bar'
@@ -369,7 +368,7 @@ RSpec.describe AccountController,
end
end
- it 'will call the callback' do
+ it 'calls the callback' do
# Set the previous session
session[:foo] = 'bar'
@@ -382,7 +381,7 @@ RSpec.describe AccountController,
end
context 'with a no-op callback' do
- it 'will redirect to default if the callback does nothing' do
+ it 'redirects to default if the callback does nothing' do
was_called = false
sso_provider[:single_sign_out_callback] = Proc.new do
was_called = true
@@ -397,7 +396,7 @@ RSpec.describe AccountController,
context 'with a provider that does not have slo_callback' do
let(:slo_callback) { nil }
- it 'will redirect to default if the callback does nothing' do
+ it 'redirects to default if the callback does nothing' do
get :logout
expect(response).to redirect_to home_path
end
diff --git a/spec/controllers/admin/settings/projects_settings_controller_spec.rb b/spec/controllers/admin/settings/projects_settings_controller_spec.rb
index a9df157a7a7..3149f313b69 100644
--- a/spec/controllers/admin/settings/projects_settings_controller_spec.rb
+++ b/spec/controllers/admin/settings/projects_settings_controller_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe Admin::Settings::ProjectsSettingsController do
expect(response).to be_successful
expect(response).to render_template 'admin/settings/projects_settings/show'
- expect(response.body).to have_selector "input[@name='settings[default_projects_modules][]'][@value='activity']"
+ expect(response.body).to have_css "input[@name='settings[default_projects_modules][]'][@value='activity']"
end
context 'without activated activity module' do
@@ -59,7 +59,7 @@ RSpec.describe Admin::Settings::ProjectsSettingsController do
expect(response).to be_successful
expect(response).to render_template 'admin/settings/projects_settings/show'
- expect(response.body).not_to have_selector "input[@name='settings[default_projects_modules][]'][@value='activity'][@checked='checked']"
+ expect(response.body).to have_no_css "input[@name='settings[default_projects_modules][]'][@value='activity'][@checked='checked']"
end
end
@@ -74,7 +74,7 @@ RSpec.describe Admin::Settings::ProjectsSettingsController do
expect(response).to be_successful
expect(response).to render_template 'admin/settings/projects_settings/show'
- expect(response.body).to have_selector "input[@name='settings[default_projects_modules][]'][@value='activity'][@checked='checked']"
+ expect(response.body).to have_css "input[@name='settings[default_projects_modules][]'][@value='activity'][@checked='checked']"
end
end
end
diff --git a/spec/controllers/admin_controller_spec.rb b/spec/controllers/admin_controller_spec.rb
index be8fd95e3e9..05807d28a85 100644
--- a/spec/controllers/admin_controller_spec.rb
+++ b/spec/controllers/admin_controller_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe AdminController do
let(:visible) { true }
it "shows the plugin in the overview" do
- expect(response.body).to have_selector('a.menu-block', text: plugin_name.capitalize)
+ expect(response.body).to have_css('a.menu-block', text: plugin_name.capitalize)
end
end
@@ -79,7 +79,7 @@ RSpec.describe AdminController do
let(:visible) { false }
it "does not show the plugin in the overview" do
- expect(response.body).not_to have_selector('a.menu-block', text: plugin_name.capitalize)
+ expect(response.body).to have_no_css('a.menu-block', text: plugin_name.capitalize)
end
end
end
@@ -90,8 +90,10 @@ RSpec.describe AdminController do
context 'with plugins' do
before do
- Redmine::Plugin.register :foo do end
- Redmine::Plugin.register :bar do end
+ Redmine::Plugin.register :foo do
+ end
+ Redmine::Plugin.register :bar do
+ end
end
it 'renders the plugins' do
@@ -100,8 +102,8 @@ RSpec.describe AdminController do
expect(response).to be_successful
expect(response).to render_template 'plugins'
- expect(response.body).to have_selector('td span', text: 'Foo')
- expect(response.body).to have_selector('td span', text: 'Bar')
+ expect(response.body).to have_css('td span', text: 'Foo')
+ expect(response.body).to have_css('td span', text: 'Bar')
end
end
diff --git a/spec/controllers/announcements_controller_spec.rb b/spec/controllers/announcements_controller_spec.rb
index f679e07b967..2a28c91619e 100644
--- a/spec/controllers/announcements_controller_spec.rb
+++ b/spec/controllers/announcements_controller_spec.rb
@@ -15,7 +15,10 @@ RSpec.describe AnnouncementsController do
get :edit
end
- it do expect(assigns(:announcement)).to eql announcement end
+ it do
+ expect(assigns(:announcement)).to eql announcement
+ end
+
it { expect(response).to be_successful }
end
diff --git a/spec/controllers/concerns/auth_source_sso_spec.rb b/spec/controllers/concerns/auth_source_sso_spec.rb
index 4fccf8a0e00..7842976bbc4 100644
--- a/spec/controllers/concerns/auth_source_sso_spec.rb
+++ b/spec/controllers/concerns/auth_source_sso_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe MyController,
- skip_2fa_stage: true do
+RSpec.describe MyController, :skip_2fa_stage do
render_views
let(:sso_config) do
diff --git a/spec/controllers/concerns/omniauth_login_spec.rb b/spec/controllers/concerns/omniauth_login_spec.rb
index 8a2c6dfe01e..de630119e77 100644
--- a/spec/controllers/concerns/omniauth_login_spec.rb
+++ b/spec/controllers/concerns/omniauth_login_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
# Concern is included into AccountController and depends on methods available there
-RSpec.describe AccountController,
- skip_2fa_stage: true do
+RSpec.describe AccountController, :skip_2fa_stage do
let(:omniauth_strategy) { double('Google Strategy', name: 'google') }
let(:omniauth_hash) do
OmniAuth::AuthHash.new(
diff --git a/spec/controllers/custom_styles_controller_spec.rb b/spec/controllers/custom_styles_controller_spec.rb
index 61baf2a6b8a..fec0579a1b8 100644
--- a/spec/controllers/custom_styles_controller_spec.rb
+++ b/spec/controllers/custom_styles_controller_spec.rb
@@ -170,7 +170,7 @@ RSpec.describe CustomStylesController do
context "when logo is present" do
let(:custom_style) { build(:custom_style_with_logo) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
@@ -231,7 +231,7 @@ RSpec.describe CustomStylesController do
context "when export logo is present" do
let(:custom_style) { build(:custom_style_with_export_logo) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
@@ -292,7 +292,7 @@ RSpec.describe CustomStylesController do
context "when export cover is present" do
let(:custom_style) { build(:custom_style_with_export_cover) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
@@ -353,7 +353,7 @@ RSpec.describe CustomStylesController do
context "when favicon is present" do
let(:custom_style) { build(:custom_style_with_favicon) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
@@ -414,7 +414,7 @@ RSpec.describe CustomStylesController do
context "when touch icon is present" do
let(:custom_style) { build(:custom_style_with_touch_icon) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
@@ -528,7 +528,7 @@ RSpec.describe CustomStylesController do
post :update_export_cover_text_color, params:
end
- it 'it is created' do
+ it 'is created' do
expect(response).to redirect_to action: :show
end
end
@@ -596,7 +596,7 @@ RSpec.describe CustomStylesController do
context "when logo is present" do
let(:custom_style) { build(:custom_style_with_logo) }
- it 'will send a file' do
+ it 'sends a file' do
expect(response).to have_http_status(:ok)
end
end
diff --git a/spec/controllers/enterprises_controller_spec.rb b/spec/controllers/enterprises_controller_spec.rb
index 7183bd84eda..9abf16a2bed 100644
--- a/spec/controllers/enterprises_controller_spec.rb
+++ b/spec/controllers/enterprises_controller_spec.rb
@@ -119,7 +119,7 @@ RSpec.describe EnterprisesController do
it 'still renders #show with form' do
expect(response).not_to render_template partial: 'enterprises/_current'
- expect(response.body).to have_selector '.upsale-benefits'
+ expect(response.body).to have_css '.upsale-benefits'
end
end
end
diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb
index 8e5353d6a3e..ee6ffff79be 100644
--- a/spec/controllers/forums_controller_spec.rb
+++ b/spec/controllers/forums_controller_spec.rb
@@ -64,7 +64,6 @@ RSpec.describe ForumsController do
end
end
-
context 'when login_required', with_settings: { login_required: true } do
it 'redirects to login' do
get :index, params: { project_id: 'not found' }
@@ -89,7 +88,6 @@ RSpec.describe ForumsController do
end
end
-
context 'when login_required', with_settings: { login_required: true } do
it 'redirects to login' do
get :show, params: { project_id: project.id, id: 1 }
@@ -159,7 +157,7 @@ RSpec.describe ForumsController do
end
end
- describe '#destroy', with_settings: { login_required: false } do
+ describe '#destroy', with_settings: { login_required: false } do
let(:forum_params) { { name: 'my forum', description: 'awesome forum' } }
before do
@@ -170,7 +168,7 @@ RSpec.describe ForumsController do
end
end
- it 'will request destruction and redirect' do
+ it 'requests destruction and redirect' do
expect(forum).to receive(:destroy)
delete :destroy, params: { project_id: project.id, id: 1 }
expect(response).to be_redirect
@@ -194,7 +192,7 @@ RSpec.describe ForumsController do
allow(@controller).to receive(:authorize).and_return(true)
end
- describe '#higher', with_settings: { login_required: false } do
+ describe '#higher', with_settings: { login_required: false } do
let(:move_to) { 'higher' }
before do
@@ -203,9 +201,13 @@ RSpec.describe ForumsController do
forum: { move_to: } }
end
- it do expect(forum_2.reload.position).to eq(1) end
+ it do
+ expect(forum_2.reload.position).to eq(1)
+ end
- it do expect(response).to be_redirect end
+ it do
+ expect(response).to be_redirect
+ end
it do
expect(response)
diff --git a/spec/controllers/homescreen_controller_spec.rb b/spec/controllers/homescreen_controller_spec.rb
index 4d4f1924f44..10486c02a9f 100644
--- a/spec/controllers/homescreen_controller_spec.rb
+++ b/spec/controllers/homescreen_controller_spec.rb
@@ -102,8 +102,8 @@ RSpec.describe HomescreenController do
end
it 'renders the text' do
- expect(response.body).to have_selector('[data-test-selector="op-widget-box--header"]',
- text: 'Woohoo!')
+ expect(response.body).to have_css('[data-test-selector="op-widget-box--header"]',
+ text: 'Woohoo!')
end
end
end
diff --git a/spec/controllers/messages_controller_spec.rb b/spec/controllers/messages_controller_spec.rb
index 267ecc97348..ed13eef02ec 100644
--- a/spec/controllers/messages_controller_spec.rb
+++ b/spec/controllers/messages_controller_spec.rb
@@ -54,7 +54,6 @@ RSpec.describe MessagesController, with_settings: { journal_aggregation_time_min
let(:project) { create(:public_project) }
let!(:message) { create(:message, forum:) }
-
context 'when login_required', with_settings: { login_required: true } do
it 'redirects to login' do
get :show, params: { project_id: project.id, id: message.id }
diff --git a/spec/controllers/my_controller_spec.rb b/spec/controllers/my_controller_spec.rb
index be410305c80..004a5a49a35 100644
--- a/spec/controllers/my_controller_spec.rb
+++ b/spec/controllers/my_controller_spec.rb
@@ -149,7 +149,7 @@ RSpec.describe MyController do
end
it "renders the 'Change password' menu entry" do
- expect(response.body).to have_selector('#menu-sidebar li a', text: 'Change password')
+ expect(response.body).to have_css('#menu-sidebar li a', text: 'Change password')
end
end
end
@@ -210,7 +210,7 @@ RSpec.describe MyController do
render_views
it 'renders auto hide popups checkbox' do
- expect(response.body).to have_selector('#my_account_form #pref_auto_hide_popups')
+ expect(response.body).to have_css('#my_account_form #pref_auto_hide_popups')
end
end
@@ -236,7 +236,7 @@ RSpec.describe MyController do
render_views
it "does not render 'Change password' menu entry" do
- expect(response.body).not_to have_selector('#menu-sidebar li a', text: 'Change password')
+ expect(response.body).to have_no_css('#menu-sidebar li a', text: 'Change password')
end
end
@@ -356,7 +356,7 @@ RSpec.describe MyController do
it 'list the tokens' do
get :access_token
- expect(response.body).to have_selector("#storage-oauth-token-#{token.id}")
+ expect(response.body).to have_css("#storage-oauth-token-#{token.id}")
end
it 'can remove the token' do
diff --git a/spec/controllers/news_controller_spec.rb b/spec/controllers/news_controller_spec.rb
index 0cb0e214c1e..f0ea7a49c2f 100644
--- a/spec/controllers/news_controller_spec.rb
+++ b/spec/controllers/news_controller_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe NewsController do
expect(response).to be_successful
expect(response).to render_template 'show'
- expect(response.body).to have_selector('h2', text: news.title)
+ expect(response.body).to have_css('h2', text: news.title)
end
it 'renders show with slug' do
@@ -79,7 +79,7 @@ RSpec.describe NewsController do
expect(response).to be_successful
expect(response).to render_template 'show'
- expect(response.body).to have_selector('h2', text: news.title)
+ expect(response.body).to have_css('h2', text: news.title)
end
it 'renders error if news item is not found' do
@@ -138,7 +138,7 @@ RSpec.describe NewsController do
expect(assigns(:news)).not_to be_nil
expect(assigns(:news)).to be_new_record
- expect(response.body).to have_selector('div.op-toast.-error', text: /1 error/)
+ expect(response.body).to have_css('div.op-toast.-error', text: /1 error/)
end
end
diff --git a/spec/controllers/projects_settings_menu_controller_spec.rb b/spec/controllers/projects_settings_menu_controller_spec.rb
index 4db024c3d74..380e4acc2e5 100644
--- a/spec/controllers/projects_settings_menu_controller_spec.rb
+++ b/spec/controllers/projects_settings_menu_controller_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe Projects::Settings::ModulesController, 'menu' do
it do
get('show', params:)
- expect(response.body).not_to have_selector selector
+ expect(response.body).to have_no_selector selector
end
end
diff --git a/spec/controllers/repositories_controller_spec.rb b/spec/controllers/repositories_controller_spec.rb
index af0670bf6c6..2961d05f479 100644
--- a/spec/controllers/repositories_controller_spec.rb
+++ b/spec/controllers/repositories_controller_spec.rb
@@ -165,7 +165,7 @@ RSpec.describe RepositoriesController do
context 'requested by an authorized user' do
let(:role) do
create(:project_role, permissions: %i[browse_repository
- view_commit_author_statistics])
+ view_commit_author_statistics])
end
it 'is successful' do
@@ -222,7 +222,7 @@ RSpec.describe RepositoriesController do
describe 'requested by a user with view_commit_author_statistics permission' do
let(:role) do
create(:project_role, permissions: %i[browse_repository
- view_commit_author_statistics])
+ view_commit_author_statistics])
end
it 'show the commits per author graph' do
@@ -242,7 +242,7 @@ RSpec.describe RepositoriesController do
shared_examples 'renders the repository title' do |active_breadcrumb|
it do
expect(response).to be_successful
- expect(response.body).to have_selector('.repository-breadcrumbs', text: active_breadcrumb)
+ expect(response.body).to have_css('.repository-breadcrumbs', text: active_breadcrumb)
end
end
@@ -311,7 +311,7 @@ RSpec.describe RepositoriesController do
expect(response.code).to eq('200')
expect(response).to render_template partial: 'repositories/_checkout_instructions'
- expect(response.body).to have_selector("#repository-checkout-url[value='#{expected_path}']")
+ expect(response.body).to have_css("#repository-checkout-url[value='#{expected_path}']")
end
end
end
diff --git a/spec/controllers/sys_controller_spec.rb b/spec/controllers/sys_controller_spec.rb
index cf95adbbb9d..47bbff6619e 100644
--- a/spec/controllers/sys_controller_spec.rb
+++ b/spec/controllers/sys_controller_spec.rb
@@ -519,7 +519,7 @@ RSpec.describe SysController, with_settings: { sys_api_enabled: true } do
it 'uses cache' do
allow(Rails.cache).to receive(:fetch).and_call_original
- expect(Rails.cache).to receive(:fetch).with(cache_key, expires_in: cache_expiry) \
+ expect(Rails.cache).to receive(:fetch).with(cache_key, expires_in: cache_expiry)
.and_return(Marshal.dump(valid_user.id.to_s))
controller.send(:cached_user_login, valid_user.login, valid_user_password)
end
@@ -635,7 +635,7 @@ RSpec.describe SysController, with_settings: { sys_api_enabled: true } do
context 'storage never updated before' do
it 'updates the storage' do
- expect(repository.required_storage_bytes).to be == 0
+ expect(repository.required_storage_bytes).to eq 0
request_storage
expect(response.code).to eq('200')
diff --git a/spec/controllers/types_controller_spec.rb b/spec/controllers/types_controller_spec.rb
index 771619ccda7..89121aae9f3 100644
--- a/spec/controllers/types_controller_spec.rb
+++ b/spec/controllers/types_controller_spec.rb
@@ -217,8 +217,8 @@ RSpec.describe TypesController do
it { expect(response).to be_successful }
it { expect(response).to render_template 'edit' }
it { expect(response).to render_template 'types/form/_settings' }
- it { expect(response.body).to have_selector "input[@name='type[name]'][@value='My type']" }
- it { expect(response.body).to have_selector "input[@name='type[is_milestone]'][@value='1'][@checked='checked']" }
+ it { expect(response.body).to have_css "input[@name='type[name]'][@value='My type']" }
+ it { expect(response.body).to have_css "input[@name='type[is_milestone]'][@value='1'][@checked='checked']" }
end
describe 'GET edit projects' do
@@ -238,7 +238,7 @@ RSpec.describe TypesController do
it { expect(response).to render_template 'types/form/_projects' }
it {
- expect(response.body).to have_selector "input[@name='type[project_ids][]'][@value='#{project.id}'][@checked='checked']"
+ expect(response.body).to have_css "input[@name='type[project_ids][]'][@value='#{project.id}'][@checked='checked']"
}
end
diff --git a/spec/controllers/wiki_controller_spec.rb b/spec/controllers/wiki_controller_spec.rb
index 2a4c8d9436f..43ece7d6c8c 100644
--- a/spec/controllers/wiki_controller_spec.rb
+++ b/spec/controllers/wiki_controller_spec.rb
@@ -1034,7 +1034,7 @@ RSpec.describe WikiController do
get 'show', params: { id: @other_wiki_menu_item.name, project_id: project.id }
expect(response).to be_successful
- expect(response.body).to have_selector('.main-menu--children a.selected', count: 0)
+ expect(response.body).to have_css('.main-menu--children a.selected', count: 0)
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item"
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected", false
@@ -1073,7 +1073,7 @@ RSpec.describe WikiController do
get 'show', params: { id: child_page.slug, project_id: project.id }
expect(response).to be_successful
- expect(response.body).to have_selector('#main-menu a.selected', count: 1)
+ expect(response.body).to have_css('#main-menu a.selected', count: 1)
assert_select "#main-menu a.#{@wiki_menu_item.menu_identifier}-menu-item.selected"
end
diff --git a/spec/controllers/work_packages/moves_controller_spec.rb b/spec/controllers/work_packages/moves_controller_spec.rb
index 3539fe9e0cc..b748baf3320 100644
--- a/spec/controllers/work_packages/moves_controller_spec.rb
+++ b/spec/controllers/work_packages/moves_controller_spec.rb
@@ -481,8 +481,8 @@ RSpec.describe WorkPackages::MovesController, with_settings: { journal_aggregati
end
it 'reports the one child work package' do
- expect(response.body).to have_selector "a.work_package", count: 2
- expect(response.body).to have_selector ".contextual-info", text: '(+ One descendant work package)'
+ expect(response.body).to have_css "a.work_package", count: 2
+ expect(response.body).to have_css ".contextual-info", text: '(+ One descendant work package)'
end
end
diff --git a/spec/factories/custom_style_factory.rb b/spec/factories/custom_style_factory.rb
index e58d6ef6c4d..79835c67d15 100644
--- a/spec/factories/custom_style_factory.rb
+++ b/spec/factories/custom_style_factory.rb
@@ -32,7 +32,7 @@ FactoryBot.define do
factory :custom_style_with_logo, class: 'CustomStyle' do
logo do
Rack::Test::UploadedFile.new(
- Rails.root.join('spec', 'support', 'custom_styles', 'logos', 'logo_image.png')
+ Rails.root.join("spec/support/custom_styles/logos/logo_image.png")
)
end
end
@@ -56,7 +56,7 @@ FactoryBot.define do
factory :custom_style_with_favicon, class: 'CustomStyle' do
favicon do
Rack::Test::UploadedFile.new(
- Rails.root.join('spec', 'support', 'custom_styles', 'favicons', 'favicon_image.png')
+ Rails.root.join("spec/support/custom_styles/favicons/favicon_image.png")
)
end
end
@@ -64,7 +64,7 @@ FactoryBot.define do
factory :custom_style_with_touch_icon, class: 'CustomStyle' do
touch_icon do
Rack::Test::UploadedFile.new(
- Rails.root.join('spec', 'support', 'custom_styles', 'touch_icons', 'touch_icon_image.png')
+ Rails.root.join("spec/support/custom_styles/touch_icons/touch_icon_image.png")
)
end
end
diff --git a/spec/factories/file_factory.rb b/spec/factories/file_factory.rb
index fc7766cec11..120afd45e3f 100644
--- a/spec/factories/file_factory.rb
+++ b/spec/factories/file_factory.rb
@@ -37,7 +37,7 @@ FactoryBot.define do
name { 'textfile.txt' }
initialize_with do
- new "#{Rails.root}/spec/fixtures/files/#{name}"
+ new "#{Rails.root.join("spec/fixtures/files/#{name}")}"
end
end
diff --git a/spec/factories/ldap_auth_source_factory.rb b/spec/factories/ldap_auth_source_factory.rb
index 829a529f32c..ff93571f7f8 100644
--- a/spec/factories/ldap_auth_source_factory.rb
+++ b/spec/factories/ldap_auth_source_factory.rb
@@ -30,7 +30,7 @@ FactoryBot.define do
factory :ldap_auth_source, class: 'LdapAuthSource' do
name { 'Test LDAP LdapAuthSource' }
host { '127.0.0.1' }
- port { 225 } # a reserved port, should not be in use
+ port { 225 } # a reserved port, should not be in use
attr_login { 'uid' }
tls_mode { 'plain_ldap' }
base_dn { 'dc=example,dc=com' }
diff --git a/spec/factories/type_factory.rb b/spec/factories/type_factory.rb
index 9126ed24f03..86966a33217 100644
--- a/spec/factories/type_factory.rb
+++ b/spec/factories/type_factory.rb
@@ -50,7 +50,7 @@ FactoryBot.define do
query.add_filter(evaluator.relation_filter.to_s, '=', [Queries::Filters::TemplatedValue::KEY])
query.save
t.attribute_groups = t.default_attribute_groups + [["Embedded table for #{evaluator.relation_filter}",
- ["query_#{query.id}".to_sym]]]
+ [:"query_#{query.id}"]]]
end
end
end
diff --git a/spec/features/a11y/work_packages/work_package_query_spec.rb b/spec/features/a11y/work_packages/work_package_query_spec.rb
index 28da53c53e9..df2d0403e1c 100644
--- a/spec/features/a11y/work_packages/work_package_query_spec.rb
+++ b/spec/features/a11y/work_packages/work_package_query_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Work package index accessibility', selenium: true do
+RSpec.describe 'Work package index accessibility', :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package) { create(:work_package, project:) }
@@ -51,7 +51,7 @@ RSpec.describe 'Work package index accessibility', selenium: true do
work_packages_page.ensure_loaded
end
- describe 'Sort link', js: true do
+ describe 'Sort link', :js do
before { visit_index_page }
def click_sort_ascending_link
@@ -153,7 +153,7 @@ RSpec.describe 'Work package index accessibility', selenium: true do
end
end
- describe 'hotkeys', js: true do
+ describe 'hotkeys', :js do
let!(:another_work_package) do
create(:work_package,
project:)
@@ -172,8 +172,8 @@ RSpec.describe 'Work package index accessibility', selenium: true do
end
it 'navigates with J and K' do
- expect(page).to have_selector(".wp-row-#{work_package.id}")
- expect(page).to have_selector(".wp-row-#{another_work_package.id}")
+ expect(page).to have_css(".wp-row-#{work_package.id}")
+ expect(page).to have_css(".wp-row-#{another_work_package.id}")
find('body').native.send_keys('j')
expect(page).to have_focus_on(first_row_selector)
@@ -218,14 +218,14 @@ RSpec.describe 'Work package index accessibility', selenium: true do
element = find(target_link)
element.native.send_keys(:escape)
- expect(page).not_to have_selector(target_link)
+ expect(page).to have_no_selector(target_link)
# Expect reset focus on originating element
expect(page).to have_focus_on(source_link) if sets_focus
end
end
- describe 'work package context menu', js: true do
+ describe 'work package context menu', :js do
it_behaves_like 'context menu' do
let(:target_link) { '#work-package-context-menu a.detailsViewMenuItem' }
let(:source_link) { '.work-package-table--container tr.issue td.id a' }
diff --git a/spec/features/activities/activity_page_navigation_spec.rb b/spec/features/activities/activity_page_navigation_spec.rb
index 16fef42a400..34d34d6375b 100644
--- a/spec/features/activities/activity_page_navigation_spec.rb
+++ b/spec/features/activities/activity_page_navigation_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe 'Activity page navigation', :js, :with_cuprite do
# Still on the same page. Filters applied. subproject work package created
# 45 days ago should not be visible anymore
expect(page)
- .not_to have_link(text: /#{subproject_older_work_package.subject}/)
+ .to have_no_link(text: /#{subproject_older_work_package.subject}/)
end
shared_examples 'subprojects checkbox state is preserved' do
@@ -113,7 +113,7 @@ RSpec.describe 'Activity page navigation', :js, :with_cuprite do
.to have_link(text: /#{project_work_package.subject}/)
# work packages for subproject is not visible anymore
expect(page)
- .not_to have_link(text: /#{subproject_work_package.subject}/)
+ .to have_no_link(text: /#{subproject_work_package.subject}/)
end
click_link('Previous')
@@ -126,7 +126,7 @@ RSpec.describe 'Activity page navigation', :js, :with_cuprite do
# work packages for subproject still not visible
expect(page)
- .not_to have_link(text: /#{subproject_older_work_package.subject}/)
+ .to have_no_link(text: /#{subproject_older_work_package.subject}/)
end
click_link('Next')
@@ -139,7 +139,7 @@ RSpec.describe 'Activity page navigation', :js, :with_cuprite do
# work packages for subproject still not visible
expect(page)
- .not_to have_link(text: /#{subproject_work_package.subject}/)
+ .to have_no_link(text: /#{subproject_work_package.subject}/)
end
end
end
diff --git a/spec/features/activities/disabled_activity_spec.rb b/spec/features/activities/disabled_activity_spec.rb
index 8b4f058cd93..0b7943fc10b 100644
--- a/spec/features/activities/disabled_activity_spec.rb
+++ b/spec/features/activities/disabled_activity_spec.rb
@@ -72,14 +72,14 @@ RSpec.describe 'Disabled activity', :js, :with_cuprite do
# Not displayed as activity is disabled
expect(page)
- .not_to have_content(work_package1.subject)
+ .to have_no_content(work_package1.subject)
expect(page)
- .not_to have_content(wiki_page1.title)
+ .to have_no_content(wiki_page1.title)
# Not displayed as all modules except activity are disabled
expect(page)
- .not_to have_content(work_package3.subject)
+ .to have_no_content(work_package3.subject)
expect(page)
- .not_to have_content(wiki_page3.title)
+ .to have_no_content(wiki_page3.title)
end
end
diff --git a/spec/features/activities/project_attributes_activity_spec.rb b/spec/features/activities/project_attributes_activity_spec.rb
index 0b179bd13e0..c7fbd4f2054 100644
--- a/spec/features/activities/project_attributes_activity_spec.rb
+++ b/spec/features/activities/project_attributes_activity_spec.rb
@@ -88,29 +88,29 @@ RSpec.describe 'Project attributes activity', :js, :with_cuprite do
.to have_link("Project: #{project.name}")
# own fields
- expect(page).to have_selector('li', text: "Name changed from #{previous_project_attributes['name']} to #{project.name}")
- expect(page).to have_selector('li', text: 'Description set (Details)')
- expect(page).to have_selector('li', text: "Project status set to On track")
- expect(page).to have_selector('li', text: 'Project status description set (Details)')
- expect(page).to have_selector('li', text: 'Visibility set to public')
- expect(page).to have_selector('li', text: "No longer subproject of #{parent_project.name}")
- expect(page).to have_selector('li', text: 'Project unarchived')
- expect(page).to have_selector('li', text: "Identifier changed from #{previous_project_attributes['identifier']} " \
- "to #{project.identifier}")
- expect(page).to have_selector('li', text: 'Project marked as template')
+ expect(page).to have_css('li', text: "Name changed from #{previous_project_attributes['name']} to #{project.name}")
+ expect(page).to have_css('li', text: 'Description set (Details)')
+ expect(page).to have_css('li', text: "Project status set to On track")
+ expect(page).to have_css('li', text: 'Project status description set (Details)')
+ expect(page).to have_css('li', text: 'Visibility set to public')
+ expect(page).to have_css('li', text: "No longer subproject of #{parent_project.name}")
+ expect(page).to have_css('li', text: 'Project unarchived')
+ expect(page).to have_css('li', text: "Identifier changed from #{previous_project_attributes['identifier']} " \
+ "to #{project.identifier}")
+ expect(page).to have_css('li', text: 'Project marked as template')
# custom fields
- expect(page).to have_selector('li', text: "#{list_project_custom_field.name} " \
- "set to #{project.send(list_project_custom_field.attribute_getter)}")
- expect(page).to have_selector('li', text: "#{version_project_custom_field.name} " \
- "set to #{old_version.name}, #{next_version.name}")
- expect(page).to have_selector('li', text: "#{bool_project_custom_field.name} set to Yes")
- expect(page).to have_selector('li', text: "#{user_project_custom_field.name} set to #{current_user.name}")
- expect(page).to have_selector('li', text: "#{int_project_custom_field.name} set to 42")
- expect(page).to have_selector('li', text: "#{float_project_custom_field.name} set to 3.14159")
- expect(page).to have_selector('li', text: "#{text_project_custom_field.name} set to\na new text CF value")
- expect(page).to have_selector('li', text: "#{string_project_custom_field.name} set to a new string CF value")
- expect(page).to have_selector('li', text: "#{date_project_custom_field.name} set to 01/31/2023")
+ expect(page).to have_css('li', text: "#{list_project_custom_field.name} " \
+ "set to #{project.send(list_project_custom_field.attribute_getter)}")
+ expect(page).to have_css('li', text: "#{version_project_custom_field.name} " \
+ "set to #{old_version.name}, #{next_version.name}")
+ expect(page).to have_css('li', text: "#{bool_project_custom_field.name} set to Yes")
+ expect(page).to have_css('li', text: "#{user_project_custom_field.name} set to #{current_user.name}")
+ expect(page).to have_css('li', text: "#{int_project_custom_field.name} set to 42")
+ expect(page).to have_css('li', text: "#{float_project_custom_field.name} set to 3.14159")
+ expect(page).to have_css('li', text: "#{text_project_custom_field.name} set to\na new text CF value")
+ expect(page).to have_css('li', text: "#{string_project_custom_field.name} set to a new string CF value")
+ expect(page).to have_css('li', text: "#{date_project_custom_field.name} set to 01/31/2023")
end
end
end
diff --git a/spec/features/activities/time_entry_activity_spec.rb b/spec/features/activities/time_entry_activity_spec.rb
index afe21f566d2..77d1f8425b2 100644
--- a/spec/features/activities/time_entry_activity_spec.rb
+++ b/spec/features/activities/time_entry_activity_spec.rb
@@ -72,7 +72,7 @@ RSpec.describe 'TimeEntry activity',
within("li.op-activity-list--item", match: :first) do
expect(page).to have_link("#{project.types.first} ##{work_package.id}: #{work_package.subject}")
- expect(page).to have_selector('li', text: "Spent time: 5 hours")
+ expect(page).to have_css('li', text: "Spent time: 5 hours")
expect(page).to have_link('Details')
click_link('Details')
end
@@ -103,13 +103,13 @@ RSpec.describe 'TimeEntry activity',
within("li.op-activity-list--item", match: :first) do
expect(page).to have_link("#{project.types.first} ##{work_package2.id}: #{work_package2.subject}")
- expect(page).to have_selector('li', text: "Logged for #{user2.name}")
- expect(page).to have_selector('li', text: "Work package changed from #{work_package.name} to #{work_package2.name}")
- expect(page).to have_selector('li', text: "Spent time changed from 5 hours to 1 hour")
- expect(page).to have_selector('li', text: "Comment changed from #{old_comments} to #{time_entry.comments}")
- expect(page).to have_selector('li',
- text: "Activity changed from #{time_entry_activity.name} to #{time_entry_activity2.name}")
- expect(page).to have_selector('li', text: "Date changed from #{old_spent_on} to #{time_entry.spent_on}")
+ expect(page).to have_css('li', text: "Logged for #{user2.name}")
+ expect(page).to have_css('li', text: "Work package changed from #{work_package.name} to #{work_package2.name}")
+ expect(page).to have_css('li', text: "Spent time changed from 5 hours to 1 hour")
+ expect(page).to have_css('li', text: "Comment changed from #{old_comments} to #{time_entry.comments}")
+ expect(page).to have_css('li',
+ text: "Activity changed from #{time_entry_activity.name} to #{time_entry_activity2.name}")
+ expect(page).to have_css('li', text: "Date changed from #{old_spent_on} to #{time_entry.spent_on}")
click_link('Details')
end
diff --git a/spec/features/activities/wiki_activity_spec.rb b/spec/features/activities/wiki_activity_spec.rb
index 3923ae1fac2..8c31a0fddbb 100644
--- a/spec/features/activities/wiki_activity_spec.rb
+++ b/spec/features/activities/wiki_activity_spec.rb
@@ -81,7 +81,7 @@ RSpec.describe 'Wiki Activity', :js, :with_cuprite do
within("li.op-activity-list--item", match: :first) do
expect(page)
- .to have_selector('li', text: "Text changed (Details)")
+ .to have_css('li', text: "Text changed (Details)")
expect(page)
.to have_link('Details')
end
@@ -103,6 +103,6 @@ RSpec.describe 'Wiki Activity', :js, :with_cuprite do
visit project_activity_index_path(project)
expect(page)
- .not_to have_content('Wiki edits')
+ .to have_no_content('Wiki edits')
end
end
diff --git a/spec/features/admin/attribute_help_texts_spec.rb b/spec/features/admin/attribute_help_texts_spec.rb
index dbf21142486..bc302873cca 100644
--- a/spec/features/admin/attribute_help_texts_spec.rb
+++ b/spec/features/admin/attribute_help_texts_spec.rb
@@ -140,7 +140,7 @@ RSpec.describe 'Attribute help texts', :js, :with_cuprite do
# Create new, status is now blocked
find('.attribute-help-texts--create-button').click
expect(page).to have_css('#attribute_help_text_attribute_name option', text: 'Assignee')
- expect(page).not_to have_css('#attribute_help_text_attribute_name option', text: 'Status')
+ expect(page).to have_no_css('#attribute_help_text_attribute_name option', text: 'Status')
visit attribute_help_texts_path
# Destroy
diff --git a/spec/features/admin/backup_spec.rb b/spec/features/admin/backup_spec.rb
index e72582ffb85..e139ce00dda 100644
--- a/spec/features/admin/backup_spec.rb
+++ b/spec/features/admin/backup_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'backup', js: true do
+RSpec.describe 'backup', :js do
let(:current_user) do
create(:user,
global_permissions: [:create_backup],
@@ -122,6 +122,6 @@ RSpec.describe 'backup', js: true do
token = Token::Backup.find_by(user: current_user)
expect(token).to be_nil
- expect(page).not_to have_content /#{I18n.t('js.backup.title')}/i
+ expect(page).to have_no_content /#{I18n.t('js.backup.title')}/i
end
end
diff --git a/spec/features/admin/custom_fields/list_custom_field_spec.rb b/spec/features/admin/custom_fields/list_custom_field_spec.rb
index 3549c0a8468..dc77e5e5f2b 100644
--- a/spec/features/admin/custom_fields/list_custom_field_spec.rb
+++ b/spec/features/admin/custom_fields/list_custom_field_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'List custom fields edit',
- js: true,
- with_cuprite: true do
+RSpec.describe 'List custom fields edit', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
before do
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 c7761fe0570..3f5e638a8d3 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Multi-value custom fields creation', js: true do
+RSpec.describe 'Multi-value custom fields creation', :js do
shared_let(:admin) { create(:admin) }
before do
@@ -44,19 +44,19 @@ RSpec.describe 'Multi-value custom fields creation', js: true do
fill_in 'custom_field_name', with: 'My List CF'
select 'List', from: 'custom_field_field_format'
- expect(page).to have_selector('input#custom_field_custom_options_attributes_0_value')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_0_value')
fill_in 'custom_field_custom_options_attributes_0_value', with: 'A'
# Add new row
page.find_test_selector('add-custom-option').click
SeleniumHubWaiter.wait
- expect(page).to have_selector('input#custom_field_custom_options_attributes_1_value')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_1_value')
fill_in 'custom_field_custom_options_attributes_1_value', with: 'B'
# Add new row
page.find_test_selector('add-custom-option').click
SeleniumHubWaiter.wait
- expect(page).to have_selector('input#custom_field_custom_options_attributes_2_value')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_2_value')
fill_in 'custom_field_custom_options_attributes_2_value', with: 'C'
click_on 'Save'
@@ -64,9 +64,9 @@ RSpec.describe 'Multi-value custom fields creation', js: true do
# Edit again
SeleniumHubWaiter.wait
page.find('a', text: 'My List CF').click
- expect(page).to have_selector('input#custom_field_custom_options_attributes_0_value[value=A]')
- expect(page).to have_selector('input#custom_field_custom_options_attributes_1_value[value=B]')
- expect(page).to have_selector('input#custom_field_custom_options_attributes_2_value[value=C]')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_0_value[value=A]')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_1_value[value=B]')
+ expect(page).to have_css('input#custom_field_custom_options_attributes_2_value[value=C]')
# Expect correct values
cf = CustomField.last
diff --git a/spec/features/admin/custom_fields/user_custom_field_spec.rb b/spec/features/admin/custom_fields/user_custom_field_spec.rb
index f03db000233..137bdbf0084 100644
--- a/spec/features/admin/custom_fields/user_custom_field_spec.rb
+++ b/spec/features/admin/custom_fields/user_custom_field_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'User custom fields edit',
- js: true,
- with_cuprite: true do
+RSpec.describe 'User custom fields edit', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
@@ -48,7 +46,7 @@ RSpec.describe 'User custom fields edit',
fill_in 'custom_field_name', with: 'My User CF'
select 'User', from: 'custom_field_field_format'
- expect(page).not_to have_field('custom_field_custom_options_attributes_0_value')
+ expect(page).to have_no_field('custom_field_custom_options_attributes_0_value')
click_on 'Save'
@@ -59,7 +57,7 @@ RSpec.describe 'User custom fields edit',
# Edit again
find('a', text: 'My User CF').click
- expect(page).not_to have_field('custom_field_custom_options_attributes_0_value')
+ expect(page).to have_no_field('custom_field_custom_options_attributes_0_value')
fill_in 'custom_field_name', with: 'My User CF (edited)'
click_on 'Save'
diff --git a/spec/features/admin/enterprise/enterprise_spec.rb b/spec/features/admin/enterprise/enterprise_spec.rb
index 9a52bd6e3e6..96d14b8bd8a 100644
--- a/spec/features/admin/enterprise/enterprise_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Enterprise token',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Enterprise token', :js, :with_cuprite do
include Redmine::I18n
shared_let(:admin) { create(:admin) }
@@ -54,20 +52,20 @@ RSpec.describe 'Enterprise token',
end
it 'shows a teaser and token form without a token' do
- expect(page).to have_selector('.button', text: 'Start free trial')
- expect(page).to have_selector('.button', text: 'Book now')
+ expect(page).to have_css('.button', text: 'Start free trial')
+ expect(page).to have_css('.button', text: 'Book now')
expect(textarea.value).to be_empty
textarea.set 'foobar'
submit_button.click
# Error output
- expect(page).to have_selector('.errorExplanation',
- text: "Enterprise support token can't be read. " \
- "Are you sure it is a support token?")
+ expect(page).to have_css('.errorExplanation',
+ text: "Enterprise support token can't be read. " \
+ "Are you sure it is a support token?")
within 'span.errorSpan' do
- expect(page).to have_selector('#enterprise_token_encoded_token')
+ expect(page).to have_css('#enterprise_token_encoded_token')
end
end
@@ -80,7 +78,7 @@ RSpec.describe 'Enterprise token',
textarea.set 'foobar'
submit_button.click
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
expect(page).to have_test_selector('op-enterprise--active-token')
expect(page.all('.attributes-key-value--key').map(&:text))
@@ -88,10 +86,10 @@ RSpec.describe 'Enterprise token',
expect(page.all('.attributes-key-value--value').map(&:text))
.to eq ['Foobar', '[email protected]', Setting.host_name, 'Unlimited', format_date(Time.zone.today), 'Unlimited']
- expect(page).to have_selector('.button.icon-delete', text: I18n.t(:button_delete))
+ expect(page).to have_css('.button.icon-delete', text: I18n.t(:button_delete))
# Expect section to be collapsed
- expect(page).not_to have_selector('#token_encoded_token')
+ expect(page).to have_no_css('#token_encoded_token')
RequestStore.clear!
expect(EnterpriseToken.current.encoded_token).to eq('foobar')
@@ -103,7 +101,7 @@ RSpec.describe 'Enterprise token',
wait_for_reload
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
# Assume next request
RequestStore.clear!
@@ -117,7 +115,7 @@ RSpec.describe 'Enterprise token',
wait_for_reload
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_delete))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_delete))
# Assume next request
RequestStore.clear!
diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rb
index 746ae285502..6b1f96d8e24 100644
--- a/spec/features/admin/enterprise/enterprise_trial_spec.rb
+++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb
@@ -182,9 +182,9 @@ RSpec.describe 'Enterprise trial management',
fill_out_modal
find('.button:not(:disabled)', text: 'Submit').click
- expect(page).to have_selector('.-required-highlighting #trial-email')
+ expect(page).to have_css('.-required-highlighting #trial-email')
expect(page).to have_text('Each user can only create one trial.')
- expect(page).not_to have_text 'email sent - waiting for confirmation'
+ expect(page).to have_no_text 'email sent - waiting for confirmation'
end
it 'blocks the request assuming the domain was used' do
@@ -195,9 +195,9 @@ RSpec.describe 'Enterprise trial management',
fill_out_modal
find('.button:not(:disabled)', text: 'Submit').click
- expect(page).to have_selector('.-required-highlighting #trial-domain-name')
+ expect(page).to have_css('.-required-highlighting #trial-domain-name')
expect(page).to have_text('There can only be one active trial per domain.')
- expect(page).not_to have_text 'email sent - waiting for confirmation'
+ expect(page).to have_no_text 'email sent - waiting for confirmation'
end
it 'shows an error in case of other errors' do
@@ -209,7 +209,7 @@ RSpec.describe 'Enterprise trial management',
find('.button:not(:disabled)', text: 'Submit').click
expect(page).to have_text('Token version is invalid')
- expect(page).not_to have_text 'email sent - waiting for confirmation'
+ expect(page).to have_no_text 'email sent - waiting for confirmation'
end
context 'with a waiting request pending' do
@@ -247,17 +247,17 @@ RSpec.describe 'Enterprise trial management',
visit enterprise_path
- expect(page).to have_selector('.attributes-key-value--value-container', text: 'OpenProject Test', wait: 20)
- expect(page).to have_selector('.attributes-key-value--value-container', text: '01/01/2020')
- expect(page).to have_selector('.attributes-key-value--value-container', text: '01/02/2020')
- expect(page).to have_selector('.attributes-key-value--value-container', text: '5')
+ expect(page).to have_css('.attributes-key-value--value-container', text: 'OpenProject Test', wait: 20)
+ expect(page).to have_css('.attributes-key-value--value-container', text: '01/01/2020')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '01/02/2020')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '5')
# Generated expired token has different mail
- expect(page).to have_selector('.attributes-key-value--value-container', text: '[email protected]')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '[email protected]')
end
it 'can confirm that trial regularly' do
find_test_selector('op-ee-trial-waiting-resend-link', text: 'Resend').click
- expect(page).to have_selector('.op-toast.-success', text: 'Email has been resent.', wait: 20)
+ expect(page).to have_css('.op-toast.-success', text: 'Email has been resent.', wait: 20)
expect(page).to have_text '[email protected]'
expect(page).to have_text 'email sent - waiting for confirmation'
@@ -276,13 +276,13 @@ RSpec.describe 'Enterprise trial management',
# advance to close
click_on 'Continue'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
- expect(page).to have_selector('.attributes-key-value--value-container', text: 'OpenProject Test')
- expect(page).to have_selector('.attributes-key-value--value-container', text: '01/01/2020')
- expect(page).to have_selector('.attributes-key-value--value-container', text: '01/02/2020')
- expect(page).to have_selector('.attributes-key-value--value-container', text: '5')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.attributes-key-value--value-container', text: 'OpenProject Test')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '01/01/2020')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '01/02/2020')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '5')
# Generated expired token has different mail
- expect(page).to have_selector('.attributes-key-value--value-container', text: '[email protected]')
+ expect(page).to have_css('.attributes-key-value--value-container', text: '[email protected]')
end
end
end
diff --git a/spec/features/admin/enterprise/token_domain_spec.rb b/spec/features/admin/enterprise/token_domain_spec.rb
index e6902b728de..a7f244bf5c5 100644
--- a/spec/features/admin/enterprise/token_domain_spec.rb
+++ b/spec/features/admin/enterprise/token_domain_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Enterprise Edition token domain',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Enterprise Edition token domain', :js, :with_cuprite do
let(:current_user) { create(:admin) }
let(:ee_token) { Rails.root.join("spec/fixtures/ee_tokens/v2_1_user_localhost_3001.token").read }
diff --git a/spec/features/admin/enumerations_spec.rb b/spec/features/admin/enumerations_spec.rb
index 077b38fb100..48fac780b38 100644
--- a/spec/features/admin/enumerations_spec.rb
+++ b/spec/features/admin/enumerations_spec.rb
@@ -38,7 +38,7 @@ RSpec.describe 'Enumerations' do
it 'contains all defined enumerations' do
Enumeration.subclasses.each do |enumeration|
- expect(page).to have_selector('h3', text: I18n.t(enumeration::OptionName))
+ expect(page).to have_css('h3', text: I18n.t(enumeration::OptionName))
expect(page).to have_link(I18n.t(:label_enumeration_new),
href: new_enumeration_path(type: enumeration.name))
end
diff --git a/spec/features/admin/languages_settings_spec.rb b/spec/features/admin/languages_settings_spec.rb
index 18c54234f40..3cb2685d4d8 100644
--- a/spec/features/admin/languages_settings_spec.rb
+++ b/spec/features/admin/languages_settings_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Languages settings page', cuprite: true, js: true do
+RSpec.describe 'Languages settings page', :cuprite, :js do
current_user { create(:admin) }
let(:languages_page) { Pages::Admin::SystemSettings::Languages.new }
diff --git a/spec/features/admin/menu_item_traversal_spec.rb b/spec/features/admin/menu_item_traversal_spec.rb
index 9acf018c21f..85ef30f87df 100644
--- a/spec/features/admin/menu_item_traversal_spec.rb
+++ b/spec/features/admin/menu_item_traversal_spec.rb
@@ -38,14 +38,14 @@ RSpec.describe 'Menu item traversal' do
end
it 'correctly maps the menu items for controllers in their namespace (Regression #30859)' do
- expect(page).to have_selector('.admin-overview-menu-item.selected', text: 'Overview')
+ expect(page).to have_css('.admin-overview-menu-item.selected', text: 'Overview')
find('.plugin-webhooks-menu-item').click
# 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).not_to have_selector('.admin-overview-menu-item.selected')
+ expect(page).to have_css('.plugin-webhooks-menu-item.selected', text: 'Webhooks', wait: 5)
+ expect(page).to have_no_css('.admin-overview-menu-item.selected')
end
end
@@ -71,8 +71,8 @@ RSpec.describe 'Menu item traversal' do
expect(current_url).to include link
expect(page).to have_http_status(:ok)
- expect(page).not_to have_text(I18n.t(:notice_not_authorized))
- expect(page).to have_selector '#menu-sidebar .selected'
+ expect(page).to have_no_text(I18n.t(:notice_not_authorized))
+ expect(page).to have_css '#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 8ee64cf7f65..9fa698d0603 100644
--- a/spec/features/admin/oauth/oauth_applications_management_spec.rb
+++ b/spec/features/admin/oauth/oauth_applications_management_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'OAuth applications management',
- js: true,
- with_cuprite: true do
+RSpec.describe 'OAuth applications management', :js, :with_cuprite do
let(:admin) { create(:admin) }
before do
@@ -40,7 +38,7 @@ RSpec.describe 'OAuth applications management',
it 'can create, update, show and delete applications' do
# Initially empty
- expect(page).to have_selector('.generic-table--empty-row', text: 'There is currently nothing to display')
+ expect(page).to have_css('.generic-table--empty-row', text: 'There is currently nothing to display')
# Create application
find('.button', text: 'Add').click
@@ -50,26 +48,26 @@ RSpec.describe 'OAuth applications management',
fill_in 'application_redirect_uri', with: "not a url!"
click_on 'Create'
- expect(page).to have_selector('.errorExplanation', text: 'Redirect URI must be an absolute URI.')
+ expect(page).to have_css('.errorExplanation', text: 'Redirect URI must be an absolute URI.')
fill_in('application_redirect_uri', with: "")
# Fill rediret_uri which does not provide a Secure Context
fill_in 'application_redirect_uri', with: "http://example.org"
click_on 'Create'
- expect(page).to have_selector('.errorExplanation', text: 'Redirect URI is not providing a "Secure Context"')
+ expect(page).to have_css('.errorExplanation', text: 'Redirect URI is not providing a "Secure Context"')
# Can create localhost without https (https://community.openproject.com/wp/34025)
fill_in 'application_redirect_uri', with: "urn:ietf:wg:oauth:2.0:oob\nhttp://localhost/my/callback"
click_on 'Create'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful creation.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful creation.')
- 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\nhttp://localhost/my/callback")
+ expect(page).to have_css('.attributes-key-value--key', text: 'Client ID')
+ expect(page).to have_css('.attributes-key-value--value', text: "urn:ietf:wg:oauth:2.0:oob\nhttp://localhost/my/callback")
# Should print secret on initial visit
- expect(page).to have_selector('.attributes-key-value--key', text: 'Client secret')
+ expect(page).to have_css('.attributes-key-value--key', text: 'Client secret')
expect(page.first('.attributes-key-value--value code').text).to match /\w+/
# Edit again
@@ -81,16 +79,16 @@ RSpec.describe 'OAuth applications management',
# Show application
find('td a', text: 'My API application').click
- 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")
+ expect(page).to have_no_css('.attributes-key-value--key', text: 'Client secret')
+ expect(page).to have_no_css('.attributes-key-value--value code')
+ expect(page).to have_css('.attributes-key-value--key', text: 'Client ID')
+ expect(page).to have_css('.attributes-key-value--value', text: "urn:ietf:wg:oauth:2.0:oob")
accept_alert do
click_on 'Delete'
end
# Table is empty again
- expect(page).to have_selector('.generic-table--empty-row', text: 'There is currently nothing to display')
+ expect(page).to have_css('.generic-table--empty-row', text: 'There is currently nothing to display')
end
end
diff --git a/spec/features/admin/test_mail_notification_spec.rb b/spec/features/admin/test_mail_notification_spec.rb
index 609bcaec369..2fe771a0248 100644
--- a/spec/features/admin/test_mail_notification_spec.rb
+++ b/spec/features/admin/test_mail_notification_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Test mail notification', js: true, with_cuprite: true do
+RSpec.describe 'Test mail notification', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
before do
@@ -44,7 +44,7 @@ RSpec.describe 'Test mail notification', js: true, with_cuprite: true do
click_link 'Send a test email'
expected = "An error occurred while sending mail (#{error_message})"
- expect(page).to have_selector('.op-toast.-error', text: expected)
- expect(page).not_to have_selector('.op-toast.-error strong')
+ expect(page).to have_css('.op-toast.-error', text: expected)
+ expect(page).to have_no_css('.op-toast.-error strong')
end
end
diff --git a/spec/features/admin/working_days_spec.rb b/spec/features/admin/working_days_spec.rb
index 620890a39fc..aa049ff7d01 100644
--- a/spec/features/admin/working_days_spec.rb
+++ b/spec/features/admin/working_days_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Working Days', js: true, with_cuprite: true do
+RSpec.describe 'Working Days', :js, :with_cuprite do
create_shared_association_defaults_for_work_package_factory
shared_let(:week_days) { week_with_saturday_and_sunday_as_weekend }
@@ -58,7 +58,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
it 'contains all defined days from the settings' do
WeekDay.all.each do |day|
- expect(page).to have_selector('label', text: day.name)
+ expect(page).to have_css('label', text: day.name)
if day.working
expect(page).to have_checked_field day.name
end
@@ -77,7 +77,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
dialog.cancel
end
- expect(page).not_to have_selector('.op-toast.-success')
+ expect(page).to have_no_css('.op-toast.-success')
expect(working_days_setting).to eq([1, 2, 3, 4, 5])
@@ -101,7 +101,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
dialog.confirm
end
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.')
expect(page).to have_unchecked_field 'Monday'
expect(page).to have_unchecked_field 'Friday'
expect(page).to have_unchecked_field 'Saturday'
@@ -141,8 +141,8 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
dialog.confirm
end
- expect(page).to have_selector('.op-toast.-error',
- text: 'At least one day of the week must be defined as a working day.')
+ expect(page).to have_css('.op-toast.-error',
+ text: 'At least one day of the week must be defined as a working day.')
# Restore the checkboxes to their valid state
expect(page).to have_checked_field 'Monday'
expect(page).to have_checked_field 'Tuesday'
@@ -175,8 +175,8 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
# Not executing the background jobs
dialog.confirm
- expect(page).to have_selector('.op-toast.-error',
- text: 'The previous changes to the working days configuration have not been applied yet.')
+ expect(page).to have_css('.op-toast.-error',
+ text: 'The previous changes to the working days configuration have not been applied yet.')
end
end
@@ -213,7 +213,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
click_on 'Add'
end
- expect(page).to have_selector('.fc-list-event-title', text: 'My holiday')
+ expect(page).to have_css('.fc-list-event-title', text: 'My holiday')
# Add a second day
click_on 'Non-working day'
@@ -232,7 +232,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
click_on 'Apply changes'
click_on 'Save and reschedule'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.')
nwd1 = NonWorkingDay.find_by(name: 'My holiday')
expect(nwd1.date).to eq date1
@@ -246,7 +246,7 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
within_test_selector('op-datepicker-modal') do
click_on 'Add'
end
- expect(page).to have_selector('.flatpickr-calendar')
+ expect(page).to have_css('.flatpickr-calendar')
datepicker.expect_visible
within_test_selector('op-datepicker-modal') do
@@ -258,14 +258,14 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
within_test_selector('op-datepicker-modal') do
click_on 'Add'
end
- expect(page).not_to have_selector('.flatpickr-calendar')
+ expect(page).to have_no_css('.flatpickr-calendar')
- expect(page).to have_selector('.op-toast', text: /A non-working day for this date exists already/)
+ expect(page).to have_css('.op-toast', text: /A non-working day for this date exists already/)
end
it 'deletes a non-working day' do
non_working_days.each do |nwd|
- expect(page).to have_selector('tr', text: nwd.date.strftime("%B %-d, %Y"))
+ expect(page).to have_css('tr', text: nwd.date.strftime("%B %-d, %Y"))
end
delete_button = page.first('.op-non-working-days-list--delete-icon .icon-delete', visible: :all)
@@ -277,8 +277,8 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
dialog.confirm
# Remove the first date
- expect(page).not_to have_selector('tr', text: non_working_days.first.date.strftime("%B %-d, %Y"))
- expect(page).to have_selector('tr', text: non_working_days.last.date.strftime("%B %-d, %Y"))
+ expect(page).to have_no_css('tr', text: non_working_days.first.date.strftime("%B %-d, %Y"))
+ expect(page).to have_css('tr', text: non_working_days.last.date.strftime("%B %-d, %Y"))
# Show an error when the changes cannot be saved and preserves the modifications upon submit
errors = ActiveModel::Errors.new(NonWorkingDay.new)
@@ -299,8 +299,8 @@ RSpec.describe 'Working Days', js: true, with_cuprite: true do
dialog.confirm
# Keep the second date hidden
- expect(page).not_to have_selector('tr', text: non_working_days.second.date.strftime("%B %-d, %Y"))
- expect(page).to have_selector('tr', text: non_working_days.last.date.strftime("%B %-d, %Y"))
+ expect(page).to have_no_css('tr', text: non_working_days.second.date.strftime("%B %-d, %Y"))
+ expect(page).to have_css('tr', text: non_working_days.last.date.strftime("%B %-d, %Y"))
end
end
end
diff --git a/spec/features/api_docs/index_spec.rb b/spec/features/api_docs/index_spec.rb
index d2d661a0705..2ce5c2262ce 100644
--- a/spec/features/api_docs/index_spec.rb
+++ b/spec/features/api_docs/index_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'REST API docs index page', js: true do
+RSpec.describe 'REST API docs index page', :js do
subject(:visit_docs_page) { visit(api_docs_path) }
context 'with anonymous user' do
@@ -46,7 +46,7 @@ RSpec.describe 'REST API docs index page', js: true do
visit_docs_page
# web component are harder to test with capybara
- expect(find("openapi-explorer").shadow_root).to have_selector('#api-title', text: 'OpenProject API V3 (Stable)')
+ expect(find("openapi-explorer").shadow_root).to have_css('#api-title', text: 'OpenProject API V3 (Stable)')
end
context 'when APIv3 documentation is disabled (from Administration > API > Enable docs page)',
diff --git a/spec/features/attachments/attachments_spec.rb b/spec/features/attachments/attachments_spec.rb
index d6647b4cc70..8742aaac564 100644
--- a/spec/features/attachments/attachments_spec.rb
+++ b/spec/features/attachments/attachments_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe 'attachments' do
allow(User).to receive(:current).and_return current_user
end
- describe 'upload', js: true do
+ describe 'upload', :js do
let(:file) { create(:file, name: 'textfile.txt') }
# FIXME rework this spec after implementing fullscreen create view
diff --git a/spec/features/auth/auth_source_sso_login_spec.rb b/spec/features/auth/auth_source_sso_login_spec.rb
index 08df723084f..497e24fb3a7 100644
--- a/spec/features/auth/auth_source_sso_login_spec.rb
+++ b/spec/features/auth/auth_source_sso_login_spec.rb
@@ -60,6 +60,6 @@ RSpec.describe 'Login with auth source SSO' do
.to have_current_path my_page_path
expect(page)
- .to have_selector("a[title='#{user.name}']")
+ .to have_css("a[title='#{user.name}']")
end
end
diff --git a/spec/features/auth/auth_source_sso_logout_spec.rb b/spec/features/auth/auth_source_sso_logout_spec.rb
index da553c1c709..3e259f590a5 100644
--- a/spec/features/auth/auth_source_sso_logout_spec.rb
+++ b/spec/features/auth/auth_source_sso_logout_spec.rb
@@ -53,11 +53,11 @@ RSpec.describe 'Login with auth source SSO',
it 'can log out after multiple visits' do
visit home_path
- expect(page).to have_selector('.controller-homescreen')
+ expect(page).to have_css('.controller-homescreen')
visit home_path
- expect(page).to have_selector('.controller-homescreen')
+ expect(page).to have_css('.controller-homescreen')
visit signout_path
diff --git a/spec/features/auth/auth_stages_spec.rb b/spec/features/auth/auth_stages_spec.rb
index 31950678f0c..8efca2075d9 100644
--- a/spec/features/auth/auth_stages_spec.rb
+++ b/spec/features/auth/auth_stages_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Authentication Stages',
- skip_2fa_stage: true do
+RSpec.describe 'Authentication Stages', :skip_2fa_stage do
before do
@capybara_ignore_elements = Capybara.ignore_hidden_elements
Capybara.ignore_hidden_elements = true
@@ -160,7 +159,7 @@ RSpec.describe 'Authentication Stages',
visit "/my/account"
- expect(page).not_to have_text user.login # just checking we're really not logged in
+ expect(page).to have_no_text user.login # just checking we're really not logged in
end
it 'redirects to the login page and shows an error on authentication stage failure' do
@@ -176,7 +175,7 @@ RSpec.describe 'Authentication Stages',
visit "/my/account"
- expect(page).not_to have_text user.login # just checking we're really not logged in
+ expect(page).to have_no_text user.login # just checking we're really not logged in
end
it 'redirects to the login page and shows an error on returning to the wrong stage' do
@@ -192,7 +191,7 @@ RSpec.describe 'Authentication Stages',
visit "/my/account"
- expect(page).not_to have_text user.login # just checking we're really not logged in
+ expect(page).to have_no_text user.login # just checking we're really not logged in
end
it 'redirects to the referer if there is one' do
diff --git a/spec/features/auth/consent_auth_stage_spec.rb b/spec/features/auth/consent_auth_stage_spec.rb
index d9f3d1c6bd0..8dd5eb4f60e 100644
--- a/spec/features/auth/consent_auth_stage_spec.rb
+++ b/spec/features/auth/consent_auth_stage_spec.rb
@@ -50,18 +50,18 @@ RSpec.describe 'Authentication Stages' do
def expect_logged_in(path = my_page_path)
expect(page).to have_current_path(path)
visit my_account_path
- expect(page).to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_css('.form--field-container', text: user.login)
end
def expect_not_logged_in
visit my_account_path
- expect(page).not_to have_selector('.form--field-container', text: user.login)
+ expect(page).to have_no_css('.form--field-container', text: user.login)
end
context 'when disabled', with_settings: { consent_required: false } do
it 'does not show consent' do
login_with user.login, user_password
- expect(page).not_to have_selector('.account-consent')
+ expect(page).to have_no_css('.account-consent')
expect_logged_in
end
@@ -70,7 +70,7 @@ RSpec.describe 'Authentication Stages' do
expect(Setting::Autologin.enabled?).to be true
login_with user.login, user_password, autologin: true
- expect(page).not_to have_selector('.account-consent')
+ expect(page).to have_no_css('.account-consent')
expect_logged_in
cookies = Capybara.current_session.driver.request.cookies
@@ -90,7 +90,7 @@ RSpec.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).not_to have_selector('.account-consent')
+ expect(page).to have_no_css('.account-consent')
expect_logged_in
end
end
@@ -100,7 +100,6 @@ RSpec.describe 'Authentication Stages' do
consent_required: true,
consent_info: { de: '# Einwilligung', en: '# Consent header!' }
} do
-
around do |example|
Capybara.current_session.driver.header('Accept-Language', 'de')
example.call
@@ -111,8 +110,8 @@ RSpec.describe 'Authentication Stages' do
it 'shows localized consent as defined by the accept language header (ignoring users language)' do
login_with user.login, user_password
- expect(page).to have_selector('.account-consent')
- expect(page).to have_selector('h1', text: 'Einwilligung')
+ expect(page).to have_css('.account-consent')
+ expect(page).to have_css('h1', text: 'Einwilligung')
end
end
@@ -122,7 +121,6 @@ RSpec.describe 'Authentication Stages' do
consent_info: { en: '# Consent header!' },
consent_required: true
} do
-
after do
# Clear session to avoid that the onboarding tour starts
page.execute_script("window.sessionStorage.clear();")
@@ -132,14 +130,14 @@ RSpec.describe 'Authentication Stages' do
expect(Setting.consent_time).to be_blank
login_with user.login, user_password
- expect(page).to have_selector('.account-consent')
- expect(page).to have_selector('h1', text: 'Consent header')
+ expect(page).to have_css('.account-consent')
+ expect(page).to have_css('h1', text: 'Consent header')
# Can't submit without confirmation
click_on I18n.t(:button_continue)
- expect(page).to have_selector('.account-consent')
- expect(page).to have_selector('h1', text: 'Consent header')
+ expect(page).to have_css('.account-consent')
+ expect(page).to have_css('h1', text: 'Consent header')
SeleniumHubWaiter.wait
# Confirm consent
@@ -162,7 +160,7 @@ RSpec.describe 'Authentication Stages' do
find_by_id('toggle_consent_time').set(true)
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
Setting.clear_cache
expect(Setting.consent_time).to be_present
@@ -199,17 +197,17 @@ RSpec.describe 'Authentication Stages' do
token = Token::Invitation.last.value
visit "/account/activate?token=#{token}"
- expect(page).to have_selector('h1', text: 'Consent header')
+ expect(page).to have_css('h1', text: 'Consent header')
# Cannot create without accepting
fill_in 'user_password', with: user_password
fill_in 'user_password_confirmation', with: user_password
click_on I18n.t(:button_create)
- expect(page).to have_selector('h1', text: 'Consent header')
+ expect(page).to have_css('h1', text: 'Consent header')
check 'consent_check'
click_on I18n.t(:button_create)
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
expect_logged_in('/?first_time_user=true')
end
@@ -219,13 +217,12 @@ RSpec.describe 'Authentication Stages' do
consent_info: { en: '# Consent header!' },
consent_required: true
} do
-
expect(Setting::Autologin.enabled?).to be true
login_with user.login, user_password, autologin: true
- expect(page).to have_selector('.account-consent')
- expect(page).to have_selector('h1', text: 'Consent header!')
+ expect(page).to have_css('.account-consent')
+ expect(page).to have_css('h1', text: 'Consent header!')
# Confirm consent
SeleniumHubWaiter.wait
@@ -245,13 +242,13 @@ RSpec.describe 'Authentication Stages' do
it 'shows that address to users when declining' do
login_with user.login, user_password
- expect(page).to have_selector('.account-consent')
- expect(page).to have_selector('h1', text: 'Consent header')
+ expect(page).to have_css('.account-consent')
+ expect(page).to have_css('h1', text: 'Consent header')
# Decline the consent
click_on I18n.t(:button_decline)
- expect(page).to have_selector('.op-toast.-error', text: '[email protected]')
+ expect(page).to have_css('.op-toast.-error', text: '[email protected]')
end
end
end
diff --git a/spec/features/auth/login_spec.rb b/spec/features/auth/login_spec.rb
index 1c540eee054..d278dec8fba 100644
--- a/spec/features/auth/login_spec.rb
+++ b/spec/features/auth/login_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe 'Login' do
def expect_being_logged_in(user)
expect(page)
- .to have_selector("a[title='#{user.name}']")
+ .to have_css("a[title='#{user.name}']")
end
def expect_not_being_logged_in
@@ -157,7 +157,7 @@ RSpec.describe 'Login' do
end
end
- context 'with password expiry', js: true do
+ context 'with password expiry', :js do
before do
user.passwords.update_all(created_at: 31.days.ago,
updated_at: 31.days.ago)
diff --git a/spec/features/auth/logout_spec.rb b/spec/features/auth/logout_spec.rb
index 2ab4e0d09c6..9ff03703d1e 100644
--- a/spec/features/auth/logout_spec.rb
+++ b/spec/features/auth/logout_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Logout', js: true do
+RSpec.describe 'Logout', :js do
let(:user_password) { 'b0B' * 4 }
let(:user) do
create(:user,
@@ -55,7 +55,7 @@ RSpec.describe 'Logout', js: true do
# Can not access the my page but is redirected
# to login instead.
visit my_page_path
-
+
expect(page)
.to have_current_path /login/
diff --git a/spec/features/auth/lost_password_spec.rb b/spec/features/auth/lost_password_spec.rb
index fef2f6fd99d..fc3d3c0f143 100644
--- a/spec/features/auth/lost_password_spec.rb
+++ b/spec/features/auth/lost_password_spec.rb
@@ -39,14 +39,14 @@ RSpec.describe 'Lost password' do
fill_in 'mail', with: 'invalid mail'
click_on 'Submit'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to be 0
fill_in 'mail', with: user.mail
click_on 'Submit'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to be 1
@@ -60,7 +60,7 @@ RSpec.describe 'Lost password' do
click_button 'Save'
- expect(page).to have_selector('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
+ expect(page).to have_css('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
login_with user.login, new_password
@@ -79,7 +79,7 @@ RSpec.describe 'Lost password' do
fill_in 'mail', with: user.mail
click_on 'Submit'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to be 1
@@ -99,7 +99,7 @@ RSpec.describe 'Lost password' do
fill_in 'mail', with: user.mail
click_on 'Submit'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_account_lost_email_sent))
perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to be 1
diff --git a/spec/features/categories/delete_spec.rb b/spec/features/categories/delete_spec.rb
index 4aaaadf9c5f..4090dd03104 100644
--- a/spec/features/categories/delete_spec.rb
+++ b/spec/features/categories/delete_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/categories/categories_page'
-RSpec.describe 'Deletion', js: true, with_cuprite: true do
+RSpec.describe 'Deletion', :js, :with_cuprite do
let(:current_user) do
create(:user,
member_with_permissions: { category.project => %i[manage_categories] })
@@ -52,9 +52,9 @@ RSpec.describe 'Deletion', js: true, with_cuprite: true do
end
shared_examples_for 'deleted category' do
- it { expect(page).to have_selector('div.generic-table--no-results-container') }
+ it { expect(page).to have_css('div.generic-table--no-results-container') }
- it { expect(page).not_to have_selector(delete_button) }
+ it { expect(page).to have_no_selector(delete_button) }
end
describe 'w/o work package' do
diff --git a/spec/features/custom_fields/activate_in_project_spec.rb b/spec/features/custom_fields/activate_in_project_spec.rb
index c9ca1a24d83..8f7ec8bfffb 100644
--- a/spec/features/custom_fields/activate_in_project_spec.rb
+++ b/spec/features/custom_fields/activate_in_project_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
let(:for_all_cf) { create(:list_wp_custom_field, is_for_all: true) }
diff --git a/spec/features/custom_fields/create_bool_spec.rb b/spec/features/custom_fields/create_bool_spec.rb
index b94d79872d2..e7ce8dcc5b7 100644
--- a/spec/features/custom_fields/create_bool_spec.rb
+++ b/spec/features/custom_fields/create_bool_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
diff --git a/spec/features/custom_fields/create_date_spec.rb b/spec/features/custom_fields/create_date_spec.rb
index cb66d497cc7..c86d2f3e7ac 100644
--- a/spec/features/custom_fields/create_date_spec.rb
+++ b/spec/features/custom_fields/create_date_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
diff --git a/spec/features/custom_fields/create_float_spec.rb b/spec/features/custom_fields/create_float_spec.rb
index 4cf3497c496..86ebaaa387a 100644
--- a/spec/features/custom_fields/create_float_spec.rb
+++ b/spec/features/custom_fields/create_float_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
diff --git a/spec/features/custom_fields/create_int_spec.rb b/spec/features/custom_fields/create_int_spec.rb
index 4e2a2faf3a2..a8e2d8d7124 100644
--- a/spec/features/custom_fields/create_int_spec.rb
+++ b/spec/features/custom_fields/create_int_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
diff --git a/spec/features/custom_fields/create_long_text_spec.rb b/spec/features/custom_fields/create_long_text_spec.rb
index 9b6067078c5..04334270247 100644
--- a/spec/features/custom_fields/create_long_text_spec.rb
+++ b/spec/features/custom_fields/create_long_text_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true do
+RSpec.describe 'custom fields', :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
let(:editor) { Components::WysiwygEditor.new '#custom_field_form' }
@@ -57,8 +57,8 @@ RSpec.describe 'custom fields', js: true do
wp_editor.expect_active!
wp_editor.ckeditor.in_editor do |container, _|
- expect(container).to have_selector('h1', text: 'This is an exemplary test')
- expect(container).to have_selector('strong', text: 'Foo bar')
+ expect(container).to have_css('h1', text: 'This is an exemplary test')
+ expect(container).to have_css('strong', text: 'Foo bar')
end
end
end
diff --git a/spec/features/custom_fields/custom_fields_spec.rb b/spec/features/custom_fields/custom_fields_spec.rb
index 337959d3e62..eafa5778e4a 100644
--- a/spec/features/custom_fields/custom_fields_spec.rb
+++ b/spec/features/custom_fields/custom_fields_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'custom fields', js: true, with_cuprite: true do
+RSpec.describe 'custom fields', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
@@ -21,7 +21,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
expect(page).to have_text("Allow multi-select")
check("custom_field_multi_value")
- expect(page).to have_selector('.custom-option-row', count: 1)
+ expect(page).to have_css('.custom-option-row', count: 1)
within all(".custom-option-row").last do
find(".custom-option-value input").set "Windows"
find(".custom-option-default-value input").set true
@@ -29,14 +29,14 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
page.find_test_selector('add-custom-option').click
- expect(page).to have_selector('.custom-option-row', count: 2)
+ expect(page).to have_css('.custom-option-row', count: 2)
within all(".custom-option-row").last do
find(".custom-option-value input").set "Linux"
end
page.find_test_selector('add-custom-option').click
- expect(page).to have_selector('.custom-option-row', count: 3)
+ expect(page).to have_css('.custom-option-row', count: 3)
within all(".custom-option-row").last do
find(".custom-option-value input").set "Solaris"
@@ -52,7 +52,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
expect(page).to have_field("custom_field_multi_value", checked: true)
- expect(page).to have_selector('.custom-option-row', count: 3)
+ expect(page).to have_css('.custom-option-row', count: 3)
expect(page).to have_field("custom_field_custom_options_attributes_0_value", with: "Solaris")
expect(page).to have_field("custom_field_custom_options_attributes_1_value", with: "Windows")
expect(page).to have_field("custom_field_custom_options_attributes_2_value", with: "Linux")
@@ -90,67 +90,84 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
def expect_page_not_to_have_texts(*text)
text.each do |t|
- expect(page).not_to have_text(t)
+ expect(page).to have_no_text(t)
end
end
select "Text", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required)
+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required
+ )
expect_page_not_to_have_texts(
- label_multi_value, label_allow_non_open_versions, label_possible_values)
+ label_multi_value, label_allow_non_open_versions, label_possible_values
+ )
select "Long text", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required)
+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required
+ )
expect_page_not_to_have_texts(
- label_multi_value, label_allow_non_open_versions, label_possible_values)
+ label_multi_value, label_allow_non_open_versions, label_possible_values
+ )
# Both Integer and Float have min/max_len and regex as well which seems strange.
select "Integer", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required)
+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required
+ )
expect_page_not_to_have_texts(
- label_multi_value, label_allow_non_open_versions, label_possible_values)
+ label_multi_value, label_allow_non_open_versions, label_possible_values
+ )
select "Float", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_min_length, label_max_length, label_regexp, label_default_value, label_is_required)
+ label_min_length, label_max_length, label_regexp, label_default_value, label_is_required
+ )
expect_page_not_to_have_texts(
- label_multi_value, label_allow_non_open_versions, label_possible_values)
+ label_multi_value, label_allow_non_open_versions, label_possible_values
+ )
select "List", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_multi_value, label_possible_values, label_is_required)
+ label_multi_value, label_possible_values, label_is_required
+ )
expect_page_not_to_have_texts(
- label_min_length, label_max_length, label_regexp, label_allow_non_open_versions, label_default_value)
+ label_min_length, label_max_length, label_regexp, label_allow_non_open_versions, label_default_value
+ )
select "Date", from: "custom_field_field_format"
expect_page_to_have_texts(label_is_required)
expect_page_not_to_have_texts(
label_min_length, label_max_length, label_regexp, label_multi_value,
- label_allow_non_open_versions, label_possible_values, label_default_value)
+ label_allow_non_open_versions, label_possible_values, label_default_value
+ )
select "Boolean", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_default_value, label_is_required)
+ label_default_value, label_is_required
+ )
expect_page_not_to_have_texts(
label_min_length, label_max_length, label_regexp, label_multi_value,
- label_allow_non_open_versions, label_possible_values)
+ label_allow_non_open_versions, label_possible_values
+ )
select "User", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_multi_value, label_is_required)
+ label_multi_value, label_is_required
+ )
expect_page_not_to_have_texts(
label_min_length, label_max_length, label_regexp, label_allow_non_open_versions,
- label_possible_values, label_default_value)
+ label_possible_values, label_default_value
+ )
select "Version", from: "custom_field_field_format"
expect_page_to_have_texts(
- label_multi_value, label_allow_non_open_versions, label_is_required)
+ label_multi_value, label_allow_non_open_versions, label_is_required
+ )
expect_page_not_to_have_texts(
label_min_length, label_max_length, label_regexp,
- label_possible_values, label_default_value)
+ label_possible_values, label_default_value
+ )
end
it "shows the correct breadcrumbs" do
@@ -160,8 +177,8 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
wait_for_reload
page.within_test_selector('op-breadcrumb') do
- expect(page).to have_selector('.breadcrumb-item', text: type)
- expect(page).to have_selector('.breadcrumb-item.breadcrumb-item-selected', text: "New custom field")
+ expect(page).to have_css('.breadcrumb-item', text: type)
+ expect(page).to have_css('.breadcrumb-item.breadcrumb-item-selected', text: "New custom field")
end
end
end
@@ -203,7 +220,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
page.find_test_selector('add-custom-option').click
wait_for_reload
- expect(page).to have_selector('.custom-option-row', count: 5)
+ expect(page).to have_css('.custom-option-row', count: 5)
within all(".custom-option-row").last do
find(".custom-option-value input").set "Sega"
end
@@ -211,7 +228,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
page.find_test_selector('add-custom-option').click
wait_for_reload
- expect(page).to have_selector('.custom-option-row', count: 6)
+ expect(page).to have_css('.custom-option-row', count: 6)
within all(".custom-option-row").last do
find(".custom-option-value input").set "Atari"
end
@@ -220,7 +237,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
expect(page).to have_text("Successful update")
expect(page).to have_text("Platform")
- expect(page).to have_selector('.custom-option-row', count: 6)
+ expect(page).to have_css('.custom-option-row', count: 6)
%w[Playstation Xbox Nintendo PC Sega Atari].each_with_index do |value, i|
expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)
@@ -230,7 +247,7 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
it "updates the values and orders of the custom options" do
expect(page).to have_text("Platform")
- expect(page).to have_selector('.custom-option-row', count: 4)
+ expect(page).to have_css('.custom-option-row', count: 4)
%w[Playstation Xbox Nintendo PC].each_with_index do |value, i|
expect(page).to have_field("custom_field_custom_options_attributes_#{i}_value", with: value)
end
@@ -261,8 +278,8 @@ RSpec.describe 'custom fields', js: true, with_cuprite: true do
it "shows the correct breadcrumbs" do
page.within_test_selector('op-breadcrumb') do
- expect(page).to have_selector('.breadcrumb-item', text: "Work packages")
- expect(page).to have_selector('.breadcrumb-item.breadcrumb-item-selected', text: "Platform")
+ expect(page).to have_css('.breadcrumb-item', text: "Work packages")
+ expect(page).to have_css('.breadcrumb-item.breadcrumb-item-selected', text: "Platform")
end
end
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 7bfac9806c0..d00bce17040 100644
--- a/spec/features/custom_fields/multi_user_custom_field_spec.rb
+++ b/spec/features/custom_fields/multi_user_custom_field_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe "multi select custom values", :js, :with_cuprite do
expect(page).to have_text "groupfoo"
expect(page).to have_text "PLACEHOLDER"
- expect(page).not_to have_text "Da Real"
+ expect(page).to have_no_text "Da Real"
work_package.reload
cvs = work_package
@@ -145,11 +145,11 @@ RSpec.describe "multi select custom values", :js, :with_cuprite do
click_on "Reviewer: Save"
wp_page.expect_and_dismiss_toaster(message: "Successful update.")
- expect(page).to have_selector('.custom-option', count: 2)
+ expect(page).to have_css('.custom-option', count: 2)
expect(page).to have_text custom_field.name
expect(page).to have_text "Billy Nobbler"
- expect(page).not_to have_text "Anton Lupin"
+ expect(page).to have_no_text "Anton Lupin"
expect(page).to have_text "Cooper Quatermaine"
end
end
diff --git a/spec/features/custom_fields/multi_value_custom_field_spec.rb b/spec/features/custom_fields/multi_value_custom_field_spec.rb
index 3ff7a81b3c9..78a911c52f1 100644
--- a/spec/features/custom_fields/multi_value_custom_field_spec.rb
+++ b/spec/features/custom_fields/multi_value_custom_field_spec.rb
@@ -1,9 +1,7 @@
require "spec_helper"
require "support/pages/work_packages/abstract_work_package"
-RSpec.describe "multi select custom values",
- js: true,
- with_cuprite: true do
+RSpec.describe "multi select custom values", :js, :with_cuprite do
let(:type) { create(:type) }
let(:wp_page) { Pages::FullWorkPackage.new work_package }
let(:wp_table) { Pages::WorkPackagesTable.new project }
@@ -89,12 +87,12 @@ RSpec.describe "multi select custom values",
edit_field.submit_by_dashboard
- expect(page).to have_selector('.custom-option.-multiple-lines', count: 3)
+ expect(page).to have_css('.custom-option.-multiple-lines', count: 3)
expect(page).to have_text "Successful update"
expect(page).to have_text custom_field.name
expect(page).to have_text "ham"
- expect(page).not_to have_text "pineapple"
+ expect(page).to have_no_text "pineapple"
expect(page).to have_text "onions"
expect(page).to have_text "mushrooms"
end
@@ -130,16 +128,16 @@ RSpec.describe "multi select custom values",
# Should show truncated values
expect(page).to have_text "ham, pineapple, ...3"
- expect(page).not_to have_text "onions"
+ expect(page).to have_no_text "onions"
# Group by the CF
group_by.enable_via_menu 'Ingredients'
loading_indicator_saveguard
# Expect changed groups
- expect(page).to have_selector('.group--value .count', count: 2)
- expect(page).to have_selector('.group--value', text: 'ham, onions, pineapple (1)')
- expect(page).to have_selector('.group--value', text: 'ham (1)')
+ expect(page).to have_css('.group--value .count', count: 2)
+ expect(page).to have_css('.group--value', text: 'ham, onions, pineapple (1)')
+ expect(page).to have_css('.group--value', text: 'ham (1)')
wp1_field.activate!
@@ -151,8 +149,8 @@ RSpec.describe "multi select custom values",
wp_page.expect_and_dismiss_toaster message: 'Successful update'
# Expect changed groups
- expect(page).to have_selector('.group--value .count', count: 1)
- expect(page).to have_selector('.group--value', text: 'ham (2)')
+ expect(page).to have_css('.group--value .count', count: 1)
+ expect(page).to have_css('.group--value', text: 'ham (2)')
# Open split view
split_view = wp_table.open_split_view work_package
@@ -169,9 +167,9 @@ RSpec.describe "multi select custom values",
wp1_field.expect_state_text '-'
# Expect changed groups
- expect(page).to have_selector('.group--value .count', count: 2)
- expect(page).to have_selector('.group--value', text: '- (1)')
- expect(page).to have_selector('.group--value', text: 'ham (1)')
+ expect(page).to have_css('.group--value .count', count: 2)
+ expect(page).to have_css('.group--value', text: '- (1)')
+ expect(page).to have_css('.group--value', text: 'ham (1)')
# Activate again
field.activate!
@@ -182,9 +180,9 @@ RSpec.describe "multi select custom values",
field.submit_by_dashboard
# Expect changed groups
- expect(page).to have_selector('.group--value .count', count: 2)
- expect(page).to have_selector('.group--value', text: 'ham, onions (1)')
- expect(page).to have_selector('.group--value', text: 'ham (1)')
+ expect(page).to have_css('.group--value .count', count: 2)
+ expect(page).to have_css('.group--value', text: 'ham, onions (1)')
+ expect(page).to have_css('.group--value', text: 'ham (1)')
expect(field.display_element).to have_text('ham')
expect(field.display_element).to have_text('onions')
@@ -201,9 +199,9 @@ RSpec.describe "multi select custom values",
expect(field.display_element).to have_text('mushrooms')
# Expect changed groups
- expect(page).to have_selector('.group--value .count', count: 2)
- expect(page).to have_selector('.group--value', text: 'ham, mushrooms, onions, pineapple (1)')
- expect(page).to have_selector('.group--value', text: 'ham (1)')
+ expect(page).to have_css('.group--value .count', count: 2)
+ expect(page).to have_css('.group--value', text: 'ham, mushrooms, onions, pineapple (1)')
+ expect(page).to have_css('.group--value', text: 'ham (1)')
wp1_field.expect_state_text ", ...4"
end
diff --git a/spec/features/custom_fields/multi_version_custom_field_spec.rb b/spec/features/custom_fields/multi_version_custom_field_spec.rb
index 484becbcda6..1fa7fbff6b6 100644
--- a/spec/features/custom_fields/multi_version_custom_field_spec.rb
+++ b/spec/features/custom_fields/multi_version_custom_field_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
require "support/pages/work_packages/abstract_work_package"
-RSpec.describe "multi version custom field", js: true do
+RSpec.describe "multi version custom field", :js do
shared_let(:admin) { create(:admin) }
let(:current_user) { admin }
let(:wp_page) { Pages::FullWorkPackage.new work_package }
@@ -67,8 +67,8 @@ RSpec.describe "multi version custom field", js: true do
wp_page.expect_and_dismiss_toaster(message: "Successful update.")
expect(page).to have_text "Version Old"
- expect(page).not_to have_text "Version Current"
- expect(page).not_to have_text "Version Future"
+ expect(page).to have_no_text "Version Current"
+ expect(page).to have_no_text "Version Future"
work_package.reload
@@ -105,12 +105,12 @@ RSpec.describe "multi version custom field", js: true do
click_on "Fix version: Save"
wp_page.expect_and_dismiss_toaster(message: "Successful update.")
# .customField<ID> above is required to ignore Assignee and Accountable which are not interesting for us.
- expect(page).to have_selector(".customField#{custom_field.id} .custom-option", count: 2)
+ expect(page).to have_css(".customField#{custom_field.id} .custom-option", count: 2)
expect(page).to have_text custom_field.name
expect(page).to have_text "Version Current"
expect(page).to have_text "Version Future"
- expect(page).not_to have_text "Version Old"
+ expect(page).to have_no_text "Version Old"
end
end
end
diff --git a/spec/features/custom_fields/non_open_version_custom_field_spec.rb b/spec/features/custom_fields/non_open_version_custom_field_spec.rb
index bd67c470417..52db22192ba 100644
--- a/spec/features/custom_fields/non_open_version_custom_field_spec.rb
+++ b/spec/features/custom_fields/non_open_version_custom_field_spec.rb
@@ -48,9 +48,9 @@ RSpec.describe "support for non-open version values in version custom field", :j
wp_page.expect_and_dismiss_toaster(message: "Successful update.")
expect(page).to have_text custom_field.name
- expect(page).not_to have_text "Version Open"
+ expect(page).to have_no_text "Version Open"
expect(page).to have_text "Version Locked"
- expect(page).not_to have_text "Version Closed"
+ expect(page).to have_no_text "Version Closed"
work_package.reload
@@ -109,7 +109,7 @@ RSpec.describe "support for non-open version values in version custom field", :j
expect(page).to have_text custom_field.name
expect(page).to have_text "Version Open"
expect(page).to have_text "Version Locked"
- expect(page).not_to have_text "Version Closed"
+ expect(page).to have_no_text "Version Closed"
work_package.reload
@@ -158,8 +158,8 @@ RSpec.describe "support for non-open version values in version custom field", :j
# We'll just check the options and nothing more, the rest is checked elsewhere
cf_edit_field.activate!
expect(page).to have_text "Version Open"
- expect(page).not_to have_text "Version Locked"
- expect(page).not_to have_text "Version Closed"
+ expect(page).to have_no_text "Version Locked"
+ expect(page).to have_no_text "Version Closed"
end
end
end
diff --git a/spec/features/custom_fields/reorder_options_spec.rb b/spec/features/custom_fields/reorder_options_spec.rb
index 706d34e1bdc..a3ffa99f9e1 100644
--- a/spec/features/custom_fields/reorder_options_spec.rb
+++ b/spec/features/custom_fields/reorder_options_spec.rb
@@ -13,7 +13,7 @@ def get_possible_values_reordered(amount)
get_possible_values(amount).sort
end
-RSpec.describe 'Reordering custom options of a list custom field', js: true do
+RSpec.describe 'Reordering custom options of a list custom field', :js do
let(:user) { create(:admin) }
let(:cf_page) { Pages::CustomFields.new }
@@ -38,7 +38,7 @@ RSpec.describe 'Reordering custom options of a list custom field', js: true do
click_link 'Reorder values alphabetically'
cf_page.accept_alert_dialog!
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
expect(custom_field.custom_options.order(:position).pluck(:value))
.to eq get_possible_values_reordered(200)
end
diff --git a/spec/features/errors/errors_handler_spec.rb b/spec/features/errors/errors_handler_spec.rb
index 47095353a51..a8d227a7cb3 100644
--- a/spec/features/errors/errors_handler_spec.rb
+++ b/spec/features/errors/errors_handler_spec.rb
@@ -7,7 +7,7 @@ RSpec.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).not_to have_text "Oh no, this is an internal error!"
+ expect(page).to have_no_text "Oh no, this is an internal error!"
end
it 'renders the not found page' do
diff --git a/spec/features/forums/attachment_upload_spec.rb b/spec/features/forums/attachment_upload_spec.rb
index 379896c3b4b..5cf00c74156 100644
--- a/spec/features/forums/attachment_upload_spec.rb
+++ b/spec/features/forums/attachment_upload_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe 'Upload attachment to forum message', :js do
click_button 'Create'
- expect(page).to have_selector('#content .wiki img', count: 1)
+ expect(page).to have_css('#content .wiki img', count: 1)
expect(page).to have_content('Image uploaded on creation')
attachments_list.expect_attached('image.png')
@@ -83,7 +83,7 @@ RSpec.describe 'Upload attachment to forum message', :js do
click_button 'Save'
- expect(page).to have_selector('#content .wiki img', count: 2)
+ expect(page).to have_css('#content .wiki img', count: 2)
expect(page).to have_content('Image uploaded on creation')
expect(page).to have_content('Image uploaded the second time')
diff --git a/spec/features/forums/message_spec.rb b/spec/features/forums/message_spec.rb
index ea868ad0997..5c3cceb7f5e 100644
--- a/spec/features/forums/message_spec.rb
+++ b/spec/features/forums/message_spec.rb
@@ -158,7 +158,7 @@ RSpec.describe 'messages', :js do
subject: 'And now to something completely different',
content: 'No, there really isn\'t')
- expect(page).to have_selector('blockquote', text: 'But, but there should be one')
+ expect(page).to have_css('blockquote', text: 'But, but there should be one')
# Quoting the first message
show_page.quote(subject: 'Also quoting the first message',
diff --git a/spec/features/forums/sticky_spec.rb b/spec/features/forums/sticky_spec.rb
index bd419119399..424ba63080c 100644
--- a/spec/features/forums/sticky_spec.rb
+++ b/spec/features/forums/sticky_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe 'sticky messages' do
def expect_order_of_messages(*order)
order.each_with_index do |message, index|
- expect(page).to have_selector("table tbody tr:nth-of-type(#{index + 1})", text: message.subject)
+ expect(page).to have_css("table tbody tr:nth-of-type(#{index + 1})", text: message.subject)
end
end
diff --git a/spec/features/global_roles/global_create_project_spec.rb b/spec/features/global_roles/global_create_project_spec.rb
index 7d5acafb930..8a6046568c3 100644
--- a/spec/features/global_roles/global_create_project_spec.rb
+++ b/spec/features/global_roles/global_create_project_spec.rb
@@ -48,8 +48,8 @@ RSpec.describe 'Global role: Global Create project',
# Then I should not see "Create project"
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).not_to have_selector('.form--label-with-check-box', text: 'Create project')
+ expect(page).to have_css('.form--label-with-check-box', text: 'Edit project')
+ expect(page).to have_no_css('.form--label-with-check-box', text: 'Create project')
end
end
@@ -65,8 +65,8 @@ RSpec.describe 'Global role: Global Create project',
it 'does show the global permission' do
visit edit_role_path(role)
- 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')
+ expect(page).to have_no_css('.form--label-with-check-box', text: 'Edit project')
+ expect(page).to have_css('.form--label-with-check-box', text: 'Create project')
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 b95ad35210b..c60b414f584 100644
--- a/spec/features/global_roles/global_role_assignment_spec.rb
+++ b/spec/features/global_roles/global_role_assignment_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
require_relative 'mock_global_permissions'
-RSpec.describe 'Global role: Global role assignment',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Global role: Global role assignment', :js, :with_cuprite do
before do
login_as current_user
end
@@ -62,7 +60,7 @@ RSpec.describe 'Global role: Global role assignment',
# 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).not_to have_text 'global_role1'
+ expect(page).to have_no_text 'global_role1'
expect(page).to have_text 'global_role2'
end
@@ -83,8 +81,8 @@ RSpec.describe 'Global role: Global role assignment',
# And I should not see "global_role1" within "#available_principal_roles"
# And I should not see "global_role2" within "#available_principal_roles"
page.within('#available_principal_roles') do
- expect(page).not_to have_text 'global_role1'
- expect(page).not_to have_text 'global_role2'
+ expect(page).to have_no_text 'global_role1'
+ expect(page).to have_no_text 'global_role2'
end
# And I delete the assigned role "global_role1"
@@ -98,13 +96,13 @@ RSpec.describe 'Global role: Global role assignment',
# And I should not see "global_role2" within "#available_principal_roles"
page.within('#available_principal_roles') do
expect(page).to have_text 'global_role1'
- expect(page).not_to have_text 'global_role2'
+ expect(page).to have_no_text 'global_role2'
end
# And I should not see "global_role1" within "#table_principal_roles"
# And I should see "global_role1" within "#table_principal_roles"
page.within('#table_principal_roles') do
- expect(page).not_to have_text 'global_role1'
+ expect(page).to have_no_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 9d4dd7f3abd..57150cfc011 100644
--- a/spec/features/global_roles/global_role_crud_spec.rb
+++ b/spec/features/global_roles/global_role_crud_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
require_relative 'mock_global_permissions'
-RSpec.describe 'Global role: Global role CRUD',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Global role: Global role CRUD', :js, :with_cuprite do
# Scenario: Global Role creation
# Given there is the global permission "glob_test" of the module "global_group"
include_context 'with mocked global permissions', [['glob_test', { project_module: 'global_group' }]]
@@ -46,17 +44,17 @@ RSpec.describe 'Global role: Global role CRUD',
# When I go to the new page of "Role"
visit new_role_path
# Then I should not see block with "#global_permissions"
- expect(page).not_to have_selector('.form--fieldset-legend', text: 'GLOBAL')
+ expect(page).to have_no_css('.form--fieldset-legend', text: 'GLOBAL')
# When I check "Global role"
check 'Global role'
# Then I should see block with "#global_permissions"
- expect(page).to have_selector('.form--fieldset-legend', text: 'GLOBAL')
+ expect(page).to have_css('.form--fieldset-legend', text: 'GLOBAL')
# And I should see "Global group"
expect(page).to have_text 'GLOBAL GROUP'
# And I should see "Glob test"
expect(page).to have_text 'Glob test'
# And I should not see "Issues can be assigned to this role"
- expect(page).not_to have_text 'Issues can be assigned to this role'
+ expect(page).to have_no_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/global_role_update_spec.rb b/spec/features/global_roles/global_role_update_spec.rb
index 82538980509..3ed2c1eb856 100644
--- a/spec/features/global_roles/global_role_update_spec.rb
+++ b/spec/features/global_roles/global_role_update_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Role updating', js: true, with_cuprite: true do
+RSpec.describe 'Role updating', :js, :with_cuprite do
let!(:admin) { create(:admin) }
before do
diff --git a/spec/features/global_roles/member_roles_spec.rb b/spec/features/global_roles/member_roles_spec.rb
index cf9cd08a4f1..5798f463586 100644
--- a/spec/features/global_roles/member_roles_spec.rb
+++ b/spec/features/global_roles/member_roles_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Global role: Unchanged Member Roles',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Global role: Unchanged Member Roles', :js, :with_cuprite do
let(:admin) { create(:admin) }
let(:project) { create(:project) }
let!(:role) { create(:project_role, name: 'MemberRole1') }
diff --git a/spec/features/global_roles/no_module_spec.rb b/spec/features/global_roles/no_module_spec.rb
index 71ad8613cc0..419070cd8c2 100644
--- a/spec/features/global_roles/no_module_spec.rb
+++ b/spec/features/global_roles/no_module_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
require_relative 'mock_global_permissions'
-RSpec.describe 'Global role: No module',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Global role: No module', :js, :with_cuprite do
let(:admin) { create(:admin) }
let(:project) { create(:project) }
let!(:role) { create(:project_role) }
@@ -54,6 +52,6 @@ RSpec.describe 'Global role: No module',
visit project_settings_modules_path(project)
expect(page).to have_text 'Activity'
- expect(page).not_to have_text 'Foo'
+ expect(page).to have_no_text 'Foo'
end
end
diff --git a/spec/features/groups/group_memberships_spec.rb b/spec/features/groups/group_memberships_spec.rb
index 4dbec3db9fe..6044195abe7 100644
--- a/spec/features/groups/group_memberships_spec.rb
+++ b/spec/features/groups/group_memberships_spec.rb
@@ -166,8 +166,8 @@ RSpec.describe 'group memberships through groups page', :js, :with_cuprite do
group_page.open_projects_tab!
target_dropdown = group_page.search_for_project 'project'
- expect(target_dropdown).to have_selector(".ng-option", text: 'Other project')
- expect(target_dropdown).not_to have_selector(".ng-option", text: 'Archived project')
+ expect(target_dropdown).to have_css(".ng-option", text: 'Other project')
+ expect(target_dropdown).to have_no_css(".ng-option", text: 'Archived project')
end
end
end
diff --git a/spec/features/groups/group_show_spec.rb b/spec/features/groups/group_show_spec.rb
index 69da1359a4b..bd401582d25 100644
--- a/spec/features/groups/group_show_spec.rb
+++ b/spec/features/groups/group_show_spec.rb
@@ -42,9 +42,9 @@ RSpec.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_selector('.toolbar-item', text: 'Edit')
- expect(page).to have_selector('li', text: member.name)
+ expect(page).to have_css('h2', text: "Bob's Team")
+ expect(page).to have_css('.toolbar-item', text: 'Edit')
+ expect(page).to have_css('li', text: member.name)
end
end
@@ -53,9 +53,9 @@ RSpec.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).not_to have_selector('.toolbar-item')
- expect(page).not_to have_selector('li', text: member.name)
+ expect(page).to have_css('h2', text: "Bob's Team")
+ expect(page).to have_no_css('.toolbar-item')
+ expect(page).to have_no_css('li', text: member.name)
end
end
end
diff --git a/spec/features/groups/groups_spec.rb b/spec/features/groups/groups_spec.rb
index 3628cde31e3..9fc76a04a08 100644
--- a/spec/features/groups/groups_spec.rb
+++ b/spec/features/groups/groups_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'group memberships through groups page', :js, :with_cuprite do
groups_page.delete_group! "Bob's Team"
- expect(page).to have_selector('.op-toast.-info', text: I18n.t(:notice_deletion_scheduled))
+ expect(page).to have_css('.op-toast.-info', text: I18n.t(:notice_deletion_scheduled))
expect(groups_page).to have_group "Bob's Team"
perform_enqueued_jobs
diff --git a/spec/features/homescreen/index_spec.rb b/spec/features/homescreen/index_spec.rb
index 19d2cdc5cc0..2a20840dafe 100644
--- a/spec/features/homescreen/index_spec.rb
+++ b/spec/features/homescreen/index_spec.rb
@@ -55,13 +55,13 @@ RSpec.describe 'Homescreen', 'index', :with_cuprite do
login_as user
visit root_url
expect(page)
- .to have_selector("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]")
+ .to have_css("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]")
click_link "a link to the public project"
expect(page).to have_current_path project_path(project)
end
- it 'can change the welcome text and still have a valid link', js: true do
+ it 'can change the welcome text and still have a valid link', :js do
login_as admin
general_settings_page.visit!
@@ -75,7 +75,7 @@ RSpec.describe 'Homescreen', 'index', :with_cuprite do
visit root_url
expect(page)
- .to have_selector("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]")
+ .to have_css("a[href=\"#{OpenProject::Application.root_url}/projects/public-project\"]")
click_link "a link to the public project"
expect(page).to have_current_path /#{Regexp.escape(project_path(project))}\/?$/
diff --git a/spec/features/ldap_auth_sources/crud_spec.rb b/spec/features/ldap_auth_sources/crud_spec.rb
index 326d5da16f2..24a66d38277 100644
--- a/spec/features/ldap_auth_sources/crud_spec.rb
+++ b/spec/features/ldap_auth_sources/crud_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'CRUD LDAP connections',
- js: true,
- with_cuprite: true do
+RSpec.describe 'CRUD LDAP connections', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
let(:ldap_page) { Pages::Admin::LdapAuthSources::Index.new }
@@ -57,8 +55,8 @@ RSpec.describe 'CRUD LDAP connections',
click_on 'Create'
ldap_page.expect_and_dismiss_toaster message: 'Successful creation.'
- expect(page).to have_selector('td.name', text: 'My LDAP connection')
- expect(page).to have_selector('td.host', text: 'localhost')
+ expect(page).to have_css('td.name', text: 'My LDAP connection')
+ expect(page).to have_css('td.host', text: 'localhost')
created_connection = LdapAuthSource.last
connection = created_connection.dup
@@ -77,11 +75,11 @@ RSpec.describe 'CRUD LDAP connections',
ldap_page.expect_and_dismiss_toaster message: 'Successful deletion.'
- expect(page).not_to have_text 'My LDAP connection'
+ expect(page).to have_no_text 'My LDAP connection'
expect(page).to have_text 'Admin connection'
page.within("#ldap-auth-source-#{connection.id}") do
- expect(page).not_to have_link 'Delete'
+ expect(page).to have_no_link 'Delete'
end
page.within("#ldap-auth-source-#{connection.id}") do
@@ -93,7 +91,7 @@ RSpec.describe 'CRUD LDAP connections',
click_on 'Save'
ldap_page.expect_and_dismiss_toaster message: 'Successful update.'
- expect(page).to have_selector('td.name', text: 'Updated Admin connection')
+ expect(page).to have_css('td.name', text: 'Updated Admin connection')
end
context 'when providing seed variables',
@@ -115,7 +113,7 @@ RSpec.describe 'CRUD LDAP connections',
expect(page).to have_text(I18n.t(:label_seeded_from_env_warning))
expect(page).to have_field('ldap_auth_source_name', with: 'foobar', disabled: true)
- expect(page).not_to have_button 'Save'
+ expect(page).to have_no_button 'Save'
end
end
end
diff --git a/spec/features/members/error_messages_spec.rb b/spec/features/members/error_messages_spec.rb
index c6b207109c3..6c3646bdf5a 100644
--- a/spec/features/members/error_messages_spec.rb
+++ b/spec/features/members/error_messages_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe 'Group memberships through groups page' do
end
shared_examples 'errors when adding members' do
- it 'adding a role without a principal', js: true do
+ it 'adding a role without a principal', :js do
members_page.visit!
expect_angular_frontend_initialized
members_page.add_user! nil, as: 'Manager'
diff --git a/spec/features/members/invitation_spec.rb b/spec/features/members/invitation_spec.rb
index 41e90b6a1f3..53629341fb9 100644
--- a/spec/features/members/invitation_spec.rb
+++ b/spec/features/members/invitation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'invite user via email', js: true do
+RSpec.describe 'invite user via email', :js do
let!(:project) { create(:project, name: 'Project 1', identifier: 'project1', members: project_members) }
let!(:developer) { create(:project_role, name: 'Developer') }
let(:project_members) { {} }
@@ -86,8 +86,8 @@ RSpec.describe 'invite user via email', js: true do
members_page.search_and_select_principal! '[email protected]',
'Send invite to [email protected]'
- expect(members_page).not_to have_text sanitize_string(I18n.t(:warning_user_limit_reached)),
- normalize_ws: true
+ expect(members_page).to have_no_text sanitize_string(I18n.t(:warning_user_limit_reached)),
+ normalize_ws: true
members_page.search_and_select_principal! '[email protected]',
'Send invite to [email protected]'
diff --git a/spec/features/members/membership_filter_spec.rb b/spec/features/members/membership_filter_spec.rb
index ad00142b074..1d96a2e9d29 100644
--- a/spec/features/members/membership_filter_spec.rb
+++ b/spec/features/members/membership_filter_spec.rb
@@ -63,19 +63,19 @@ RSpec.describe 'group memberships through groups page', :js do
members_page.search_for_name 'pan'
members_page.find_user 'Pan Hannibal'
- expect(page).not_to have_selector('td.mail', text: hannibal.mail)
+ expect(page).to have_no_css('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).not_to have_selector('td.mail', text: hannibal.mail)
+ expect(page).to have_no_css('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).not_to have_selector('td.mail', text: hannibal.mail)
+ expect(page).to have_no_css('td.mail', text: hannibal.mail)
end
end
diff --git a/spec/features/members/membership_spec.rb b/spec/features/members/membership_spec.rb
index 135b5b60ef6..304f708083e 100644
--- a/spec/features/members/membership_spec.rb
+++ b/spec/features/members/membership_spec.rb
@@ -100,8 +100,8 @@ RSpec.describe 'Administrating memberships via the project settings', :js, :with
expect(members_page.contents('status', raw: true)).to eq %w(invited active active)
# Cannot sort by group, roles or status
- 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')
+ expect(page).to have_no_css('.generic-table--sort-header a', text: 'ROLES')
+ expect(page).to have_no_css('.generic-table--sort-header a', text: 'GROUP')
end
it 'navigating the menu' do
@@ -143,7 +143,7 @@ RSpec.describe 'Administrating memberships via the project settings', :js, :with
members_page.add_user! 'A-Team', as: 'Manager'
expect(members_page).to have_added_group('A-Team')
- expect(page).to have_selector '.op-avatar_group'
+ expect(page).to have_css '.op-avatar_group'
SeleniumHubWaiter.wait
members_page.remove_group! 'A-Team'
@@ -155,7 +155,7 @@ RSpec.describe 'Administrating memberships via the project settings', :js, :with
members_page.add_user! 'Hannibal Smith', as: 'Manager'
expect(members_page).to have_added_user 'Hannibal Smith'
- expect(page).to have_selector '.op-avatar_user'
+ expect(page).to have_css '.op-avatar_user'
SeleniumHubWaiter.wait
members_page.remove_user! 'Hannibal Smith'
@@ -167,7 +167,7 @@ RSpec.describe 'Administrating memberships via the project settings', :js, :with
members_page.add_user! developer_placeholder.name, as: developer.name
expect(members_page).to have_added_user developer_placeholder.name
- expect(page).to have_selector '.op-avatar_placeholder-user'
+ expect(page).to have_css '.op-avatar_placeholder-user'
SeleniumHubWaiter.wait
members_page.remove_user! developer_placeholder.name
diff --git a/spec/features/members/pagination_spec.rb b/spec/features/members/pagination_spec.rb
index 4e7f9674647..56f0b6b2636 100644
--- a/spec/features/members/pagination_spec.rb
+++ b/spec/features/members/pagination_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'members pagination', js: true do
+RSpec.describe 'members pagination', :js do
shared_let(:admin) { create(:admin) }
let(:project) do
create(:project,
diff --git a/spec/features/menu_items/help_menu_spec.rb b/spec/features/menu_items/help_menu_spec.rb
index 157f465d736..2e9c27e3974 100644
--- a/spec/features/menu_items/help_menu_spec.rb
+++ b/spec/features/menu_items/help_menu_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Help menu items',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Help menu items', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:help_item) { find('.op-app-help .op-app-menu--item-action') }
let(:help_menu_dropdown_selector) { '.op-app-menu--dropdown.op-menu' }
@@ -45,8 +43,8 @@ RSpec.describe 'Help menu items',
help_item.click
- expect(page).to have_selector('.op-app-help .op-menu--item-action',
- text: I18n.t('homescreen.links.user_guides'))
+ expect(page).to have_css('.op-app-help .op-menu--item-action',
+ text: I18n.t('homescreen.links.user_guides'))
end
end
@@ -62,7 +60,7 @@ RSpec.describe 'Help menu items',
visit home_path
expect(help_item[:href]).to eq(custom_url)
- expect(page).not_to have_selector('.op-app-help .op-app-menu--dropdown', visible: false)
+ expect(page).to have_no_css('.op-app-help .op-app-menu--dropdown', visible: false)
end
end
diff --git a/spec/features/menu_items/menu_permissions_spec.rb b/spec/features/menu_items/menu_permissions_spec.rb
index 833b9504d67..de1aba6a07c 100644
--- a/spec/features/menu_items/menu_permissions_spec.rb
+++ b/spec/features/menu_items/menu_permissions_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'menu permissions',
- js: true,
- with_cuprite: true do
+RSpec.describe 'menu permissions', :js, :with_cuprite do
let(:user) do
create(:user,
member_with_permissions: { project => %i[manage_versions view_work_packages] })
@@ -48,14 +46,14 @@ RSpec.describe 'menu permissions',
end
it 'I can see all menu entries' do
- expect(page).to have_selector('#menu-sidebar .op-menu--item-title', text: 'Versions')
- expect(page).to have_selector('#menu-sidebar .op-menu--item-title', text: 'Information')
- expect(page).to have_selector('#menu-sidebar .op-menu--item-title', text: 'Modules')
+ expect(page).to have_css('#menu-sidebar .op-menu--item-title', text: 'Versions')
+ expect(page).to have_css('#menu-sidebar .op-menu--item-title', text: 'Information')
+ expect(page).to have_css('#menu-sidebar .op-menu--item-title', text: 'Modules')
end
specify 'the parent node directs to the general settings page' do
# The settings menu item exists
- expect(page).to have_selector('#menu-sidebar .main-item-wrapper', text: 'Project settings', visible: false)
+ expect(page).to have_css('#menu-sidebar .main-item-wrapper', text: 'Project settings', visible: false)
# Clicking the menu parent item leads to the version page
find('.main-menu--parent-node', text: 'Project settings').click
@@ -72,14 +70,14 @@ RSpec.describe 'menu permissions',
end
it 'I can only see the version settings page' do
- expect(page).to have_selector('#menu-sidebar .op-menu--item-title', text: 'Versions')
- expect(page).not_to have_selector('#menu-sidebar .op-menu--item-title', text: 'Information')
- expect(page).not_to have_selector('#menu-sidebar .op-menu--item-title', text: 'Modules')
+ expect(page).to have_css('#menu-sidebar .op-menu--item-title', text: 'Versions')
+ expect(page).to have_no_css('#menu-sidebar .op-menu--item-title', text: 'Information')
+ expect(page).to have_no_css('#menu-sidebar .op-menu--item-title', text: 'Modules')
end
specify 'the parent node directs to the only visible children page' do
# The settings menu item exists
- expect(page).to have_selector('#menu-sidebar .main-item-wrapper', text: 'Project settings', visible: false)
+ expect(page).to have_css('#menu-sidebar .main-item-wrapper', text: 'Project settings', visible: false)
# Clicking the menu parent item leads to the version page
find('.main-menu--parent-node', text: 'Project settings').click
diff --git a/spec/features/menu_items/query_menu_item_spec.rb b/spec/features/menu_items/query_menu_item_spec.rb
index 454f6eef44a..e03c144309f 100644
--- a/spec/features/menu_items/query_menu_item_spec.rb
+++ b/spec/features/menu_items/query_menu_item_spec.rb
@@ -31,9 +31,7 @@ require 'features/page_objects/notification'
require 'features/work_packages/shared_contexts'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Query menu items',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Query menu items', :js, :with_cuprite do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_packages_page) { WorkPackagesPage.new(project) }
@@ -95,7 +93,7 @@ RSpec.describe 'Query menu items',
click_on 'Save'
notification.expect_success('Successful update')
- expect(page).to have_selector('.op-sidemenu--item', text: query.name)
+ expect(page).to have_css('.op-sidemenu--item', text: query.name)
end
end
@@ -137,7 +135,7 @@ RSpec.describe 'Query menu items',
it 'is renaming and reordering the list' do
# Renaming the query should also reorder the queries. As it is renamed
# from zzzz to aaaa, it should now be the first query menu item.
- expect(page).to have_selector('.op-sidemenu--items li:first-child', text: new_name)
+ expect(page).to have_css('.op-sidemenu--items li:first-child', text: new_name)
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 557496f80c8..46c511999a1 100644
--- a/spec/features/menu_items/top_menu_item_spec.rb
+++ b/spec/features/menu_items/top_menu_item_spec.rb
@@ -39,14 +39,14 @@ RSpec.describe 'Top menu items', :js, :with_cuprite do
expect(page).to have_link(item.label)
end
(all_items - items).each do |item|
- expect(page).not_to have_link(item.label)
+ expect(page).to have_no_link(item.label)
end
end
end
def click_link_in_open_menu(title)
within '.op-app-menu--dropdown[aria-expanded=true]' do
- expect(page).not_to have_css('[style~=overflow]')
+ expect(page).to have_no_css('[style~=overflow]')
click_link(title)
end
@@ -180,7 +180,7 @@ RSpec.describe 'Top menu items', :js, :with_cuprite do
it 'does not display new_project' do
expect(page).to have_css('a.button', exact_text: all_projects)
- expect(page).not_to have_css('a.button', exact_text: add_project)
+ expect(page).to have_no_css('a.button', exact_text: add_project)
end
end
@@ -195,7 +195,7 @@ RSpec.describe 'Top menu items', :js, :with_cuprite do
end
it 'does not show the menu' do
- expect(page).not_to have_css('#projects-menu')
+ expect(page).to have_no_css('#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 bfff2d7e640..bc60a2f588e 100644
--- a/spec/features/menu_items/wiki_menu_item_spec.rb
+++ b/spec/features/menu_items/wiki_menu_item_spec.rb
@@ -99,12 +99,12 @@ RSpec.describe 'Wiki menu items' do
click_button "Save"
expect(page)
- .to have_selector('.main-menu--children-menu-header', text: wiki_page.title)
+ .to have_css('.main-menu--children-menu-header', text: wiki_page.title)
find('.main-menu--arrow-left-to-project').click
expect(page)
- .to have_selector('.main-item-wrapper', text: wiki_page.title)
+ .to have_css('.main-item-wrapper', text: wiki_page.title)
# clicking the menu item leads to the page
click_link wiki_page.title
@@ -127,10 +127,10 @@ RSpec.describe 'Wiki menu items' do
# the other page is now the main heading
expect(page)
- .to have_selector('.main-menu--children-menu-header', text: other_wiki_page.title)
+ .to have_css('.main-menu--children-menu-header', text: other_wiki_page.title)
expect(page)
- .to have_selector('.wiki-menu--sub-item', text: 'Custom page name')
+ .to have_css('.wiki-menu--sub-item', text: 'Custom page name')
click_link 'Custom page name'
@@ -141,7 +141,7 @@ RSpec.describe 'Wiki menu items' do
find('.main-menu--arrow-left-to-project').click
expect(page)
- .not_to have_selector('.main-item-wrapper', text: 'Custom page name')
+ .to have_no_css('.main-item-wrapper', text: 'Custom page name')
# deleting the page will remove the menu item
visit project_wiki_path(project, wiki_page)
@@ -152,7 +152,7 @@ RSpec.describe 'Wiki menu items' do
end
within '#menu-sidebar' do
- expect(page).not_to have_content('Custom page name')
+ expect(page).to have_no_content('Custom page name')
end
# removing the menu item which is also the last wiki menu item
@@ -173,9 +173,9 @@ RSpec.describe 'Wiki menu items' do
click_button 'Save'
expect(page)
- .not_to have_selector('.main-menu--children-menu-header', text: other_wiki_page.title)
+ .to have_no_css('.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)
+ .to have_css('.main-menu--children-menu-header', text: another_wiki_page.title)
end
end
diff --git a/spec/features/my/autologin_tokens_management_spec.rb b/spec/features/my/autologin_tokens_management_spec.rb
index 4bc0e93af27..ec3c6e4971a 100644
--- a/spec/features/my/autologin_tokens_management_spec.rb
+++ b/spec/features/my/autologin_tokens_management_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'My account autologin tokens management', :js, :with_cuprite do
context 'with autologin disabled', with_settings: { autologin: 0 } do
it 'does not show tokens' do
- expect(page).not_to have_text "Remembered devices"
+ expect(page).to have_no_text "Remembered devices"
expect(page).not_to have_test_selector('Users::AutoLoginTokens::TableComponent')
end
end
@@ -58,12 +58,12 @@ RSpec.describe 'My account autologin tokens management', :js, :with_cuprite do
expect(trs[0]).to have_text('unknown browser')
expect(trs[0]).to have_text('unknown operating system')
expect(trs[0]).to have_css('.buttons a')
- expect(trs[0]).not_to have_css('.icon-yes')
+ expect(trs[0]).to have_no_css('.icon-yes')
expect(trs[0]).to have_text format_date(1.year.ago + 1.day)
expect(trs[1]).to have_text('Mozilla Firefox (Version 12.3)')
expect(trs[1]).to have_text('Linux')
- expect(trs[1]).not_to have_css('.icon-yes')
+ expect(trs[1]).to have_no_css('.icon-yes')
expect(trs[1]).to have_css('.buttons a')
expect(trs[1]).to have_text format_date(1.day.from_now)
diff --git a/spec/features/my/sessions_management_spec.rb b/spec/features/my/sessions_management_spec.rb
index b901fc70406..20c5171838a 100644
--- a/spec/features/my/sessions_management_spec.rb
+++ b/spec/features/my/sessions_management_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'My account session management', js: true do
+RSpec.describe 'My account session management', :js do
include Redmine::I18n
let(:user) { create(:user) }
@@ -51,18 +51,18 @@ RSpec.describe 'My account session management', js: true do
click_on 'Session management'
page.within_test_selector('Users::Sessions::TableComponent') do
- expect(page).to have_selector('.generic-table tbody tr', count: 2)
+ expect(page).to have_css('.generic-table tbody tr', count: 2)
trs = page.all('.generic-table tbody tr')
- expect(trs[0]).to have_selector('.icon-yes')
+ expect(trs[0]).to have_css('.icon-yes')
expect(trs[0]).to have_text('Current session')
expect(trs[0]).to have_text('unknown browser')
expect(trs[0]).to have_text('unknown operating system')
- expect(trs[0]).not_to have_selector('.buttons a')
- expect(trs[1]).not_to have_selector('.spot-icon_yes')
+ expect(trs[0]).to have_no_css('.buttons a')
+ expect(trs[1]).to have_no_css('.spot-icon_yes')
expect(trs[1]).to have_text('Mozilla Firefox (Version 12.3)')
expect(trs[1]).to have_text('Linux')
expect(trs[1]).to have_text format_time(old_session_time)
- expect(trs[1]).to have_selector('.buttons a')
+ expect(trs[1]).to have_css('.buttons a')
trs[1].find('.buttons a').click
end
@@ -70,7 +70,7 @@ RSpec.describe 'My account session management', js: true do
page.driver.browser.switch_to.alert.accept
page.within_test_selector('Users::Sessions::TableComponent') do
- expect(page).to have_selector('.generic-table tbody tr', count: 1)
+ expect(page).to have_css('.generic-table tbody tr', count: 1)
end
expect { user_session.reload }.to raise_error(ActiveRecord::RecordNotFound)
diff --git a/spec/features/news/creation_and_commenting_spec.rb b/spec/features/news/creation_and_commenting_spec.rb
index 067d417a177..76ff2000fd2 100644
--- a/spec/features/news/creation_and_commenting_spec.rb
+++ b/spec/features/news/creation_and_commenting_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe 'News creation and commenting', :js, :with_cuprite do
.to eq 1
expect(ActionMailer::Base.deliveries.last.to)
- .to match_array [other_user.mail]
+ .to contain_exactly(other_user.mail)
expect(ActionMailer::Base.deliveries.last.subject)
.to include 'My new news'
@@ -93,7 +93,7 @@ RSpec.describe 'News creation and commenting', :js, :with_cuprite do
.to eq 2
expect(ActionMailer::Base.deliveries.last.to)
- .to match_array [other_user.mail]
+ .to contain_exactly(other_user.mail)
expect(ActionMailer::Base.deliveries.last.subject)
.to include 'My new news'
diff --git a/spec/features/news/global_menu_item_spec.rb b/spec/features/news/global_menu_item_spec.rb
index 3c7506069a1..4b68172028c 100644
--- a/spec/features/news/global_menu_item_spec.rb
+++ b/spec/features/news/global_menu_item_spec.rb
@@ -51,7 +51,7 @@ RSpec.describe 'News global menu item spec', :js, :with_cuprite do
expect(page).to have_current_path(news_index_path)
within '#main-menu' do
- expect(page).to have_selector('.selected', text: 'News')
+ expect(page).to have_css('.selected', text: 'News')
end
end
end
@@ -61,7 +61,7 @@ RSpec.describe 'News global menu item spec', :js, :with_cuprite do
it "doesn't render the menu item" do
within '#main-menu' do
- expect(page).not_to have_link 'News'
+ expect(page).to have_no_link 'News'
end
end
end
diff --git a/spec/features/notifications/navigation_spec.rb b/spec/features/notifications/navigation_spec.rb
index 95f79afb89d..28296f3c42c 100644
--- a/spec/features/notifications/navigation_spec.rb
+++ b/spec/features/notifications/navigation_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe "Notification center navigation", js: true, with_cuprite: true do
+RSpec.describe "Notification center navigation", :js, :with_cuprite do
shared_association_default(:project) { create(:project) }
shared_let(:work_package) { create(:work_package, project:) }
diff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
index 35b04ea9cbf..f5d25a3b493 100644
--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
@@ -2,9 +2,7 @@ require 'spec_helper'
require 'features/page_objects/notification'
# rubocop:disable RSpec/ScatteredLet
-RSpec.describe "Notification center date alerts",
- js: true,
- with_cuprite: true,
+RSpec.describe "Notification center date alerts", :js, :with_cuprite,
with_settings: { journal_aggregation_time_minutes: 0 } do
include ActiveSupport::Testing::TimeHelpers
diff --git a/spec/features/notifications/notification_center/notification_center_spec.rb b/spec/features/notifications/notification_center/notification_center_spec.rb
index eb260d66cc6..e2c10e9dc37 100644
--- a/spec/features/notifications/notification_center/notification_center_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe "Notification center", :js, :with_cuprite,
describe 'notification for a new journal' do
current_user { recipient }
- it 'will not show all details of the journal' do
+ it 'does not show all details of the journal' do
visit home_path
wait_for_reload
center.expect_bell_count 2
diff --git a/spec/features/notifications/notification_center/split_screen_spec.rb b/spec/features/notifications/notification_center/split_screen_spec.rb
index bf81b401255..afe4ca0d5e3 100644
--- a/spec/features/notifications/notification_center/split_screen_spec.rb
+++ b/spec/features/notifications/notification_center/split_screen_spec.rb
@@ -1,8 +1,6 @@
require 'spec_helper'
-RSpec.describe "Split screen in the notification center",
- js: true,
- with_cuprite: true do
+RSpec.describe "Split screen in the notification center", :js, :with_cuprite do
let(:global_html_title) { Components::HtmlTitle.new }
let(:center) { Pages::Notifications::Center.new }
let(:split_screen) { Pages::Notifications::SplitScreen.new work_package }
diff --git a/spec/features/notifications/reminder_mail_spec.rb b/spec/features/notifications/reminder_mail_spec.rb
index 1fd43fffd3c..1ffc320e21a 100644
--- a/spec/features/notifications/reminder_mail_spec.rb
+++ b/spec/features/notifications/reminder_mail_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative '../users/notifications/shared_examples'
-RSpec.describe "Reminder email sending", js: true, with_cuprite: true do
+RSpec.describe "Reminder email sending", :js, :with_cuprite do
let!(:project) { create(:project, members: { current_user => role }) }
let!(:mute_project) { create(:project, members: { current_user => role }) }
let(:role) { create(:project_role, permissions: %i[view_work_packages]) }
diff --git a/spec/features/notifications/settings/immediate_reminder_spec.rb b/spec/features/notifications/settings/immediate_reminder_spec.rb
index 8895e4924ea..8ed9850430b 100644
--- a/spec/features/notifications/settings/immediate_reminder_spec.rb
+++ b/spec/features/notifications/settings/immediate_reminder_spec.rb
@@ -1,8 +1,6 @@
require 'spec_helper'
-RSpec.describe "Immediate reminder settings",
- js: true,
- with_cuprite: true do
+RSpec.describe "Immediate reminder settings", :js, :with_cuprite do
shared_examples 'immediate reminder settings' do
it 'allows to configure the reminder settings' do
# Save prefs so we can reload them later
diff --git a/spec/features/notifications/settings/pause_reminder_settings_spec.rb b/spec/features/notifications/settings/pause_reminder_settings_spec.rb
index caa823e3b86..19c5a55cb1c 100644
--- a/spec/features/notifications/settings/pause_reminder_settings_spec.rb
+++ b/spec/features/notifications/settings/pause_reminder_settings_spec.rb
@@ -1,8 +1,6 @@
require 'spec_helper'
-RSpec.describe "Pause reminder settings",
- js: true,
- with_cuprite: true do
+RSpec.describe "Pause reminder settings", :js, :with_cuprite do
shared_examples 'pause reminder settings' do
let(:first) { Time.zone.today.beginning_of_month }
let(:last) { (Time.zone.today.beginning_of_month + 10.days) }
diff --git a/spec/features/notifications/settings/reminder_email_settings_spec.rb b/spec/features/notifications/settings/reminder_email_settings_spec.rb
index 83e1d1dd1e6..90d933f3f89 100644
--- a/spec/features/notifications/settings/reminder_email_settings_spec.rb
+++ b/spec/features/notifications/settings/reminder_email_settings_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative '../../users/notifications/shared_examples'
-RSpec.describe "Reminder email", js: true, with_cuprite: true do
+RSpec.describe "Reminder email", :js, :with_cuprite do
shared_examples 'reminder settings' do
it 'allows to configure the reminder settings' do
# Configure the digest
diff --git a/spec/features/notifications/settings/workdays_settings_spec.rb b/spec/features/notifications/settings/workdays_settings_spec.rb
index 0a13c99c321..2b3b2ee6b03 100644
--- a/spec/features/notifications/settings/workdays_settings_spec.rb
+++ b/spec/features/notifications/settings/workdays_settings_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe "Workday notification settings", js: true, with_cuprite: true do
+RSpec.describe "Workday notification settings", :js, :with_cuprite do
shared_examples 'workday settings' do
before do
current_user.language = locale
diff --git a/spec/features/oauth/authorization_code_flow_spec.rb b/spec/features/oauth/authorization_code_flow_spec.rb
index 94e5a838cd6..01477b34c1f 100644
--- a/spec/features/oauth/authorization_code_flow_spec.rb
+++ b/spec/features/oauth/authorization_code_flow_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'OAuth authorization code flow',
- js: true do
+RSpec.describe 'OAuth authorization code flow', :js do
let!(:user) { create(:user) }
let!(:redirect_uri) { 'urn:ietf:wg:oauth:2.0:oob' }
let!(:allowed_redirect_uri) { redirect_uri }
@@ -66,11 +65,11 @@ RSpec.describe 'OAuth authorization code flow',
login_with user.login, 'adminADMIN!', visit_signin_path: false
# We get to the authorization screen
- expect(page).to have_selector('h2', text: 'Authorize Cool API app!')
+ expect(page).to have_css('h2', text: 'Authorize Cool API app!')
# With the correct scope printed
- expect(page).to have_selector('li strong', text: I18n.t('oauth.scopes.api_v3'))
- expect(page).to have_selector('li', text: I18n.t('oauth.scopes.api_v3_text'))
+ expect(page).to have_css('li strong', text: I18n.t('oauth.scopes.api_v3'))
+ expect(page).to have_css('li', text: I18n.t('oauth.scopes.api_v3_text'))
SeleniumHubWaiter.wait
# Authorize
@@ -90,8 +89,8 @@ RSpec.describe 'OAuth authorization code flow',
visit my_account_path
click_on 'Access token'
- expect(page).to have_selector("#oauth-application-grant-#{app.id}", text: app.name)
- expect(page).to have_selector('td', text: app.name)
+ expect(page).to have_css("#oauth-application-grant-#{app.id}", text: app.name)
+ expect(page).to have_css('td', text: app.name)
# Revoke the application
within("#oauth-application-grant-#{app.id}") do
@@ -102,8 +101,8 @@ RSpec.describe 'OAuth authorization code flow',
page.driver.browser.switch_to.alert.accept
# Should be back on access_token path
- expect(page).to have_selector('.op-toast.-success')
- expect(page).not_to have_selector("[id^=oauth-application-grant]")
+ expect(page).to have_css('.op-toast.-success')
+ expect(page).to have_no_css("[id^=oauth-application-grant]")
expect(page).to have_current_path /\/my\/access_token/
@@ -119,8 +118,8 @@ RSpec.describe 'OAuth authorization code flow',
login_with user.login, 'adminADMIN!', visit_signin_path: false
# But we got no further
- expect(page).to have_selector('.op-toast.-error',
- text: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.')
+ expect(page).to have_css('.op-toast.-error',
+ text: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.')
# And also have no grant for this application
user.oauth_grants.reload
@@ -175,7 +174,7 @@ RSpec.describe 'OAuth authorization code flow',
login_with user.login, 'adminADMIN!', visit_signin_path: false
# We get to the authorization screen
- expect(page).to have_selector('h2', text: 'Authorize Cool API app!')
+ expect(page).to have_css('h2', text: 'Authorize Cool API app!')
# Authorize
find('input.button[value="Authorize"]').click
diff --git a/spec/features/oauth/pkce_spec.rb b/spec/features/oauth/pkce_spec.rb
index c7a62bc31ab..35322e39006 100644
--- a/spec/features/oauth/pkce_spec.rb
+++ b/spec/features/oauth/pkce_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'OAuth authorization code flow with PKCE',
- js: true do
+RSpec.describe 'OAuth authorization code flow with PKCE', :js do
let!(:user) { create(:user) }
let!(:redirect_uri) { 'urn:ietf:wg:oauth:2.0:oob' }
let!(:allowed_redirect_uri) { redirect_uri }
@@ -83,11 +82,11 @@ RSpec.describe 'OAuth authorization code flow with PKCE',
login_with user.login, 'adminADMIN!', visit_signin_path: false
# We get to the authorization screen
- expect(page).to have_selector('h2', text: 'Authorize Public mobile client')
+ expect(page).to have_css('h2', text: 'Authorize Public mobile client')
# With the correct scope printed
- expect(page).to have_selector('li strong', text: I18n.t('oauth.scopes.api_v3'))
- expect(page).to have_selector('li', text: I18n.t('oauth.scopes.api_v3_text'))
+ expect(page).to have_css('li strong', text: I18n.t('oauth.scopes.api_v3'))
+ expect(page).to have_css('li', text: I18n.t('oauth.scopes.api_v3_text'))
SeleniumHubWaiter.wait
# Authorize
@@ -107,7 +106,7 @@ RSpec.describe 'OAuth authorization code flow with PKCE',
visit my_account_path
click_on 'Access token'
- expect(page).to have_selector("#oauth-application-grant-#{app.id}", text: app.name)
- expect(page).to have_selector('td', text: app.name)
+ expect(page).to have_css("#oauth-application-grant-#{app.id}", text: app.name)
+ expect(page).to have_css('td', text: app.name)
end
end
diff --git a/spec/features/onboarding/onboarding_tour_spec.rb b/spec/features/onboarding/onboarding_tour_spec.rb
index 175c2018ee3..ccd8b8aecf1 100644
--- a/spec/features/onboarding/onboarding_tour_spec.rb
+++ b/spec/features/onboarding/onboarding_tour_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'onboarding tour for new users', js: true do
+RSpec.describe 'onboarding tour for new users', :js do
let(:user) { create(:admin) }
let(:project) do
create(:project, name: 'Demo project', identifier: 'demo-project', public: true,
@@ -66,7 +66,7 @@ RSpec.describe 'onboarding tour for new users', js: true do
it 'I can start the tour without selecting a language' do
visit home_path start_home_onboarding_tour: true
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_selector '.enjoyhint_next_btn:not(.enjoyhint_hide)'
+ expect(page).to have_css '.enjoyhint_next_btn:not(.enjoyhint_hide)'
end
context 'the tutorial does not start' do
@@ -103,7 +103,7 @@ RSpec.describe 'onboarding tour for new users', js: true do
# The tutorial appears
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_selector '.enjoyhint_next_btn:not(.enjoyhint_hide)'
+ expect(page).to have_css '.enjoyhint_next_btn:not(.enjoyhint_hide)'
end
end
@@ -127,21 +127,21 @@ RSpec.describe 'onboarding tour for new users', js: true do
it 'directly after the language selection' do
# The tutorial appears
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
- expect(page).to have_selector '.enjoyhint_next_btn:not(.enjoyhint_hide)'
+ expect(page).to have_css '.enjoyhint_next_btn:not(.enjoyhint_hide)'
end
it 'and I skip the tutorial' do
find('.enjoyhint_skip_btn').click
# The tutorial disappears
- 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'
+ expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
+ expect(page).to have_no_css '.enjoyhint_next_btn'
page.driver.browser.navigate.refresh
# The tutorial did not start again
- 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'
+ expect(page).to have_no_text sanitize_string(I18n.t('js.onboarding.steps.welcome')), normalize_ws: true
+ expect(page).to have_no_css '.enjoyhint_next_btn'
end
it 'and I continue the tutorial' do
diff --git a/spec/features/page_objects/notification.rb b/spec/features/page_objects/notification.rb
index 0bcbf791532..d894b34e7df 100644
--- a/spec/features/page_objects/notification.rb
+++ b/spec/features/page_objects/notification.rb
@@ -39,7 +39,7 @@ module PageObjects
def expect_type(type, message)
raise "Unimplemented type #{type}." unless types.include?(type)
- expect(page).to have_selector(".op-toast.-#{type}", text: message, wait: 10)
+ expect(page).to have_css(".op-toast.-#{type}", text: message, wait: 10)
end
def expect_success(message)
diff --git a/spec/features/placeholder_users/create_spec.rb b/spec/features/placeholder_users/create_spec.rb
index 264ed370d84..e7209916620 100644
--- a/spec/features/placeholder_users/create_spec.rb
+++ b/spec/features/placeholder_users/create_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe 'create placeholder users', :selenium do
new_placeholder_user_page.submit!
- expect(page).to have_selector('.op-toast', text: 'Successful creation.')
+ expect(page).to have_css('.op-toast', text: 'Successful creation.')
new_placeholder_user = PlaceholderUser.order(Arel.sql('id DESC')).first
diff --git a/spec/features/placeholder_users/delete_spec.rb b/spec/features/placeholder_users/delete_spec.rb
index dbc98751ec0..c3a45a94d60 100644
--- a/spec/features/placeholder_users/delete_spec.rb
+++ b/spec/features/placeholder_users/delete_spec.rb
@@ -35,21 +35,21 @@ RSpec.describe 'delete placeholder user', :js do
it 'can delete name' do
visit placeholder_user_path(placeholder_user)
- expect(page).to have_selector '.button', text: 'Delete'
+ expect(page).to have_css '.button', text: 'Delete'
visit edit_placeholder_user_path(placeholder_user)
- expect(page).to have_selector '.button', text: 'Delete'
+ expect(page).to have_css '.button', text: 'Delete'
click_on 'Delete'
# Expect to be on delete confirmation
- expect(page).to have_selector('.danger-zone--verification button[disabled]')
+ expect(page).to have_css('.danger-zone--verification button[disabled]')
fill_in 'name_verification', with: placeholder_user.name
- expect(page).to have_selector('.danger-zone--verification button:not([disabled])')
+ expect(page).to have_css('.danger-zone--verification button:not([disabled])')
click_on 'Delete'
- expect(page).to have_selector('.op-toast.-info', text: I18n.t(:notice_deletion_scheduled))
+ expect(page).to have_css('.op-toast.-info', text: I18n.t(:notice_deletion_scheduled))
# The user is still there
placeholder_user.reload
@@ -89,11 +89,11 @@ RSpec.describe 'delete placeholder user', :js do
visit placeholder_user_path(placeholder_user)
- expect(page).to have_selector '.button.-disabled', text: 'Delete'
+ expect(page).to have_css '.button.-disabled', text: 'Delete'
visit edit_placeholder_user_path(placeholder_user)
- expect(page).to have_selector '.button.-disabled', text: 'Delete'
+ expect(page).to have_css '.button.-disabled', text: 'Delete'
end
end
diff --git a/spec/features/placeholder_users/edit_placeholder_users_spec.rb b/spec/features/placeholder_users/edit_placeholder_users_spec.rb
index 759202e3634..46f4274f283 100644
--- a/spec/features/placeholder_users/edit_placeholder_users_spec.rb
+++ b/spec/features/placeholder_users/edit_placeholder_users_spec.rb
@@ -35,13 +35,13 @@ RSpec.describe 'edit placeholder users', :js do
it 'can edit name' do
visit edit_placeholder_user_path(placeholder_user)
- expect(page).to have_selector '#placeholder_user_name'
+ expect(page).to have_css '#placeholder_user_name'
fill_in 'placeholder_user[name]', with: 'NewName', fill_options: { clear: :backspace }
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.')
placeholder_user.reload
diff --git a/spec/features/placeholder_users/placeholder_user_memberships_spec.rb b/spec/features/placeholder_users/placeholder_user_memberships_spec.rb
index 49ef44eb5f5..1ddabc11b4c 100644
--- a/spec/features/placeholder_users/placeholder_user_memberships_spec.rb
+++ b/spec/features/placeholder_users/placeholder_user_memberships_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative '../principals/shared_memberships_examples'
-RSpec.describe 'placeholder user memberships through placeholder user page', js: true do
+RSpec.describe 'placeholder user memberships through placeholder user page', :js do
shared_let(:principal) { create(:placeholder_user, name: 'UX Designer') }
shared_let(:principal_page) { Pages::Admin::IndividualPrincipals::Edit.new(principal) }
diff --git a/spec/features/principals/shared_memberships_examples.rb b/spec/features/principals/shared_memberships_examples.rb
index 13f1c7b9cf4..0221d36bd10 100644
--- a/spec/features/principals/shared_memberships_examples.rb
+++ b/spec/features/principals/shared_memberships_examples.rb
@@ -30,7 +30,7 @@ RSpec.shared_examples 'principal membership management flows' do
principal_page.expect_project(project.name)
principal_page.edit_roles!(member, %w())
- expect(page).to have_selector('.op-toast.-error', text: 'Roles need to be assigned.')
+ expect(page).to have_css('.op-toast.-error', text: 'Roles need to be assigned.')
# Remove the user from the project
principal_page.remove_from_project!(project.name)
@@ -73,8 +73,8 @@ RSpec.shared_examples 'global user principal membership management flows' do |pe
principal_page.visit!
principal_page.open_projects_tab!
- 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)
+ expect(page).to have_no_css('#membership_project_id option', text: project.name, visible: :all)
+ expect(page).to have_no_css('#membership_project_id option', text: project2.name, visible: :all)
end
it 'does not show the membership' do
@@ -87,10 +87,10 @@ RSpec.shared_examples 'global user principal membership management flows' do |pe
principal_page.visit!
principal_page.open_projects_tab!
- expect(page).not_to have_selector('tr.member')
+ expect(page).to have_no_css('tr.member')
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).not_to have_text project2.name
- expect(page).not_to have_text project2.name
+ expect(page).to have_no_text project2.name
+ expect(page).to have_no_text project2.name
end
end
end
@@ -106,10 +106,10 @@ RSpec.shared_examples 'global user principal membership management flows' do |pe
principal_page.visit!
principal_page.open_projects_tab!
- expect(page).not_to have_selector('tr.member')
+ expect(page).to have_no_css('tr.member')
expect(page).to have_text 'There is currently nothing to display.'
- expect(page).not_to have_text project.name
- expect(page).not_to have_text project2.name
+ expect(page).to have_no_text project.name
+ expect(page).to have_no_text project2.name
end
end
@@ -119,7 +119,7 @@ RSpec.shared_examples 'global user principal membership management flows' do |pe
it 'returns an error' do
principal_page.visit!
expect(page).to have_text 'You are not authorized to access this page.'
- expect(page).not_to have_text principal.name
+ expect(page).to have_no_text principal.name
end
end
end
diff --git a/spec/features/projects/attribute_help_texts_spec.rb b/spec/features/projects/attribute_help_texts_spec.rb
index cd7f7f92f48..387b99a9650 100644
--- a/spec/features/projects/attribute_help_texts_spec.rb
+++ b/spec/features/projects/attribute_help_texts_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe 'Project attribute help texts', :js, :with_cuprite do
click_link "Overview"
end
- expect(page).to have_selector("#{test_selector('op-widget-box--header')} .help-text--entry", wait: 10)
+ expect(page).to have_css("#{test_selector('op-widget-box--header')} .help-text--entry", wait: 10)
# Open help text modal
modal.open!
diff --git a/spec/features/projects/copy_spec.rb b/spec/features/projects/copy_spec.rb
index bebff0ecf5c..9ea35aab52b 100644
--- a/spec/features/projects/copy_spec.rb
+++ b/spec/features/projects/copy_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects copy', :with_cuprite, js: true do
+RSpec.describe 'Projects copy', :js, :with_cuprite do
describe 'with a full copy example' do
let!(:project) do
create(:project,
diff --git a/spec/features/projects/create_spec.rb b/spec/features/projects/create_spec.rb
index cbd3d19b3d9..dea5ad1e81f 100644
--- a/spec/features/projects/create_spec.rb
+++ b/spec/features/projects/create_spec.rb
@@ -104,8 +104,8 @@ RSpec.describe 'Projects', 'creation',
find('.op-fieldset--toggle', text: 'ADVANCED SETTINGS').click
- expect(page).not_to have_content 'Active'
- expect(page).not_to have_content 'Identifier'
+ expect(page).to have_no_content 'Active'
+ expect(page).to have_no_content 'Identifier'
end
context 'with optional and required custom fields' do
@@ -130,7 +130,7 @@ RSpec.describe 'Projects', 'creation',
within('.op-fieldset') do
expect(page).to have_text 'Optional Foo'
- expect(page).not_to have_text 'Required Foo'
+ expect(page).to have_no_text 'Required Foo'
end
end
end
diff --git a/spec/features/projects/destroy_spec.rb b/spec/features/projects/destroy_spec.rb
index ca0328a1bf2..ff5e8e45b30 100644
--- a/spec/features/projects/destroy_spec.rb
+++ b/spec/features/projects/destroy_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects#destroy',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Projects#destroy', :js, :with_cuprite do
let!(:project) { create(:project, name: 'foo', identifier: 'foo') }
let(:project_page) { Pages::Projects::Destroy.new(project) }
let(:danger_zone) { DangerZone.new(page) }
@@ -64,7 +62,7 @@ RSpec.describe 'Projects#destroy',
expect(danger_zone).not_to be_disabled
danger_zone.danger_button.click
- expect(page).to have_selector '.op-toast.-success', text: I18n.t('projects.delete.scheduled')
+ expect(page).to have_css '.op-toast.-success', text: I18n.t('projects.delete.scheduled')
perform_enqueued_jobs
diff --git a/spec/features/projects/edit_settings_spec.rb b/spec/features/projects/edit_settings_spec.rb
index f446006dd4b..f6be75da0e2 100644
--- a/spec/features/projects/edit_settings_spec.rb
+++ b/spec/features/projects/edit_settings_spec.rb
@@ -44,8 +44,8 @@ RSpec.describe 'Projects', 'editing settings', :js, :with_cuprite do
it 'hides the field whose functionality is presented otherwise' do
visit project_settings_general_path(project.id)
- expect(page).not_to have_text :all, 'Active'
- expect(page).not_to have_text :all, 'Identifier'
+ expect(page).to have_no_text :all, 'Active'
+ expect(page).to have_no_text :all, 'Identifier'
end
describe 'identifier edit' do
diff --git a/spec/features/projects/export_spec.rb b/spec/features/projects/export_spec.rb
index 51f2ed5705d..ca48eb8a2f9 100644
--- a/spec/features/projects/export_spec.rb
+++ b/spec/features/projects/export_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe 'project export', :js, :with_cuprite do
let(:export_type) { 'CSV' }
it 'exports the visible projects' do
- expect(page).to have_selector('td.name', text: important_project.name)
+ expect(page).to have_css('td.name', text: important_project.name)
export!
@@ -101,12 +101,12 @@ RSpec.describe 'project export', :js, :with_cuprite do
click_on 'Apply'
expect(page).to have_text(important_project.name)
- expect(page).not_to have_text(party_project.name)
+ expect(page).to have_no_text(party_project.name)
export!
expect(subject).to have_text(important_project.name)
- expect(subject).not_to have_text(party_project.name)
+ expect(subject).to have_no_text(party_project.name)
end
end
end
diff --git a/spec/features/projects/modules_spec.rb b/spec/features/projects/modules_spec.rb
index ef17e5c8102..81a76efc5f3 100644
--- a/spec/features/projects/modules_spec.rb
+++ b/spec/features/projects/modules_spec.rb
@@ -73,10 +73,10 @@ RSpec.describe 'Projects module administration' do
click_button 'Save'
expect(page)
- .to have_selector '.op-toast.-error',
- text: I18n.t(:'activerecord.errors.models.project.attributes.enabled_modules.dependency_missing',
- dependency: 'Work packages',
- module: 'Calendars')
+ .to have_css '.op-toast.-error',
+ text: I18n.t(:'activerecord.errors.models.project.attributes.enabled_modules.dependency_missing',
+ dependency: 'Work packages',
+ module: 'Calendars')
check 'Work packages'
@@ -107,7 +107,7 @@ RSpec.describe 'Projects module administration' do
it "I can't see the modules menu item" do
expect(page)
- .not_to have_selector('[data-name="settings_modules"]')
+ .to have_no_css('[data-name="settings_modules"]')
end
end
end
diff --git a/spec/features/projects/project_autocomplete_spec.rb b/spec/features/projects/project_autocomplete_spec.rb
index e67ae7c49c0..4d82b5a180d 100644
--- a/spec/features/projects/project_autocomplete_spec.rb
+++ b/spec/features/projects/project_autocomplete_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects autocomplete page', js: true, with_cuprite: true do
+RSpec.describe 'Projects autocomplete page', :js, :with_cuprite do
let!(:user) { create(:user) }
let(:top_menu) { Components::Projects::TopMenu.new }
@@ -110,8 +110,8 @@ RSpec.describe 'Projects autocomplete page', js: true, with_cuprite: true do
# Expect highlights
within(top_menu.search_results) do
- expect(page).to have_selector('.op-search-highlight', text: '<strong')
- expect(page).not_to have_selector('strong')
+ expect(page).to have_css('.op-search-highlight', text: '<strong')
+ expect(page).to have_no_css('strong')
end
# Expect fuzzy matches for plain
@@ -156,7 +156,7 @@ RSpec.describe 'Projects autocomplete page', js: true, with_cuprite: true do
# Keeps the current module
visit project_news_index_path(project2)
- expect(page).to have_selector('.news-menu-item.selected')
+ expect(page).to have_css('.news-menu-item.selected')
retry_block do
top_menu.toggle
@@ -165,7 +165,7 @@ RSpec.describe 'Projects autocomplete page', js: true, with_cuprite: true do
end
expect(page).to have_current_path(project_news_index_path(project), ignore_query: true)
- expect(page).to have_selector('.news-menu-item.selected')
+ expect(page).to have_css('.news-menu-item.selected')
end
it 'navigates to the first project upon hitting enter in the search bar' do
diff --git a/spec/features/projects/project_status_administration_spec.rb b/spec/features/projects/project_status_administration_spec.rb
index d25a00d0aa4..a9c186ec14e 100644
--- a/spec/features/projects/project_status_administration_spec.rb
+++ b/spec/features/projects/project_status_administration_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects status administration',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Projects status administration', :js, :with_cuprite do
include_context 'ng-select-autocomplete helpers'
let(:current_user) do
diff --git a/spec/features/projects/projects_custom_fields_spec.rb b/spec/features/projects/projects_custom_fields_spec.rb
index 519b52d5fe0..856274324bd 100644
--- a/spec/features/projects/projects_custom_fields_spec.rb
+++ b/spec/features/projects/projects_custom_fields_spec.rb
@@ -110,7 +110,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite do
visit project_settings_general_path(project.id)
# expect CF, description and status description ckeditor-augmented-textarea
- expect(page).to have_selector('.op-ckeditor--wrapper', count: 3)
+ expect(page).to have_css('.op-ckeditor--wrapper', count: 3)
# single hash autocomplete
editor.insert_link 'http://example.org/link with spaces'
@@ -126,7 +126,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite do
cv = project.custom_values.find_by(custom_field_id: custom_field.id).value
expect(cv).to include '[http://example.org/link with spaces](http://example.org/link%20with%20spaces)'
- expect(page).to have_selector('a[href="http://example.org/link with spaces"]')
+ expect(page).to have_css('a[href="http://example.org/link with spaces"]')
end
end
@@ -289,7 +289,7 @@ RSpec.describe 'Projects custom fields', :js, :with_cuprite do
cf_field.expect_visible
cf_field.expect_no_option invisible_user
- expect(page).not_to have_selector('.ng-dropdown-footer button', text: 'Invite')
+ expect(page).to have_no_css('.ng-dropdown-footer button', text: 'Invite')
end
end
end
diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rb
index b98265e95b1..4c0b5b4cfd1 100644
--- a/spec/features/projects/projects_index_spec.rb
+++ b/spec/features/projects/projects_index_spec.rb
@@ -74,8 +74,8 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
def expect_project_at_place(project, place)
expect(page)
- .to have_selector("#project-table .project:nth-of-type(#{place}) td.name",
- text: project.name)
+ .to have_css("#project-table .project:nth-of-type(#{place}) td.name",
+ text: project.name)
end
def expect_projects_in_order(*projects)
@@ -90,11 +90,11 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
ProjectRole.anonymous
visit projects_path
- expect(page).not_to have_text(project.name)
+ expect(page).to have_no_text(project.name)
expect(page).to have_text(public_project.name)
# Test that the 'More' menu stays invisible on hover
- expect(page).not_to have_css('.icon-show-more-horizontal')
+ expect(page).to have_no_css('.icon-show-more-horizontal')
end
end
@@ -114,11 +114,11 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
expect(page).to have_text(development_project.name)
expect(page).to have_text(public_project.name)
- expect(page).not_to have_text(project.name)
+ expect(page).to have_no_text(project.name)
# Non-admin users shall not see invisible CFs.
- expect(page).not_to have_text(invisible_custom_field.name.upcase)
- expect(page).not_to have_select('add_filter_select', with_options: [invisible_custom_field.name])
+ expect(page).to have_no_text(invisible_custom_field.name.upcase)
+ expect(page).to have_no_select('add_filter_select', with_options: [invisible_custom_field.name])
end
end
@@ -147,13 +147,13 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
expect(page).to have_text(development_project.name)
expect(page).to have_text(public_project.name)
- expect(page).not_to have_text(project.name)
+ expect(page).to have_no_text(project.name)
# They should not see the description, status or custom fields for the project
- expect(page).not_to have_text(development_project.description)
- expect(page).not_to have_text(project_status_name(development_project.status_code))
- expect(page).not_to have_text(development_project.status_explanation)
- expect(page).not_to have_text(development_project.custom_value_for(custom_field))
+ expect(page).to have_no_text(development_project.description)
+ expect(page).to have_no_text(project_status_name(development_project.status_code))
+ expect(page).to have_no_text(development_project.status_explanation)
+ expect(page).to have_no_text(development_project.custom_value_for(custom_field))
end
end
@@ -217,9 +217,9 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
load_and_open_filters admin
# CF's columns are not present:
- expect(page).not_to have_text(custom_field.name.upcase)
+ expect(page).to have_no_text(custom_field.name.upcase)
# CF's filters are not present:
- expect(page).not_to have_select('add_filter_select', with_options: [custom_field.name])
+ expect(page).to have_no_select('add_filter_select', with_options: [custom_field.name])
end
end
@@ -228,7 +228,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
load_and_open_filters admin
# CF's columns are not shown due to setting
- expect(page).not_to have_text(custom_field.name.upcase)
+ expect(page).to have_no_text(custom_field.name.upcase)
end
specify 'CF columns and filters are visible when added to settings' do
@@ -384,7 +384,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
projects_page.expect_projects_listed(public_project)
projects_page.expect_projects_not_listed(project, # Filtered out
development_project) # Present on page 1
- expect(page).not_to have_text('Next') # Filters kept active, so there is no third page.
+ expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.
# Sorts DESC by name
click_on 'Ascending sorted by "Name"'
@@ -395,7 +395,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
projects_page.expect_projects_not_listed(project, # Filtered out
public_project) # Present on page 1
- expect(page).not_to have_text('Next') # Filters kept active, so there is no third page.
+ expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.
expect(page).to have_css('.sort.desc', text: 'NAME')
# Sending the filter form again what implies to compose the request freshly
@@ -495,10 +495,10 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
projects_page.activate_menu_of(parent_project) do |menu|
expect(menu).to have_text('Unarchive')
expect(menu).to have_text('Delete')
- expect(menu).not_to have_text('Archive')
- expect(menu).not_to have_text('Copy')
- expect(menu).not_to have_text('Settings')
- expect(menu).not_to have_text('New subproject')
+ expect(menu).to have_no_text('Archive')
+ expect(menu).to have_no_text('Copy')
+ expect(menu).to have_no_text('Settings')
+ expect(menu).to have_no_text('New subproject')
click_link('Unarchive')
end
@@ -584,7 +584,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(green_project.name)
- expect(page).not_to have_text(no_status_project.name)
+ expect(page).to have_no_text(no_status_project.name)
projects_page.set_filter('project_status_code',
'Project status',
@@ -595,7 +595,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(green_project.name)
- expect(page).not_to have_text(no_status_project.name)
+ expect(page).to have_no_text(no_status_project.name)
projects_page.set_filter('project_status_code',
'Project status',
@@ -605,7 +605,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
click_on 'Apply'
wait_for_reload
- expect(page).not_to have_text(green_project.name)
+ expect(page).to have_no_text(green_project.name)
expect(page).to have_text(no_status_project.name)
projects_page.set_filter('project_status_code',
@@ -616,7 +616,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
click_on 'Apply'
wait_for_reload
- expect(page).not_to have_text(green_project.name)
+ expect(page).to have_no_text(green_project.name)
expect(page).to have_text(no_status_project.name)
end
end
@@ -688,8 +688,8 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_this_week.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_this_week.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
# created on 'this week' shows projects that were created within the last seven days
remove_filter('created_at')
@@ -703,7 +703,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
expect(page).to have_text(project_created_on_today.name)
expect(page).to have_text(project_created_on_this_week.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
# created on 'on' shows projects that were created within the last seven days
remove_filter('created_at')
@@ -717,8 +717,8 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_fixed_date.name)
- expect(page).not_to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_this_week.name)
+ expect(page).to have_no_text(project_created_on_today.name)
+ expect(page).to have_no_text(project_created_on_this_week.name)
# created on 'less than days ago'
remove_filter('created_at')
@@ -732,7 +732,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
# created on 'more than days ago'
remove_filter('created_at')
@@ -746,7 +746,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_fixed_date.name)
- expect(page).not_to have_text(project_created_on_today.name)
+ expect(page).to have_no_text(project_created_on_today.name)
# created on 'between'
remove_filter('created_at')
@@ -760,7 +760,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_fixed_date.name)
- expect(page).not_to have_text(project_created_on_today.name)
+ expect(page).to have_no_text(project_created_on_today.name)
# Latest activity at 'today'. This spot check would fail if the data does not get collected from multiple tables
remove_filter('created_at')
@@ -773,7 +773,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
# CF List
remove_filter('latest_activity_at')
@@ -787,7 +787,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
# switching to multiselect keeps the current selection
cf_filter = page.find("li[filter-name='#{list_custom_field.column_name}']")
@@ -821,7 +821,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
click_on 'Toggle multiselect'
expect(cf_filter.find(:select, 'value')).not_to be_multiple
expect(cf_filter).to have_select('value', selected: list_custom_field.possible_values[1].value)
- expect(cf_filter).not_to have_select('value', selected: list_custom_field.possible_values[3].value)
+ expect(cf_filter).to have_no_select('value', selected: list_custom_field.possible_values[3].value)
end
click_on 'Apply'
@@ -845,7 +845,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
wait_for_reload
expect(page).to have_text(project_created_on_today.name)
- expect(page).not_to have_text(project_created_on_fixed_date.name)
+ expect(page).to have_no_text(project_created_on_fixed_date.name)
end
pending "NOT WORKING YET: Date vs. DateTime issue: Selecting same date for from and to value shows projects of that date"
@@ -923,7 +923,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
# 'More' does not become visible on hover
page.find('tbody tr').hover
- expect(page).not_to have_css('.icon-show-more-horizontal')
+ expect(page).to have_no_css('.icon-show-more-horizontal')
# For a project member with :copy_projects privilege the 'More' menu is visible.
login_as(can_copy_projects_manager)
@@ -940,10 +940,10 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
page.find('tbody tr .icon-show-more-horizontal').click
menu = page.find('tbody tr .project-actions')
expect(menu).to have_text('Copy')
- expect(menu).not_to have_text('New subproject')
- expect(menu).not_to have_text('Delete')
- expect(menu).not_to have_text('Archive')
- expect(menu).not_to have_text('Unarchive')
+ expect(menu).to have_no_text('New subproject')
+ expect(menu).to have_no_text('Delete')
+ expect(menu).to have_no_text('Archive')
+ expect(menu).to have_no_text('Unarchive')
# For a project member with :add_subprojects privilege the 'More' menu is visible.
login_as(can_add_subprojects_manager)
@@ -958,23 +958,23 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
page.find('tbody tr .icon-show-more-horizontal').click
menu = page.find('tbody tr .project-actions')
expect(menu).to have_text('New subproject')
- expect(menu).not_to have_text('Copy')
- expect(menu).not_to have_text('Delete')
- expect(menu).not_to have_text('Archive')
- expect(menu).not_to have_text('Unrchive')
+ expect(menu).to have_no_text('Copy')
+ expect(menu).to have_no_text('Delete')
+ expect(menu).to have_no_text('Archive')
+ expect(menu).to have_no_text('Unrchive')
# Test admin only properties are invisible
within('#project-table') do
expect(page)
- .not_to have_css('th', text: 'REQUIRED DISK STORAGE')
+ .to have_no_css('th', text: 'REQUIRED DISK STORAGE')
expect(page)
- .not_to have_css('th', text: 'CREATED ON')
+ .to have_no_css('th', text: 'CREATED ON')
expect(page)
- .not_to have_css('td', text: project.created_at.strftime('%m/%d/%Y'))
+ .to have_no_css('td', text: project.created_at.strftime('%m/%d/%Y'))
expect(page)
- .not_to have_css('th', text: 'LATEST ACTIVITY AT')
+ .to have_no_css('th', text: 'LATEST ACTIVITY AT')
expect(page)
- .not_to have_css('td', text: news.created_at.strftime('%m/%d/%Y'))
+ .to have_no_css('td', text: news.created_at.strftime('%m/%d/%Y'))
end
end
end
@@ -1078,9 +1078,9 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
it 'is not visible' do
load_and_open_filters admin
- expect(page).not_to have_select('add_filter_select', with_options: ["Principal"])
- expect(page).not_to have_select('add_filter_select', with_options: ["ID"])
- expect(page).not_to have_select('add_filter_select', with_options: ["Subproject of"])
+ expect(page).to have_no_select('add_filter_select', with_options: ["Principal"])
+ expect(page).to have_no_select('add_filter_select', with_options: ["ID"])
+ expect(page).to have_no_select('add_filter_select', with_options: ["Subproject of"])
end
end
@@ -1107,7 +1107,7 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,
.where(value: %w[A B])
.reorder(:id)
.pluck(:value)
- expect(page).to have_selector(".#{list_custom_field.column_name}.format-list", text: expected_sort.join(", "))
+ expect(page).to have_css(".#{list_custom_field.column_name}.format-list", text: expected_sort.join(", "))
end
end
diff --git a/spec/features/projects/projects_portfolio_spec.rb b/spec/features/projects/projects_portfolio_spec.rb
index 4b32bd8f654..6f349325dd5 100644
--- a/spec/features/projects/projects_portfolio_spec.rb
+++ b/spec/features/projects/projects_portfolio_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects index page',
- js: true,
- with_cuprite: true,
+RSpec.describe 'Projects index page', :js, :with_cuprite,
with_ee: %i[custom_fields_in_projects_list], with_settings: { login_required?: false } do
shared_let(:admin) { create(:admin) }
@@ -86,7 +84,7 @@ RSpec.describe 'Projects index page',
# It has checked all selected settings
Setting.enabled_projects_columns.each do |name|
- expect(page).to have_selector(%(input[value="#{name}"]:checked))
+ expect(page).to have_css(%(input[value="#{name}"]:checked))
end
# Uncheck all selected columns
@@ -98,8 +96,8 @@ RSpec.describe 'Projects index page',
find('input[value="project_status"]').check
find(%(input[value="#{string_cf.column_name}"])).check
- expect(page).to have_selector('input[value="project_status"]:checked')
- expect(page).to have_selector(%(input[value="#{string_cf.column_name}"]:checked))
+ expect(page).to have_css('input[value="project_status"]:checked')
+ expect(page).to have_css(%(input[value="#{string_cf.column_name}"]:checked))
# Edit the project gantt query
scroll_to_and_click(find('button', text: 'Edit query'))
@@ -122,7 +120,7 @@ RSpec.describe 'Projects index page',
# Save the page
scroll_to_and_click(find('.button', text: 'Save'))
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.')
RequestStore.clear!
query = JSON.parse Setting.project_gantt_query
@@ -138,8 +136,8 @@ RSpec.describe 'Projects index page',
wp_table.expect_work_package_listed work_package_a, work_package_b
# Expect grouped and filtered for both projects
- expect(page).to have_selector '.group--value', text: 'A'
- expect(page).to have_selector '.group--value', text: 'B'
+ expect(page).to have_css '.group--value', text: 'A'
+ expect(page).to have_css '.group--value', text: 'B'
# Expect type and project filters
dropdown.expect_count 2
diff --git a/spec/features/projects/subproject_creation_spec.rb b/spec/features/projects/subproject_creation_spec.rb
index 511073fe5d1..d2d62e9effb 100644
--- a/spec/features/projects/subproject_creation_spec.rb
+++ b/spec/features/projects/subproject_creation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Subproject creation', js: true, with_cuprite: true do
+RSpec.describe 'Subproject creation', :js, :with_cuprite do
let(:name_field) { FormFields::InputFormField.new :name }
let(:parent_field) { FormFields::SelectFormField.new :parent }
let(:add_subproject_role) { create(:project_role, permissions: %i[edit_project add_subprojects]) }
diff --git a/spec/features/projects/template_spec.rb b/spec/features/projects/template_spec.rb
index 02a475747d3..de4ab027df2 100644
--- a/spec/features/projects/template_spec.rb
+++ b/spec/features/projects/template_spec.rb
@@ -44,13 +44,13 @@ RSpec.describe 'Project templates', :js, :with_cuprite do
# Make a template
find('.button', text: 'Set as template').click
- expect(page).to have_selector('.button', text: 'Remove from templates')
+ expect(page).to have_css('.button', text: 'Remove from templates')
project.reload
expect(project).to be_templated
# unset template
find('.button', text: 'Remove from templates').click
- expect(page).to have_selector('.button', text: 'Set as template')
+ expect(page).to have_css('.button', text: 'Set as template')
project.reload
expect(project).not_to be_templated
@@ -99,7 +99,7 @@ RSpec.describe 'Project templates', :js, :with_cuprite do
name_field.set_value 'Foo bar'
expect(page)
- .not_to have_content('COPY OPTIONS')
+ .to have_no_content('COPY OPTIONS')
template_field.select_option 'My template'
@@ -123,7 +123,7 @@ RSpec.describe 'Project templates', :js, :with_cuprite do
page.find('.op-fieldset--toggle', text: 'COPY OPTIONS').click
# Now shows the send notifications field.
- expect(page).to have_selector('[data-qa-field-name="sendNotifications"]')
+ expect(page).to have_css('[data-qa-field-name="sendNotifications"]')
# And allows to deselect copying the members.
uncheck I18n.t(:'projects.copy.members')
diff --git a/spec/features/projects/work_package_type_mgmt_spec.rb b/spec/features/projects/work_package_type_mgmt_spec.rb
index 1005f8bf680..4d0296e9e32 100644
--- a/spec/features/projects/work_package_type_mgmt_spec.rb
+++ b/spec/features/projects/work_package_type_mgmt_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Projects', 'work package type mgmt',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Projects', :js, :with_cuprite, 'work package type mgmt' do
current_user { create(:user, member_with_permissions: { project => %i[edit_project manage_types] }) }
let(:phase_type) { create(:type, name: 'Phase', is_default: true) }
diff --git a/spec/features/repositories/checkout_instructions_spec.rb b/spec/features/repositories/checkout_instructions_spec.rb
index 0e6dfaf56cd..7308c777d73 100644
--- a/spec/features/repositories/checkout_instructions_spec.rb
+++ b/spec/features/repositories/checkout_instructions_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Create repository', js: true do
+RSpec.describe 'Create repository', :js do
let(:current_user) { create (:admin) }
let(:project) { create(:project) }
let(:enabled_scms) { %w[git] }
@@ -66,12 +66,12 @@ RSpec.describe 'Create repository', js: true do
it 'toggles checkout instructions' do
visit project_repository_path(project)
- expect(page).to have_selector('#repository--checkout-instructions')
+ expect(page).to have_css('#repository--checkout-instructions')
button = find_by_id('repository--checkout-instructions-toggle')
button.click
- expect(page).not_to have_selector('#repository--checkout-instructions')
+ expect(page).to have_no_css('#repository--checkout-instructions')
end
end
end
diff --git a/spec/features/repositories/create_repository_spec.rb b/spec/features/repositories/create_repository_spec.rb
index 2abcf49ddf8..53b9afb1901 100644
--- a/spec/features/repositories/create_repository_spec.rb
+++ b/spec/features/repositories/create_repository_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/repositories/repository_settings_page'
-RSpec.describe 'Create repository', js: true, selenium: true do
+RSpec.describe 'Create repository', :js, :selenium do
let(:current_user) { create(:admin) }
let(:project) { create(:project) }
let(:settings_page) { RepositorySettingsPage.new(project) }
@@ -59,7 +59,7 @@ RSpec.describe 'Create repository', js: true, selenium: true do
it 'displays the vendor selection' do
expect(scm_vendor_input).not_to be_nil
enabled_scms.each do |scm|
- expect(scm_vendor_input).to have_selector('option', text: scm.camelize)
+ expect(scm_vendor_input).to have_css('option', text: scm.camelize)
end
end
end
@@ -73,7 +73,7 @@ RSpec.describe 'Create repository', js: true, selenium: true do
it_behaves_like 'shows enabled scms'
it 'does not show git' do
- expect(scm_vendor_input).not_to have_selector('option', text: 'Git')
+ expect(scm_vendor_input).to have_no_css('option', text: 'Git')
end
end
end
@@ -149,9 +149,9 @@ RSpec.describe 'Create repository', js: true, selenium: true do
click_button(I18n.t(:button_create))
- expect(page).to have_selector('div.op-toast.-success',
- text: I18n.t('repositories.create_successful'))
- expect(page).to have_selector('a.icon-delete', text: I18n.t(:button_delete))
+ expect(page).to have_css('div.op-toast.-success',
+ text: I18n.t('repositories.create_successful'))
+ expect(page).to have_css('a.icon-delete', text: I18n.t(:button_delete))
end
end
@@ -162,10 +162,10 @@ RSpec.describe 'Create repository', js: true, selenium: true do
click_button(I18n.t(:button_create))
- expect(page).to have_selector('div.op-toast.-success',
- text: I18n.t('repositories.create_successful'))
- expect(page).to have_selector('button[type="submit"]', text: I18n.t(:button_save))
- expect(page).to have_selector('a.icon-remove', text: I18n.t(:button_remove))
+ expect(page).to have_css('div.op-toast.-success',
+ text: I18n.t('repositories.create_successful'))
+ expect(page).to have_css('button[type="submit"]', text: I18n.t(:button_save))
+ expect(page).to have_css('a.icon-remove', text: I18n.t(:button_remove))
end
end
@@ -208,7 +208,7 @@ RSpec.describe 'Create repository', js: true, selenium: true do
end
end
- describe 'remote managed repositories', webmock: true do
+ describe 'remote managed repositories', :webmock do
let(:vendor) { 'git' }
let(:url) { 'http://myreposerver.example.com/api/' }
let(:config) { { git: { manages: url } } }
diff --git a/spec/features/repositories/repository_settings_spec.rb b/spec/features/repositories/repository_settings_spec.rb
index e5ae64250fc..4674e2b3262 100644
--- a/spec/features/repositories/repository_settings_spec.rb
+++ b/spec/features/repositories/repository_settings_spec.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
require 'features/repositories/repository_settings_page'
require 'features/support/components/danger_zone'
-RSpec.describe 'Repository Settings', js: true do
+RSpec.describe 'Repository Settings', :js do
let(:current_user) { create (:admin) }
let(:project) { create(:project) }
let(:settings_page) { RepositorySettingsPage.new(project) }
@@ -54,7 +54,7 @@ RSpec.describe 'Repository Settings', js: true do
shared_examples 'manages the repository' do |type|
it 'displays the repository' do
- expect(page).to have_selector('select[name="scm_vendor"]')
+ expect(page).to have_css('select[name="scm_vendor"]')
expect(find("#attributes-group--content-#{type}", visible: true))
.not_to be_nil
end
@@ -84,7 +84,7 @@ RSpec.describe 'Repository Settings', js: true do
else
SeleniumHubWaiter.wait
find('a.icon-remove', text: I18n.t(:button_remove)).click
- expect(page).to have_selector('.op-toast.-warning')
+ expect(page).to have_css('.op-toast.-warning')
SeleniumHubWaiter.wait
find('a', text: I18n.t(:button_remove)).click
end
@@ -105,7 +105,7 @@ RSpec.describe 'Repository Settings', js: true do
shared_examples 'manages the repository with' do |name, type, _repository_type, _project_name|
let(:repository) do
- create("repository_#{name}".to_sym,
+ create(:"repository_#{name}",
scm_type: type,
project:)
end
@@ -151,7 +151,7 @@ RSpec.describe 'Repository Settings', js: true do
end
end
- context 'remote', webmock: true do
+ context 'remote', :webmock do
let(:url) { 'http://myreposerver.example.com/api/' }
let(:config) do
{
@@ -192,9 +192,9 @@ RSpec.describe 'Repository Settings', js: true do
fill_in('repository-password-placeholder', with: 'password')
click_button(I18n.t(:button_save))
- expect(page).to have_selector('[name="repository[login]"][value="foobar"]')
- expect(page).to have_selector('.op-toast',
- text: I18n.t('repositories.update_settings_successful'))
+ expect(page).to have_css('[name="repository[login]"][value="foobar"]')
+ expect(page).to have_css('.op-toast',
+ text: I18n.t('repositories.update_settings_successful'))
end
end
end
diff --git a/spec/features/roles/create_spec.rb b/spec/features/roles/create_spec.rb
index 76cdbf50f3f..ad25b27de8e 100644
--- a/spec/features/roles/create_spec.rb
+++ b/spec/features/roles/create_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Role creation',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Role creation', :js, :with_cuprite do
let!(:admin) { create(:admin) }
let!(:existing_role) { create(:project_role) }
let!(:existing_workflow) { create(:workflow_with_default_status, role: existing_role, type:) }
@@ -58,7 +56,7 @@ RSpec.describe 'Role creation',
click_button 'Create'
expect(page)
- .to have_selector('.errorExplanation', text: 'Name has already been taken')
+ .to have_css('.errorExplanation', text: 'Name has already been taken')
fill_in 'Name', with: 'New role name'
@@ -68,8 +66,8 @@ RSpec.describe 'Role creation',
click_button 'Create'
expect(page)
- .to have_selector('.errorExplanation',
- text: "Permissions need to also include 'View members' as 'Manage members' is selected.")
+ .to have_css('.errorExplanation',
+ text: "Permissions need to also include 'View members' as 'Manage members' is selected.")
check 'View members'
select existing_role.name, from: 'Copy workflow from'
@@ -77,13 +75,13 @@ RSpec.describe 'Role creation',
click_button 'Create'
expect(page)
- .to have_selector('.-success', text: 'Successful creation.')
+ .to have_css('.-success', text: 'Successful creation.')
expect(page)
.to have_current_path(roles_path)
expect(page)
- .to have_selector('table td', text: 'New role name')
+ .to have_css('table td', text: 'New role name')
click_link 'New role name'
diff --git a/spec/features/search/recently_viewed_work_packages_spec.rb b/spec/features/search/recently_viewed_work_packages_spec.rb
index c1cffef35e2..7c5eb94f9fa 100644
--- a/spec/features/search/recently_viewed_work_packages_spec.rb
+++ b/spec/features/search/recently_viewed_work_packages_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe 'Recently viewed work packages',
global_search.click_input
expect(global_search.dropdown).to be_visible
- expect(global_search.dropdown).not_to have_text(recently_viewed_header_text)
+ expect(global_search.dropdown).to have_no_text(recently_viewed_header_text)
end
end
@@ -77,7 +77,7 @@ RSpec.describe 'Recently viewed work packages',
# clicking goes to the work package view
global_search.click_work_package(work_package)
expect(page)
- .to have_selector('.subject', text: work_package.subject)
+ .to have_css('.subject', text: work_package.subject)
expect(page)
.to have_current_path project_work_package_path(work_package.project, work_package, state: 'activity')
end
@@ -89,7 +89,7 @@ RSpec.describe 'Recently viewed work packages',
global_search.search('random text')
# recently viewed items not shown
- expect(global_search.dropdown).not_to have_text(recently_viewed_header_text)
+ expect(global_search.dropdown).to have_no_text(recently_viewed_header_text)
global_search.expect_no_work_package_option(work_package)
end
end
diff --git a/spec/features/search/search_spec.rb b/spec/features/search/search_spec.rb
index 639efd9dcce..630b99e1126 100644
--- a/spec/features/search/search_spec.rb
+++ b/spec/features/search/search_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
+RSpec.describe 'Search', :js, with_settings: { per_page_options: '5' } do
include Components::Autocompleter::NgSelectAutocompleteHelpers
shared_let(:admin) { create(:admin) }
@@ -89,7 +89,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
def expect_range(param_a, param_b)
(param_a..param_b).each do |n|
expect(page).to have_content("No. #{n} WP")
- expect(page).to have_selector("a[href*='#{work_package_path(work_packages[n - 1].id)}']")
+ expect(page).to have_css("a[href*='#{work_package_path(work_packages[n - 1].id)}']")
end
end
@@ -131,7 +131,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
global_search.click_work_package(target_work_package)
expect(page)
- .to have_selector('.subject', text: target_work_package.subject)
+ .to have_css('.subject', text: target_work_package.subject)
expect(page)
.to have_current_path project_work_package_path(target_work_package.project, target_work_package, state: 'activity')
@@ -148,7 +148,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
global_search.submit_with_enter
expect(page)
- .to have_selector('.subject', text: search_target.subject)
+ .to have_css('.subject', text: search_target.subject)
expect(page)
.to have_current_path project_work_package_path(search_target.project, search_target, state: 'activity')
@@ -293,7 +293,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
global_search.submit_in_current_project
# Expect that the "All" tab is selected.
- expect(page).to have_selector('[data-qa-tab-id="all"][data-qa-tab-selected]')
+ expect(page).to have_css('[data-qa-tab-id="all"][data-qa-tab-selected]')
# Expect that the project scope is set to current_project and no module (this is the "all" tab) is requested.
expect(current_url).to match(/\/#{project.identifier}\/search\?q=#{query}&scope=current_project$/)
@@ -305,7 +305,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
expect(current_url).to match(/\/search\?q=#{query}&work_packages=1&scope=current_project$/)
# Expect that the "Work packages" tab is selected.
- expect(page).to have_selector('[data-qa-tab-id="work_packages"][data-qa-tab-selected]')
+ expect(page).to have_css('[data-qa-tab-id="work_packages"][data-qa-tab-selected]')
table = Pages::EmbeddedWorkPackagesTable.new(find('.work-packages-embedded-view--container'))
table.expect_work_package_count(5) # because we set the page size to this
@@ -378,7 +378,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
global_search.submit_in_project_and_subproject_scope
# Expect that the "Work packages" tab is selected.
- expect(page).to have_selector('[data-qa-tab-id="work_packages"][data-qa-tab-selected]')
+ expect(page).to have_css('[data-qa-tab-id="work_packages"][data-qa-tab-selected]')
expect(page).to have_text "Search for \"#{other_work_package.subject}\" in #{project.name} and all subprojects"
@@ -431,7 +431,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
.to have_content attachment_text
expect(page)
- .to have_selector(".search-highlight", text: query)
+ .to have_css(".search-highlight", text: query)
page.find('[data-qa-tab-id="work_packages"]').click
@@ -463,7 +463,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
global_search.submit_in_global_scope
within('dt.work_package-note + dd') do
- expect(page).to have_selector(".description", text: note_two.notes)
+ expect(page).to have_css(".description", text: note_two.notes)
end
# links to work package with anchor to highlighted note
@@ -492,7 +492,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
.to have_link(searched_for_project.name)
expect(page)
- .not_to have_link(other_project.name)
+ .to have_no_link(other_project.name)
end
end
end
@@ -587,7 +587,7 @@ RSpec.describe 'Search', js: true, with_settings: { per_page_options: '5' } do
it 'opens and focuses the global search when you press the [s] hotkey' do
visit home_path
page.find('body').send_keys('s')
- expect(page).to have_selector '[data-qa-search-open="1"]', wait: 10
+ expect(page).to have_css '[data-qa-search-open="1"]', wait: 10
end
end
end
diff --git a/spec/features/security/expire_sessions_spec.rb b/spec/features/security/expire_sessions_spec.rb
index 3fac6979060..fcf64e58494 100644
--- a/spec/features/security/expire_sessions_spec.rb
+++ b/spec/features/security/expire_sessions_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe 'Expire old user sessions' do
before do
# Delete all previous sesssions
- ::Sessions::UserSession.delete_all
+ Sessions::UserSession.delete_all
login_with(admin.login, admin_password)
diff --git a/spec/features/security/session_ttl_spec.rb b/spec/features/security/session_ttl_spec.rb
index 45dee5a9cda..8e4feb04ee9 100644
--- a/spec/features/security/session_ttl_spec.rb
+++ b/spec/features/security/session_ttl_spec.rb
@@ -46,13 +46,13 @@ RSpec.describe 'Session TTL',
describe 'outdated TTL on Rails request' do
it 'expires on the next Rails request' do
visit '/my/account'
- expect(page).to have_selector('.form--field-container', text: admin.login)
+ expect(page).to have_css('.form--field-container', text: admin.login)
# Expire the session
expire!
visit '/'
- expect(page).to have_selector('.action-login')
+ expect(page).to have_css('.action-login')
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 c90fe9a28f4..c02e8abbf72 100644
--- a/spec/features/support/components/attribute_help_text_modal.rb
+++ b/spec/features/support/components/attribute_help_text_modal.rb
@@ -69,14 +69,14 @@ module Components
end
element.click(x: -((width / 2) - 10), y: -((height / 2) - 10))
end
- expect(page).not_to have_css('[data-test-selector="attribute-help-text--header"]', text: help_text.attribute_caption)
+ expect(page).to have_no_css('[data-test-selector="attribute-help-text--header"]', text: help_text.attribute_caption)
end
def expect_edit(editable:)
if editable
expect(page).to have_css('.help-text--edit-button')
else
- expect(page).not_to have_css('.help-text--edit-button')
+ expect(page).to have_no_css('.help-text--edit-button')
end
end
diff --git a/spec/features/support/components/time_logging_modal.rb b/spec/features/support/components/time_logging_modal.rb
index b277b0b3de1..1e9273d8913 100644
--- a/spec/features/support/components/time_logging_modal.rb
+++ b/spec/features/support/components/time_logging_modal.rb
@@ -55,7 +55,7 @@ module Components
.to have_text(I18n.t('js.button_log_time'))
end
else
- expect(page).not_to have_selector '.spot-modal'
+ expect(page).to have_no_css '.spot-modal'
end
end
@@ -67,16 +67,16 @@ module Components
def expect_work_package(subject)
within modal_container do
- expect(page).to have_selector('.ng-value', text: subject, wait: 10)
+ expect(page).to have_css('.ng-value', text: subject, wait: 10)
end
end
def shows_field(field, visible)
within modal_container do
if visible
- expect(page).to have_selector "##{field_identifier(field)}"
+ expect(page).to have_css "##{field_identifier(field)}"
else
- expect(page).not_to have_selector "##{field_identifier(field)}"
+ expect(page).to have_no_css "##{field_identifier(field)}"
end
end
end
@@ -134,7 +134,7 @@ module Components
private
def field_object(field_name)
- send("#{field_name}_field")
+ send(:"#{field_name}_field")
end
def modal_container
diff --git a/spec/features/support/work_package_table.rb b/spec/features/support/work_package_table.rb
index 0cd1ae5486a..05c098447e2 100644
--- a/spec/features/support/work_package_table.rb
+++ b/spec/features/support/work_package_table.rb
@@ -34,7 +34,7 @@ RSpec.shared_context 'work package table helpers' do
preceeding_elements.each_with_index do |wp_1, i|
wp_2 = following_elements[i]
- expect(self).to have_selector(".wp-row-#{wp_1.id} + \
+ expect(self).to have_css(".wp-row-#{wp_1.id} + \
.wp-row-#{wp_2.id}")
end
end
diff --git a/spec/features/types/activate_in_project_spec.rb b/spec/features/types/activate_in_project_spec.rb
index 8f7d04f8018..7ad7e689e31 100644
--- a/spec/features/types/activate_in_project_spec.rb
+++ b/spec/features/types/activate_in_project_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'support/pages/custom_fields'
-RSpec.describe 'types', js: true, with_cuprite: true do
+RSpec.describe 'types', :js, :with_cuprite do
let(:user) do
create(:user,
member_with_permissions: { project => %i(edit_project manage_types add_work_packages view_work_packages) })
diff --git a/spec/features/types/crud_spec.rb b/spec/features/types/crud_spec.rb
index 7212948cd29..42f54f5a99f 100644
--- a/spec/features/types/crud_spec.rb
+++ b/spec/features/types/crud_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Types', js: true, with_cuprite: true do
+RSpec.describe 'Types', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
shared_let(:existing_role) { create(:project_role) }
@@ -53,7 +53,7 @@ RSpec.describe 'Types', js: true, with_cuprite: true do
click_button 'Create'
expect(page)
- .to have_selector('.errorExplanation', text: "Name has already been taken.")
+ .to have_css('.errorExplanation', text: "Name has already been taken.")
# Values are retained
expect(page)
diff --git a/spec/features/types/form_configuration_query_spec.rb b/spec/features/types/form_configuration_query_spec.rb
index 42c03fcc777..ebf1bcaf75b 100644
--- a/spec/features/types/form_configuration_query_spec.rb
+++ b/spec/features/types/form_configuration_query_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'form query configuration', js: true, with_cuprite: true do
+RSpec.describe 'form query configuration', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
let(:type_bug) { create(:type_bug) }
let(:type_task) { create(:type_task) }
@@ -93,7 +93,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
it 'can save an empty query group' do
form.add_query_group('Empty test', :children)
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
type_bug.reload
query_group = type_bug.attribute_groups.detect { |x| x.is_a?(Type::QueryGroup) }
@@ -105,7 +105,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
form.add_query_group('Subtasks', :children)
# Save changed query
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
# Visit wp_table
wp_table.visit!
@@ -131,13 +131,13 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
form.add_query_group('Subtasks', :children)
# Save changed query
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
# Visit new wp page
visit new_project_work_packages_path(project)
wp_page.expect_no_group 'Subtasks'
- expect(page).not_to have_text 'Subtasks'
+ expect(page).to have_no_text 'Subtasks'
end
end
@@ -156,7 +156,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
filters.save
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
archived.update_attribute(:active, false)
@@ -184,7 +184,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
# Save changed query
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
type_bug.reload
query = type_bug.attribute_groups.detect { |x| x.key == 'Columns Test' }
@@ -206,7 +206,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
# Save changed query
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
type_bug.reload
query = type_bug.attribute_groups.detect { |x| x.key == 'Columns Test' }
@@ -253,7 +253,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
filters.save
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
# Visit work package with that type
wp_page.visit!
@@ -274,7 +274,7 @@ RSpec.describe 'form query configuration', js: true, with_cuprite: true do
wait_for_fetched_options: false
expect(results).to have_text "Unrelated task"
- expect(results).not_to have_text "Bug ##{unrelated_task.id} Unrelated bug"
+ expect(results).to have_no_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 5638152f7d6..b4e94a74aba 100644
--- a/spec/features/types/form_configuration_spec.rb
+++ b/spec/features/types/form_configuration_spec.rb
@@ -78,7 +78,7 @@ RSpec.describe 'form configuration', :js do
# Wait for page reload
sleep 1
- expect(page).not_to have_css('.group-head', text: 'WHATEVER')
+ expect(page).to have_no_css('.group-head', text: 'WHATEVER')
form.expect_group('details', 'Details')
form.expect_attribute(key: :assignee)
end
@@ -159,7 +159,7 @@ RSpec.describe 'form configuration', :js do
input.set('FOOBAR')
input.send_keys(:escape)
expect(page).to have_css('.group-edit-handler', text: 'COOL STUFF')
- expect(page).not_to have_css('.group-edit-handler', text: 'FOOBAR')
+ expect(page).to have_no_css('.group-edit-handler', text: 'FOOBAR')
# Create new group
form.add_attribute_group('New Group')
@@ -309,8 +309,8 @@ RSpec.describe 'form configuration', :js do
# when adding them to the form configuration
project_settings_page.visit_tab!('custom_fields')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: 'MyNumber')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: type.name)
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: 'MyNumber')
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: type.name)
id_checkbox = find("#project_work_package_custom_field_ids_#{custom_field.id}")
expect(id_checkbox).to be_checked
@@ -328,8 +328,8 @@ RSpec.describe 'form configuration', :js do
# Enable in project, should then be visible
project_settings_page.visit_tab!('custom_fields')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: 'MyNumber')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: type.name)
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: 'MyNumber')
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: type.name)
id_checkbox = find("#project_work_package_custom_field_ids_#{custom_field.id}")
expect(id_checkbox).not_to be_checked
@@ -369,9 +369,9 @@ RSpec.describe 'form configuration', :js do
# Ensure CF is checked
project_settings_page.visit_tab!('custom_fields')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: 'MyNumber')
- expect(page).to have_selector(".custom-field-#{custom_field.id} td", text: type.name)
- expect(page).to have_selector("#project_work_package_custom_field_ids_#{custom_field.id}[checked]")
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: 'MyNumber')
+ expect(page).to have_css(".custom-field-#{custom_field.id} td", text: type.name)
+ expect(page).to have_css("#project_work_package_custom_field_ids_#{custom_field.id}[checked]")
end
end
end
diff --git a/spec/features/types/reset_form_configuration_spec.rb b/spec/features/types/reset_form_configuration_spec.rb
index 1a7880903cb..b3040f06763 100644
--- a/spec/features/types/reset_form_configuration_spec.rb
+++ b/spec/features/types/reset_form_configuration_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Reset form configuration', js: true do
+RSpec.describe 'Reset form configuration', :js do
shared_let(:admin) { create(:admin) }
let(:type) { create(:type) }
@@ -60,7 +60,7 @@ RSpec.describe 'Reset form configuration', js: true do
form.expect_attribute(key: cf_identifier)
form.save_changes
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.', wait: 10)
SeleniumHubWaiter.wait
form.reset_button.click
@@ -70,8 +70,8 @@ RSpec.describe 'Reset form configuration', js: true do
# Wait for page reload
SeleniumHubWaiter.wait
- expect(page).not_to have_selector('.group-head', text: 'NEW GROUP')
- expect(page).not_to have_selector('.group-head', text: 'OTHER')
+ expect(page).to have_no_css('.group-head', text: 'NEW GROUP')
+ expect(page).to have_no_css('.group-head', text: 'OTHER')
type.reload
expect(type.custom_field_ids).to be_empty
diff --git a/spec/features/users/create_spec.rb b/spec/features/users/create_spec.rb
index 1cbdf997190..7047e250c6b 100644
--- a/spec/features/users/create_spec.rb
+++ b/spec/features/users/create_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'create users', :with_cuprite do
shared_examples_for 'successful user creation' do |redirect_to_edit_page: true|
it 'creates the user' do
- expect(page).to have_selector('.op-toast', text: 'Successful creation.')
+ expect(page).to have_css('.op-toast', text: 'Successful creation.')
new_user = User.order(Arel.sql('id DESC')).first
diff --git a/spec/features/users/delete_spec.rb b/spec/features/users/delete_spec.rb
index e4313f247d9..e49c341e3a3 100644
--- a/spec/features/users/delete_spec.rb
+++ b/spec/features/users/delete_spec.rb
@@ -61,7 +61,7 @@ RSpec.describe 'user deletion:', :js, :with_cuprite do
visit my_account_path
within '#main-menu' do
- expect(page).not_to have_content 'Delete account'
+ expect(page).to have_no_content 'Delete account'
end
end
end
@@ -75,7 +75,7 @@ RSpec.describe 'user deletion:', :js, :with_cuprite do
visit edit_user_path(user)
expect(page).to have_content "#{user.firstname} #{user.lastname}"
- expect(page).not_to have_content 'Delete account'
+ expect(page).to have_no_content 'Delete account'
visit deletion_info_user_path(user)
expect(page).to have_text 'Error 404'
@@ -137,7 +137,7 @@ RSpec.describe 'user deletion:', :js, :with_cuprite do
Setting.users_deletable_by_admins = 0
visit edit_user_path(user)
- expect(page).not_to have_content 'Delete account'
+ expect(page).to have_no_content 'Delete account'
end
it 'can change the deletablilty settings' do
@@ -146,8 +146,8 @@ RSpec.describe 'user deletion:', :js, :with_cuprite do
visit admin_settings_users_path
- find(:css, "#settings_users_deletable_by_admins").set(true)
- find(:css, "#settings_users_deletable_by_self").set(true)
+ find_by_id('settings_users_deletable_by_admins').set(true)
+ find_by_id('settings_users_deletable_by_self').set(true)
click_on 'Save'
diff --git a/spec/features/users/edit_users_spec.rb b/spec/features/users/edit_users_spec.rb
index fdbb1490817..0fb5ed885d9 100644
--- a/spec/features/users/edit_users_spec.rb
+++ b/spec/features/users/edit_users_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe 'edit users', :js, :with_cuprite do
it 'hides password settings when switching to an LDAP auth source' do
auth_select.select auth_source.name
- expect(page).not_to have_field('#user_password')
+ expect(page).to have_no_field('#user_password')
end
end
@@ -74,7 +74,7 @@ RSpec.describe 'edit users', :js, :with_cuprite do
it 'shows external authentication being selected and no password settings' do
expect(auth_select.value).to eq auth_source.id.to_s
- expect(page).not_to have_field('#user_password')
+ expect(page).to have_no_field('#user_password')
end
it 'shows password settings when switching back to internal authentication' do
@@ -106,17 +106,17 @@ RSpec.describe 'edit users', :js, :with_cuprite do
expect(page).to have_visible_tab('GENERAL')
- 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_no_css('.admin-overview-menu-item', text: 'Overview')
+ expect(page).to have_no_css('.users-and-permissions-menu-item', text: 'Users and permissions')
+ expect(page).to have_css('.users-menu-item.selected', text: 'Users')
expect(page).to have_select(id: 'user_ldap_auth_source_id')
- expect(page).not_to have_field '#user_password'
+ expect(page).to have_no_field '#user_password'
- expect(page).to have_selector '#user_login'
- expect(page).to have_selector '#user_firstname'
- expect(page).to have_selector '#user_lastname'
- expect(page).to have_selector '#user_mail'
+ expect(page).to have_css '#user_login'
+ expect(page).to have_css '#user_firstname'
+ expect(page).to have_css '#user_lastname'
+ expect(page).to have_css '#user_mail'
firstname_field = find_by_id('user_firstname')
firstname_field.value.length.times do
@@ -127,7 +127,7 @@ RSpec.describe 'edit users', :js, :with_cuprite do
click_button 'Save'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful update.')
+ expect(page).to have_css('.op-toast.-success', text: 'Successful update.')
user.reload
@@ -140,7 +140,7 @@ RSpec.describe 'edit users', :js, :with_cuprite do
click_button 'Send invitation'
- expect(page).to have_selector('.op-toast.-success', text: 'An invitation has been sent to [email protected]')
+ expect(page).to have_css('.op-toast.-success', text: 'An invitation has been sent to [email protected]')
end
it 'can not edit attributes of an admin user' do
diff --git a/spec/features/users/invitation_spec.rb b/spec/features/users/invitation_spec.rb
index 669912bebe5..79a29d73db0 100644
--- a/spec/features/users/invitation_spec.rb
+++ b/spec/features/users/invitation_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe 'invitations', :js, :with_cuprite do
# Visit invitation link with correct token
visit account_activate_path(token: Token::Invitation.last.value)
- expect(page).to have_selector('.spot-modal--header', text: 'Welcome to OpenProject')
+ expect(page).to have_css('.spot-modal--header', text: 'Welcome to OpenProject')
end
end
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 435b8e32820..173584716cb 100644
--- a/spec/features/users/invite_user_modal/custom_fields_spec.rb
+++ b/spec/features/users/invite_user_modal/custom_fields_spec.rb
@@ -103,7 +103,7 @@ RSpec.describe 'Invite user modal custom fields', :js, :with_cuprite do
expect(page).to have_text "Multi list can't be blank."
# Does not show the non req field
- expect(page).not_to have_text non_req_cf.name
+ expect(page).to have_no_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 df8b28500ab..22bc0fb189c 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
@@ -115,7 +115,7 @@ RSpec.describe 'Invite user modal', :js, :with_cuprite do
find('.ng-dropdown-footer button', text: 'Invite', wait: 10).click
modal.run_all_steps
- expect(page).to have_selector('.ng-value-label', text: principal.name)
+ expect(page).to have_css('.ng-value-label', text: principal.name)
wp_page.save!
wp_page.expect_and_dismiss_toaster(message: 'Successful creation.')
@@ -182,7 +182,7 @@ RSpec.describe 'Invite user modal', :js, :with_cuprite do
modal.project_step
ngselect = modal.open_select_in_step 'op-ium-principal-search', query: principal.mail
expect(ngselect).to have_text "No users were found"
- expect(ngselect).not_to have_text "Invite: #{principal.mail}"
+ expect(ngselect).to have_no_text "Invite: #{principal.mail}"
end
end
@@ -216,7 +216,7 @@ RSpec.describe 'Invite user modal', :js, :with_cuprite do
it 'disables projects for which you do not have rights', with_cuprite: false do
ngselect = modal.open_select_in_step '.ng-select-container'
- expect(ngselect).not_to have_text archived_project
+ expect(ngselect).to have_no_text archived_project
end
end
end
@@ -296,7 +296,7 @@ RSpec.describe 'Invite user modal', :js, :with_cuprite do
it 'cannot add an existing user to the project' do
assignee_field.activate!
- expect(page).not_to have_selector('.ng-dropdown-footer', text: 'Invite')
+ expect(page).to have_no_css('.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 f843529d684..6a84b423df6 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
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Inviting user in project the current user is lacking permission in',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Inviting user in project the current user is lacking permission in', :js, :with_cuprite do
let(:modal) do
Components::Users::InviteUserModal.new project: invite_project,
principal: other_user,
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 1d394244e74..05289dac3ff 100644
--- a/spec/features/users/invite_user_modal/subproject_invite_spec.rb
+++ b/spec/features/users/invite_user_modal/subproject_invite_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe 'Invite user modal subprojects', :js, :with_cuprite do
modal.expect_open
modal.within_modal do
- expect(page).to have_selector '.ng-value', text: 'Subproject'
+ expect(page).to have_css '.ng-value', text: 'Subproject'
end
modal.run_all_steps
@@ -87,9 +87,9 @@ RSpec.describe 'Invite user modal subprojects', :js, :with_cuprite do
assignee_field.activate!
- expect(page).to have_selector '.ng-dropdown-panel'
+ expect(page).to have_css '.ng-dropdown-panel'
- expect(page).not_to have_selector('.ng-dropdown-footer button', text: 'Invite')
+ expect(page).to have_no_css('.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 afaa7747a78..f0063f97b18 100644
--- a/spec/features/users/my_spec.rb
+++ b/spec/features/users/my_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'my', js: true, with_cuprite: true do
+RSpec.describe 'my', :js, :with_cuprite do
let(:user_password) { 'bob' * 4 }
let(:user) do
create(:user,
@@ -140,7 +140,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do
it 'API tokens can generated and revoked' do
visit my_access_token_path
- expect(page).not_to have_content('API tokens are not enabled by the administrator.')
+ expect(page).to have_no_content('API tokens are not enabled by the administrator.')
within '#api-token-section' do
expect(page).to have_test_selector('api-token-add', text: 'API token')
@@ -193,7 +193,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do
it 'in Access Tokens they can generate and revoke their RSS key' do
visit my_access_token_path
- expect(page).not_to have_content('RSS tokens are not enabled by the administrator.')
+ expect(page).to have_no_content('RSS tokens are not enabled by the administrator.')
within '#rss-token-section' do
expect(page).to have_test_selector('rss-token-add', text: 'RSS token')
@@ -263,7 +263,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do
it 'shows iCalendar tokens with their calender and project info' do
visit my_access_token_path
- expect(page).not_to have_content('To add an iCalendar token') # ...
+ expect(page).to have_no_content('To add an iCalendar token') # ...
within '#icalendar-token-section' do
[
@@ -277,7 +277,7 @@ RSpec.describe 'my', js: true, with_cuprite: true do
expect(page).to have_test_selector("ical-token-row-#{ical_token.id}-name", text: token_name)
expect(page).to have_test_selector("ical-token-row-#{ical_token.id}-query-name", text: query.name)
expect(page).to have_test_selector("ical-token-row-#{ical_token.id}-project-name",
- text: query.project.name)
+ text: query.project.name)
end
end
end
diff --git a/spec/features/users/password_change_spec.rb b/spec/features/users/password_change_spec.rb
index 734de1f7016..be6dd3137cb 100644
--- a/spec/features/users/password_change_spec.rb
+++ b/spec/features/users/password_change_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'random password generation', js: true, with_cuprite: true do
+RSpec.describe 'random password generation', :js, :with_cuprite do
shared_let(:admin) { create(:admin) }
let(:old_password) { 'old_Password!123' }
@@ -44,23 +44,23 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
it 'can log in with a random generated password' do
user_page.visit!
- expect(page).to have_selector('#user_password')
- expect(page).to have_selector('#user_password_confirmation')
+ expect(page).to have_css('#user_password')
+ expect(page).to have_css('#user_password_confirmation')
check 'user_assign_random_password'
- expect(page).to have_selector('#user_password[disabled]')
- expect(page).to have_selector('#user_password_confirmation[disabled]')
+ expect(page).to have_css('#user_password[disabled]')
+ expect(page).to have_css('#user_password_confirmation[disabled]')
# Remember password for login
password = nil
expect(OpenProject::Passwords::Generator)
- .to receive(:random_password)
- .and_wrap_original { |m, *args| password = m.call(*args) }
+ .to(receive(:random_password)
+ .and_wrap_original { |m, *args| password = m.call(*args) })
click_on 'Save'
- expect(page).to have_selector('.op-toast', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast', text: I18n.t(:notice_successful_update))
expect(password).to be_present
# Logout
@@ -68,7 +68,7 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
login_with user.login, password
# Expect password change
- expect(page).to have_selector('#new_password')
+ expect(page).to have_css('#new_password')
# Give wrong password
fill_in 'password', with: old_password
@@ -90,7 +90,7 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
expect(Sessions::UserSession.for_user(user.id).count).to be >= 1
click_on 'Save'
- expect(page).to have_selector('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
+ expect(page).to have_css('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
# The old session is removed
expect(Sessions::UserSession.find_by(session_id: 'other')).to be_nil
@@ -105,7 +105,7 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
login_with user.login, new_password
visit my_account_path
- expect(page).to have_selector('.account-menu-item.selected')
+ expect(page).to have_css('.account-menu-item.selected')
end
it 'can configure and enforce password rules' do
@@ -126,7 +126,7 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
find_by_id('settings_password_min_adhered_rules').set 3
scroll_to_and_click(find('.button', text: 'Save'))
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
Setting.clear_cache
@@ -137,26 +137,26 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
# Go to user page
user_page.visit!
- expect(page).to have_selector('#user_password')
- expect(page).to have_selector('#user_password_confirmation')
+ expect(page).to have_css('#user_password')
+ expect(page).to have_css('#user_password_confirmation')
# And I try to set my new password to "adminADMIN"
fill_in 'user_password', with: 'adminADMIN'
fill_in 'user_password_confirmation', with: 'adminADMIN'
scroll_to_and_click(find('.button', text: 'Save'))
- expect(page).to have_selector('.errorExplanation', text: "Password Must contain characters of the following classes")
+ expect(page).to have_css('.errorExplanation', text: "Password Must contain characters of the following classes")
# 2 of 3 classes
fill_in 'user_password', with: 'adminADMIN123'
fill_in 'user_password_confirmation', with: 'adminADMIN123'
scroll_to_and_click(find('.button', text: 'Save'))
- expect(page).to have_selector('.errorExplanation', text: "Password Must contain characters of the following classes")
+ expect(page).to have_css('.errorExplanation', text: "Password Must contain characters of the following classes")
# All classes
fill_in 'user_password', with: 'adminADMIN!'
fill_in 'user_password_confirmation', with: 'adminADMIN!'
scroll_to_and_click(find('.button', text: 'Save'))
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
end
end
@@ -169,12 +169,11 @@ RSpec.describe 'random password generation', js: true, with_cuprite: true do
user_page.visit!
end
- context 'with 2 of lowercase, uppercase, and numeric characters',
- js: true, with_settings: {
- password_active_rules: %w(lowercase uppercase numeric),
- password_min_adhered_rules: 2,
- password_min_length: 4
- } do
+ context 'with 2 of lowercase, uppercase, and numeric characters', :js, with_settings: {
+ password_active_rules: %w(lowercase uppercase numeric),
+ password_min_adhered_rules: 2,
+ password_min_length: 4
+ } 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/users/self_registration_spec.rb b/spec/features/users/self_registration_spec.rb
index 1cb683a3062..b4de1f33fe3 100644
--- a/spec/features/users/self_registration_spec.rb
+++ b/spec/features/users/self_registration_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'user self registration', js: true, with_cuprite: true do
+RSpec.describe 'user self registration', :js, :with_cuprite do
let(:admin_password) { 'Test123Test123' }
let(:admin) { create(:admin, password: admin_password, password_confirmation: admin_password) }
let(:home_page) { Pages::Home.new }
@@ -55,7 +55,7 @@ RSpec.describe 'user self registration', js: true, with_cuprite: true do
.to have_content('Your account was created and is now pending administrator approval.')
end
- it 'allows self registration and activation by an admin', signout_via_visit: true do
+ it 'allows self registration and activation by an admin', :signout_via_visit do
home_page.visit!
# registration as an anonymous user
@@ -120,7 +120,7 @@ RSpec.describe 'user self registration', js: true, with_cuprite: true do
within '.op-app-header' do
expect(page)
- .to have_selector("a[title='#{registered_user.name}']")
+ .to have_css("a[title='#{registered_user.name}']")
end
end
end
diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb
index a2eb351fcaa..597b6132333 100644
--- a/spec/features/users/show_spec.rb
+++ b/spec/features/users/show_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'index users', js: true, with_cuprite: true do
+RSpec.describe 'index users', :js, :with_cuprite do
current_user { create(:admin) }
let(:index_page) { Pages::Admin::Users::Index.new }
@@ -43,9 +43,9 @@ RSpec.describe 'index users', js: true, with_cuprite: true do
visit user_path(current_user)
- expect(page).to have_selector('li', text: "Project: #{project.name}")
+ expect(page).to have_css('li', text: "Project: #{project.name}")
expected_work_package_title = "#{work_package.type.name} ##{work_package.id}: #{work_package.subject} " \
"(Project: #{work_package.project.name})"
- expect(page).to have_selector('li', text: expected_work_package_title)
+ expect(page).to have_css('li', text: expected_work_package_title)
end
end
diff --git a/spec/features/users/user_memberships_spec.rb b/spec/features/users/user_memberships_spec.rb
index cabfaffdca1..23d8e234634 100644
--- a/spec/features/users/user_memberships_spec.rb
+++ b/spec/features/users/user_memberships_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative '../principals/shared_memberships_examples'
-RSpec.describe 'user memberships through user page', js: true, with_cuprite: true do
+RSpec.describe 'user memberships through user page', :js, :with_cuprite do
include_context 'principal membership management context'
shared_let(:principal) { create(:user, firstname: 'Foobar', lastname: 'Blabla') }
diff --git a/spec/features/versions/delete_spec.rb b/spec/features/versions/delete_spec.rb
index cda7755a22f..906bfeeecb0 100644
--- a/spec/features/versions/delete_spec.rb
+++ b/spec/features/versions/delete_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'version delete', js: true, with_cuprite: true do
+RSpec.describe 'version delete', :js, :with_cuprite do
let!(:project) { create(:project, name: 'Parent') }
let!(:archived_child) { create(:project, name: 'Archived child', parent: project, active: false) }
@@ -53,8 +53,8 @@ RSpec.describe 'version delete', js: true, with_cuprite: true do
end
end
- expect(page).to have_selector('.op-toast.-error', text: I18n.t(:error_can_not_delete_in_use_archived_undisclosed))
- expect(page).not_to have_selector("a", text: 'Archived child')
+ expect(page).to have_css('.op-toast.-error', text: I18n.t(:error_can_not_delete_in_use_archived_undisclosed))
+ expect(page).to have_no_css("a", text: 'Archived child')
user.update!(admin: true)
@@ -67,7 +67,7 @@ RSpec.describe 'version delete', js: true, with_cuprite: true do
end
end
- expect(page).to have_selector('.op-toast.-error', text: 'There are also work packages in archived projects.')
- expect(page).to have_selector("a", text: 'Archived child')
+ expect(page).to have_css('.op-toast.-error', text: 'There are also work packages in archived projects.')
+ expect(page).to have_css("a", text: 'Archived child')
end
end
diff --git a/spec/features/versions/graph_spec.rb b/spec/features/versions/graph_spec.rb
index 70abd75e1d2..8dbb3e60388 100644
--- a/spec/features/versions/graph_spec.rb
+++ b/spec/features/versions/graph_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'version show graph', js: true do
+RSpec.describe 'version show graph', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:version) { create(:version, project:) }
@@ -45,7 +45,7 @@ RSpec.describe 'version show graph', js: true do
end
it 'shows a status graph' do
- expect(page).to have_selector('.work-packages-embedded-view--container', wait: 20)
- expect(page).to have_selector('.op-wp-embeded-graph', visible: :all, wait: 20)
+ expect(page).to have_css('.work-packages-embedded-view--container', wait: 20)
+ expect(page).to have_css('.op-wp-embeded-graph', visible: :all, wait: 20)
end
end
diff --git a/spec/features/watching/toggle_watching_spec.rb b/spec/features/watching/toggle_watching_spec.rb
index a0dd17e7e3f..705b1079259 100644
--- a/spec/features/watching/toggle_watching_spec.rb
+++ b/spec/features/watching/toggle_watching_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Toggle watching', js: true do
+RSpec.describe 'Toggle watching', :js do
let(:project) { create(:project) }
let(:role) { create(:project_role, permissions: %i[view_messages view_wiki_pages]) }
let(:user) { create(:user, member_with_roles: { project => role }) }
diff --git a/spec/features/wiki/adding_editing_history_spec.rb b/spec/features/wiki/adding_editing_history_spec.rb
index 6e28ff17e91..583847e257f 100644
--- a/spec/features/wiki/adding_editing_history_spec.rb
+++ b/spec/features/wiki/adding_editing_history_spec.rb
@@ -66,7 +66,7 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
it 'adding, editing and history' do
visit project_settings_modules_path(project)
- expect(page).not_to have_selector('.menu-sidebar .main-item-wrapper', text: 'Wiki')
+ expect(page).to have_no_css('.menu-sidebar .main-item-wrapper', text: 'Wiki')
within '#content' do
check 'Wiki'
@@ -74,7 +74,7 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
click_button 'Save'
end
- expect(page).to have_selector('.wiki-menu--main-item', text: 'Wiki', visible: :all)
+ expect(page).to have_css('.wiki-menu--main-item', text: 'Wiki', visible: :all)
# creating by accessing the page
visit project_wiki_path(project, 'new page')
@@ -82,8 +82,8 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
find('.ck-content').base.send_keys(content_first_version)
click_button 'Save'
- expect(page).to have_selector('.title-container', text: 'New page')
- expect(page).to have_selector('.wiki-content', text: content_first_version)
+ expect(page).to have_css('.title-container', text: 'New page')
+ expect(page).to have_css('.wiki-content', text: content_first_version)
within '.toolbar-items' do
SeleniumHubWaiter.wait
@@ -94,7 +94,7 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
SeleniumHubWaiter.wait
click_button 'Save'
- expect(page).to have_selector('.wiki-content', text: content_second_version)
+ expect(page).to have_css('.wiki-content', text: content_second_version)
within '.toolbar-items' do
SeleniumHubWaiter.wait
@@ -106,8 +106,8 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
click_on 'View differences'
within '.text-diff' do
- expect(page).to have_selector('ins.diffmod', text: 'second')
- expect(page).to have_selector('del.diffmod', text: 'first')
+ expect(page).to have_css('ins.diffmod', text: 'second')
+ expect(page).to have_css('del.diffmod', text: 'first')
end
SeleniumHubWaiter.wait
@@ -119,14 +119,14 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
SeleniumHubWaiter.wait
find('td.id a', text: 1).click
- expect(page).to have_selector('.wiki-version--details', text: 'Version 1/2')
- expect(page).to have_selector('.wiki-content', text: content_first_version)
+ expect(page).to have_css('.wiki-version--details', text: 'Version 1/2')
+ expect(page).to have_css('.wiki-content', text: content_first_version)
SeleniumHubWaiter.wait
find('.button', text: 'Next').click
- expect(page).to have_selector('.wiki-version--details', text: 'Version 2/2')
- expect(page).to have_selector('.wiki-content', text: content_second_version)
+ expect(page).to have_css('.wiki-version--details', text: 'Version 2/2')
+ expect(page).to have_css('.wiki-content', text: content_second_version)
login_as other_user
@@ -150,7 +150,7 @@ RSpec.describe 'wiki pages', :js, with_settings: { journal_aggregation_time_minu
click_on 'History'
end
- expect(page).to have_selector('tr.wiki-page-version:last-of-type .author', text: other_user.name)
- expect(page).to have_selector('tr.wiki-page-version:last-of-type .comments', text: other_user_comment)
+ expect(page).to have_css('tr.wiki-page-version:last-of-type .author', text: other_user.name)
+ expect(page).to have_css('tr.wiki-page-version:last-of-type .comments', text: other_user_comment)
end
end
diff --git a/spec/features/wiki/attachment_upload_spec.rb b/spec/features/wiki/attachment_upload_spec.rb
index 29b11d4843c..0a431c2c518 100644
--- a/spec/features/wiki/attachment_upload_spec.rb
+++ b/spec/features/wiki/attachment_upload_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'Upload attachment to wiki page', js: true do
+RSpec.describe 'Upload attachment to wiki page', :js do
let(:user) do
create(:user,
member_with_permissions: { project => %i[view_wiki_pages edit_wiki_pages] })
@@ -57,7 +57,7 @@ RSpec.describe 'Upload attachment to wiki page', js: true do
click_on 'Save'
expect(page).to have_text("Successful creation")
- expect(page).to have_selector('#content img', count: 1)
+ expect(page).to have_css('#content img', count: 1)
expect(page).to have_content('Image uploaded the first time')
attachments_list.expect_attached('image.png')
@@ -78,8 +78,8 @@ RSpec.describe 'Upload attachment to wiki page', js: true do
editor.in_editor do |container, _|
# Expect URL is mapped to the correct URL
- expect(container).to have_selector('img[src^="/api/v3/attachments/"]', count: 2)
- expect(container).not_to have_selector('img[src="image.png"]')
+ expect(container).to have_css('img[src^="/api/v3/attachments/"]', count: 2)
+ expect(container).to have_no_css('img[src="image.png"]')
container.find('img[src^="/api/v3/attachments/"]', match: :first).click
end
@@ -89,18 +89,18 @@ RSpec.describe 'Upload attachment to wiki page', js: true do
click_on 'Save'
expect(page).to have_text("Successful update")
- expect(page).to have_selector('#content img', count: 2)
+ expect(page).to have_css('#content img', count: 2)
# First figcaption is lost by having replaced the markdown
expect(page).to have_content('Image uploaded the second time')
attachments_list.expect_attached('image.png', count: 2)
# Both images rendered referring to the api endpoint
- expect(page).to have_selector('img[src^="/api/v3/attachments/"]', count: 2)
+ expect(page).to have_css('img[src^="/api/v3/attachments/"]', count: 2)
# The first image is resized using width:yypx style
- expect(page).to have_selector 'figure.op-uc-figure img[style*="width:"]'
+ expect(page).to have_css 'figure.op-uc-figure img[style*="width:"]'
- expect(wiki_page_content).to have_selector '.op-uc-image[src^="/api/v3/attachments"]'
+ expect(wiki_page_content).to have_css '.op-uc-image[src^="/api/v3/attachments"]'
end
it 'can upload an image to new and existing wiki page via drag & drop on attachments' do
diff --git a/spec/features/wiki/child_pages_spec.rb b/spec/features/wiki/child_pages_spec.rb
index 5e685fbfcb8..2c1a6f81857 100644
--- a/spec/features/wiki/child_pages_spec.rb
+++ b/spec/features/wiki/child_pages_spec.rb
@@ -62,12 +62,12 @@ RSpec.describe 'wiki child pages', :js do
click_button 'Save'
# hierarchy displayed in the breadcrumb
- expect(page).to have_selector("#breadcrumb #{test_selector('op-breadcrumb')}",
- text: parent_page.title.to_s)
+ expect(page).to have_css("#breadcrumb #{test_selector('op-breadcrumb')}",
+ text: parent_page.title.to_s)
# hierarchy displayed in the sidebar
- expect(page).to have_selector('.pages-hierarchy',
- text: "#{parent_page.title}\n#{child_page_name}")
+ expect(page).to have_css('.pages-hierarchy',
+ text: "#{parent_page.title}\n#{child_page_name}")
# on toc page
visit index_project_wiki_index_path(project)
diff --git a/spec/features/wiki/edit_new_page_spec.rb b/spec/features/wiki/edit_new_page_spec.rb
index e0efe3ff3eb..50f0a7b6fb1 100644
--- a/spec/features/wiki/edit_new_page_spec.rb
+++ b/spec/features/wiki/edit_new_page_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Editing a new wiki page', js: true do
+RSpec.describe 'Editing a new wiki page', :js do
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:user) { create(:admin) }
@@ -41,6 +41,6 @@ RSpec.describe 'Editing a new wiki page', js: true do
expect(page).to have_field 'page_title', with: 'Foobar'
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success', text: 'Successful creation.', wait: 10)
+ expect(page).to have_css('.op-toast.-success', text: 'Successful creation.', wait: 10)
end
end
diff --git a/spec/features/wiki/restore_main_item_spec.rb b/spec/features/wiki/restore_main_item_spec.rb
index 9f699507ebd..72321e2edbb 100644
--- a/spec/features/wiki/restore_main_item_spec.rb
+++ b/spec/features/wiki/restore_main_item_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe 'Wiki page - restoring main wiki item' do
visit project_path(project)
expect(page)
- .to have_selector('.wiki-menu--main-item')
+ .to have_css('.wiki-menu--main-item')
# Delete all items for some reason
MenuItems::WikiMenuItem.main_items(project.wiki).destroy_all
@@ -55,7 +55,7 @@ RSpec.describe 'Wiki page - restoring main wiki item' do
visit project_path(project)
expect(page)
- .to have_selector('.wiki-menu--main-item')
+ .to have_css('.wiki-menu--main-item')
expect(MenuItems::WikiMenuItem.main_items(project.wiki).count).to eq 1
end
diff --git a/spec/features/wiki/wiki_page_external_link_spec.rb b/spec/features/wiki/wiki_page_external_link_spec.rb
index 00307712d10..96b6978fb6e 100644
--- a/spec/features/wiki/wiki_page_external_link_spec.rb
+++ b/spec/features/wiki/wiki_page_external_link_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wiki page external link', js: true do
+RSpec.describe 'Wiki page external link', :js do
shared_let(:admin) { create(:admin) }
current_user { admin }
diff --git a/spec/features/wiki/wiki_page_navigation_spec.rb b/spec/features/wiki/wiki_page_navigation_spec.rb
index 6abfb2dbf70..3a259602368 100644
--- a/spec/features/wiki/wiki_page_navigation_spec.rb
+++ b/spec/features/wiki/wiki_page_navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wiki page navigation spec', js: true do
+RSpec.describe 'Wiki page navigation spec', :js do
shared_let(:admin) { create(:admin) }
current_user { admin }
@@ -51,9 +51,9 @@ RSpec.describe 'Wiki page navigation spec', js: true do
it 'scrolls to the selected page on load (Regression #36937)' do
visit project_wiki_path(project, wiki_page_55)
- expect(page).to have_selector('div.wiki-content')
+ expect(page).to have_css('div.wiki-content')
- expect(page).to have_selector('.title-container h2', text: 'Wiki Page No. 55')
+ expect(page).to have_css('.title-container h2', text: 'Wiki Page No. 55')
# Expect scrolled to menu node
expect_element_in_view page.find('.tree-menu--item.-selected', text: 'Wiki Page No. 55')
diff --git a/spec/features/wiki/wiki_unicode_spec.rb b/spec/features/wiki/wiki_unicode_spec.rb
index 6d120b2ae0b..ed60fb5ef99 100644
--- a/spec/features/wiki/wiki_unicode_spec.rb
+++ b/spec/features/wiki/wiki_unicode_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wiki unicode title spec', js: true do
+RSpec.describe 'Wiki unicode title spec', :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
@@ -90,22 +90,22 @@ RSpec.describe 'Wiki unicode title spec', js: true do
find('.ck-content').base.send_keys(wiki_body)
click_button 'Save'
- expect(page).to have_selector('.title-container h2', text: 'Wiki')
- expect(page).to have_selector('a.wiki-page', count: 5)
+ expect(page).to have_css('.title-container h2', text: 'Wiki')
+ expect(page).to have_css('a.wiki-page', count: 5)
end
it 'shows renders correct links' do
expected_titles.each_with_index do |title, i|
visit project_wiki_path(project, :wiki)
- expect(page).to have_selector('div.wiki-content')
+ expect(page).to have_css('div.wiki-content')
target_link = all('div.wiki-content a.wiki-page')[i]
expect(target_link.text).to eq(title)
expect(target_link[:href]).to match("/wiki/#{expected_slugs[i]}")
target_link.click
- expect(page).to have_selector('.title-container h2', text: title)
+ expect(page).to have_css('.title-container h2', text: title)
end
end
end
diff --git a/spec/features/work_package_show_spec.rb b/spec/features/work_package_show_spec.rb
index b0e0c491e03..88336e5d254 100644
--- a/spec/features/work_package_show_spec.rb
+++ b/spec/features/work_package_show_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package show page', selenium: true do
+RSpec.describe 'Work package show page', :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package) do
@@ -43,7 +43,7 @@ RSpec.describe 'Work package show page', selenium: true do
work_package.save!
end
- it 'all different angular based work package views', js: true do
+ it 'all different angular based work package views', :js do
wp_page = Pages::FullWorkPackage.new(work_package)
wp_page.visit!
diff --git a/spec/features/work_packages/attachments/attachment_upload_spec.rb b/spec/features/work_packages/attachments/attachment_upload_spec.rb
index 33d083f94a8..479a0ddbfb4 100644
--- a/spec/features/work_packages/attachments/attachment_upload_spec.rb
+++ b/spec/features/work_packages/attachments/attachment_upload_spec.rb
@@ -148,7 +148,7 @@ RSpec.describe 'Upload attachment to work package', :js, :with_cuprite do
editor.in_editor do |_container, editable|
expect(editable).to have_css('img[src*="/api/v3/attachments/"]', wait: 20)
- expect(editable).not_to have_css('.ck-upload-placeholder-loader')
+ expect(editable).to have_no_css('.ck-upload-placeholder-loader')
end
sleep 2 unless example.metadata[:with_cuprite]
@@ -216,7 +216,7 @@ RSpec.describe 'Upload attachment to work package', :js, :with_cuprite do
editor.in_editor do |_container, editable|
expect(editable).to have_css('img[src*="/api/v3/attachments/"]', wait: 20)
- expect(editable).not_to have_css('.ck-upload-placeholder-loader')
+ expect(editable).to have_no_css('.ck-upload-placeholder-loader')
end
sleep 2 unless example.metadata[:with_cuprite]
diff --git a/spec/features/work_packages/bulk/copy_work_package_spec.rb b/spec/features/work_packages/bulk/copy_work_package_spec.rb
index 635f159e6b0..fd9f238613d 100644
--- a/spec/features/work_packages/bulk/copy_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/copy_work_package_spec.rb
@@ -71,9 +71,9 @@ RSpec.describe 'Copy work packages through Rails view', :js, :with_cuprite do
context_menu.choose 'Bulk copy'
expect(page).to have_css('#new_project_id') # rubocop:disable RSpec/ExpectInHook
-
+
wait_for_network_idle
-
+
expect_page_reload do
select_autocomplete page.find_test_selector('new_project_id'),
query: project2.name,
diff --git a/spec/features/work_packages/bulk/move_work_package_spec.rb b/spec/features/work_packages/bulk/move_work_package_spec.rb
index d88b219d166..881fefb192e 100644
--- a/spec/features/work_packages/bulk/move_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/move_work_package_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'features/page_objects/notification'
require 'support/components/autocompleter/ng_select_autocomplete_helpers'
-RSpec.describe 'Moving a work package through Rails view', js: true do
+RSpec.describe 'Moving a work package through Rails view', :js do
include Components::Autocompleter::NgSelectAutocompleteHelpers
let(:dev_role) do
@@ -82,7 +82,7 @@ RSpec.describe 'Moving a work package through Rails view', js: true do
context_menu.choose 'Change project'
# On work packages move page
- expect(page).to have_selector('#new_project_id')
+ expect(page).to have_css('#new_project_id')
select_autocomplete page.find_test_selector('new_project_id'),
query: 'Target',
select_text: 'Target',
@@ -159,9 +159,9 @@ RSpec.describe 'Moving a work package through Rails view', js: true do
end
expect(page)
- .to have_selector('.op-toast.-error',
- text: I18n.t(:'work_packages.bulk.none_could_be_saved',
- total: 1))
+ .to have_css('.op-toast.-error',
+ text: I18n.t(:'work_packages.bulk.none_could_be_saved',
+ total: 1))
child_wp.reload
work_package.reload
expect(work_package.project_id).to eq(project.id)
@@ -180,7 +180,7 @@ RSpec.describe 'Moving a work package through Rails view', js: true do
click_on 'Move and follow'
end
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
child_wp.reload
work_package.reload
@@ -224,21 +224,21 @@ RSpec.describe 'Moving a work package through Rails view', js: true do
it 'displays an error message explaining which work package could not be moved and why' do
expect(page)
- .to have_selector('.op-toast.-error',
- text: I18n.t('work_packages.bulk.could_not_be_saved'))
+ .to have_css('.op-toast.-error',
+ text: I18n.t('work_packages.bulk.could_not_be_saved'))
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: "#{work_package2.id}: Project #{I18n.t('activerecord.errors.messages.error_readonly')}"
)
expect(page)
- .to have_selector('.op-toast.-error',
- text: I18n.t('work_packages.bulk.x_out_of_y_could_be_saved',
- failing: 1,
- total: 2,
- success: 1))
+ .to have_css('.op-toast.-error',
+ text: I18n.t('work_packages.bulk.x_out_of_y_could_be_saved',
+ failing: 1,
+ total: 2,
+ success: 1))
expect(work_package.reload.project_id).to eq(project2.id)
expect(work_package2.reload.project_id).to eq(project.id)
diff --git a/spec/features/work_packages/bulk/update_work_package_spec.rb b/spec/features/work_packages/bulk/update_work_package_spec.rb
index 84bfb998bfb..0b5392c67cf 100644
--- a/spec/features/work_packages/bulk/update_work_package_spec.rb
+++ b/spec/features/work_packages/bulk/update_work_package_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'Bulk update work packages through Rails view', js: true, with_cuprite: true do
+RSpec.describe 'Bulk update work packages through Rails view', :js, :with_cuprite do
shared_let(:type) { create(:type, name: 'Bug') }
shared_let(:project) { create(:project, name: 'Source', types: [type]) }
shared_let(:status) { create(:status) }
@@ -108,19 +108,19 @@ RSpec.describe 'Bulk update work packages through Rails view', js: true, with_cu
click_on 'Submit'
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: I18n.t('work_packages.bulk.none_could_be_saved', total: 2)
)
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: "#{work_package.id}: Parent #{I18n.t('activerecord.errors.messages.does_not_exist')}"
)
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: <<~MSG.squish
#{work_package2.id}:
@@ -149,13 +149,13 @@ RSpec.describe 'Bulk update work packages through Rails view', js: true, with_cu
click_on 'Submit'
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: I18n.t('work_packages.bulk.x_out_of_y_could_be_saved', total: 2, failing: 1, success: 1)
)
expect(page)
- .to have_selector(
+ .to have_css(
'.op-toast.-error',
text: <<~MSG.squish
#{work_package2.id}:
@@ -184,7 +184,7 @@ RSpec.describe 'Bulk update work packages through Rails view', js: true, with_cu
fill_in custom_field.name, with: 'Custom field text'
click_on 'Submit'
- expect(page).to have_selector('.op-toast.-success', text: I18n.t(:notice_successful_update))
+ expect(page).to have_css('.op-toast.-success', text: I18n.t(:notice_successful_update))
# Should update 2 work package custom fields
work_package.reload
diff --git a/spec/features/work_packages/cancel_editing_spec.rb b/spec/features/work_packages/cancel_editing_spec.rb
index 8994187d29f..038d1cd3694 100644
--- a/spec/features/work_packages/cancel_editing_spec.rb
+++ b/spec/features/work_packages/cancel_editing_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Cancel editing work package', js: true do
+RSpec.describe 'Cancel editing work package', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package) { create(:work_package, project:) }
@@ -53,7 +53,7 @@ RSpec.describe 'Cancel editing work package', js: true do
def expect_active_edit(path)
visit path
expect_angular_frontend_initialized
- expect(page).to have_selector('#wp-new-inline-edit--field-subject', wait: 10)
+ expect(page).to have_css('#wp-new-inline-edit--field-subject', wait: 10)
end
def expect_subject(val)
@@ -65,7 +65,7 @@ RSpec.describe 'Cancel editing work package', js: true do
find('.op-logo--link').click
page.driver.browser.switch_to.alert.accept if alert
- expect(page).to have_selector('#projects-menu', text: 'Select a project')
+ expect(page).to have_css('#projects-menu', text: 'Select a project')
end
it 'does not show an alert when moving to other pages' do
@@ -92,7 +92,7 @@ RSpec.describe 'Cancel editing work package', js: true do
wp_table.open_split_view(work_package2)
page.driver.browser.switch_to.alert.dismiss
- expect(page).to have_selector('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css('#wp-new-inline-edit--field-subject')
expect(wp_page).not_to have_alert_dialog
end
@@ -138,14 +138,14 @@ RSpec.describe 'Cancel editing work package', js: true do
find('.work-packages-show-view-button').click
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_selector('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css('#wp-new-inline-edit--field-subject')
expect_subject('foobar')
# Moving back also works
page.execute_script('window.history.back()')
expect(wp_page).not_to have_alert_dialog
- expect(page).to have_selector('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css('#wp-new-inline-edit--field-subject')
expect_subject('foobar')
# Cancel edition
@@ -193,8 +193,8 @@ RSpec.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).not_to have_selector('#wp-new-inline-edit--field-subject')
- expect(page).to have_selector('.work-packages--details--subject', text: work_package2.subject)
+ expect(page).to have_no_css('#wp-new-inline-edit--field-subject')
+ expect(page).to have_css('.work-packages--details--subject', text: work_package2.subject)
# Moving somewhere else
expect_active_edit(new_split_work_packages_path)
diff --git a/spec/features/work_packages/cards/wp_card_status_spec.rb b/spec/features/work_packages/cards/wp_card_status_spec.rb
index e05d15aa4f4..0e5ddd9444a 100644
--- a/spec/features/work_packages/cards/wp_card_status_spec.rb
+++ b/spec/features/work_packages/cards/wp_card_status_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Update status from WP card', js: true, with_cuprite: true do
+RSpec.describe 'Update status from WP card', :js, :with_cuprite do
let(:manager_role) do
create(:project_role, permissions: %i[view_work_packages edit_work_packages])
end
diff --git a/spec/features/work_packages/copy_spec.rb b/spec/features/work_packages/copy_spec.rb
index cebe4f303be..53ccc792d3b 100644
--- a/spec/features/work_packages/copy_spec.rb
+++ b/spec/features/work_packages/copy_spec.rb
@@ -100,9 +100,9 @@ RSpec.describe 'Work package copy', :js, :selenium do
to_copy_work_package_page.update_attributes Description: 'Copied WP Description'
to_copy_work_package_page.save!
- expect(page).to have_selector('.op-toast--content',
- text: I18n.t('js.notice_successful_create'),
- wait: 20)
+ expect(page).to have_css('.op-toast--content',
+ text: I18n.t('js.notice_successful_create'),
+ wait: 20)
copied_work_package = WorkPackage.order(created_at: 'desc').first
@@ -123,7 +123,7 @@ RSpec.describe 'Work package copy', :js, :selenium do
work_package_page.visit_tab! :relations
expect_angular_frontend_initialized
- expect(page).to have_selector('.relation-group--header', text: 'RELATED TO', wait: 20)
+ expect(page).to have_css('.relation-group--header', text: 'RELATED TO', wait: 20)
expect(page).to have_test_selector('op-relation--row-subject', text: original_work_package.subject)
end
@@ -176,7 +176,7 @@ RSpec.describe 'Work package copy', :js, :selenium do
work_package_page.visit_tab!('relations')
expect_angular_frontend_initialized
- expect(page).to have_selector('.relation-group--header', text: 'RELATED TO', wait: 20)
+ expect(page).to have_css('.relation-group--header', text: 'RELATED TO', wait: 20)
expect(page).to have_test_selector('op-relation--row-subject', text: original_work_package.subject)
end
end
diff --git a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
index b2bbbfca5f1..b8d4a3ceb30 100644
--- a/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_follows_relation_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Datepicker logic on follow relationships',
- js: true,
- with_cuprite: true,
+RSpec.describe 'Datepicker logic on follow relationships', :js, :with_cuprite,
with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:user) { create(:admin) }
@@ -45,7 +43,6 @@ RSpec.describe 'Datepicker logic on follow relationships',
due_date: Date.parse('2024-02-05'))
end
-
let(:work_packages_page) { Pages::FullWorkPackage.new(follower) }
let(:datepicker) { date_field.datepicker }
diff --git a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
index 919fc1d5078..3d1a10a9a0b 100644
--- a/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_logic_spec.rb
@@ -29,9 +29,7 @@
require 'spec_helper'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Datepicker modal logic test cases (WP #43539)',
- js: true,
- with_cuprite: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Datepicker modal logic test cases (WP #43539)', :js, :with_cuprite, 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_non_working_day_spec.rb b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
index 279e8234193..a5e34ae11eb 100644
--- a/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_non_working_day_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Datepicker modal individual non working days (WP #44453)',
- js: true,
+RSpec.describe 'Datepicker modal individual non working days (WP #44453)', :js,
with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project) }
diff --git a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
index a437506ce6e..1aa18d14b62 100644
--- a/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
+++ b/spec/features/work_packages/datepicker/datepicker_parent_spec.rb
@@ -29,8 +29,7 @@
require 'spec_helper'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Datepicker logic on parents',
- js: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Datepicker logic on parents', :js, 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/closed_status_and_version_spec.rb b/spec/features/work_packages/details/closed_status_and_version_spec.rb
index 875e2aa8297..46293fc9c65 100644
--- a/spec/features/work_packages/details/closed_status_and_version_spec.rb
+++ b/spec/features/work_packages/details/closed_status_and_version_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Closed status and version in full view', js: true do
+RSpec.describe 'Closed status and version in full view', :js do
let(:type) { create(:type) }
let(:status) { create(:closed_status) }
@@ -25,6 +25,6 @@ RSpec.describe 'Closed status and version in full view', js: true do
wp_page.expect_and_dismiss_toaster type: :error,
message: I18n.t('js.work_packages.message_work_package_status_blocked')
- expect(page).to have_selector("#{test_selector('op-wp-status-button')} button[disabled]")
+ expect(page).to have_css("#{test_selector('op-wp-status-button')} button[disabled]")
end
end
diff --git a/spec/features/work_packages/details/context_menu_spec.rb b/spec/features/work_packages/details/context_menu_spec.rb
index 1145d71dae1..54cab9a7b52 100644
--- a/spec/features/work_packages/details/context_menu_spec.rb
+++ b/spec/features/work_packages/details/context_menu_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work package single context menu', js: true do
+RSpec.describe 'Work package single context menu', :js do
let(:user) { create(:admin) }
let(:work_package) { create(:work_package) }
@@ -14,8 +14,8 @@ RSpec.describe 'Work package single context menu', js: true do
it 'sets the correct copy project link' do
find('.menu-item', text: 'Copy to other project', exact_text: true).click
- expect(page).to have_selector('h2', text: I18n.t(:button_copy))
- expect(page).to have_selector('a.work_package', text: "##{work_package.id}")
+ expect(page).to have_css('h2', text: I18n.t(:button_copy))
+ expect(page).to have_css('a.work_package', text: "##{work_package.id}")
expect(page).to have_current_path /work_packages\/move\/new\?copy=true&ids\[\]=#{work_package.id}/
end
diff --git a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
index ceeb3586bab..5ce3fc766c4 100644
--- a/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
+++ b/spec/features/work_packages/details/custom_fields/custom_field_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper'
require 'features/work_packages/work_packages_page'
require 'features/work_packages/details/inplace_editor/shared_examples'
-RSpec.describe 'custom field inplace editor', js: true do
+RSpec.describe 'custom field inplace editor', :js do
let(:user) { create(:admin) }
let(:type) { create(:type_standard, custom_fields:) }
let(:project) do
diff --git a/spec/features/work_packages/details/date_editor_spec.rb b/spec/features/work_packages/details/date_editor_spec.rb
index ac8791a7bee..b91f1fe192f 100644
--- a/spec/features/work_packages/details/date_editor_spec.rb
+++ b/spec/features/work_packages/details/date_editor_spec.rb
@@ -33,8 +33,7 @@ require 'features/work_packages/shared_contexts'
require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'date inplace editor',
- js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'date inplace editor', :js, :selenium, with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:project) { create(:project_with_types, public: true) }
shared_let(:user) { create(:admin) }
shared_let(:type) { project.types.first }
@@ -271,7 +270,7 @@ RSpec.describe 'date inplace editor',
work_packages_page.accept_alert_dialog! if work_packages_page.has_alert_dialog?
# Ensure no modal survives
- expect(page).not_to have_selector('.spot-modal')
+ expect(page).to have_no_css('.spot-modal')
end
context 'with a date custom field' do
@@ -353,17 +352,17 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { true }
it 'shows a banner that the relations are ignored' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.',
- wait: 5)
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.',
+ wait: 5)
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect new banner info
expect(page)
- .to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ .to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Changing these dates will affect dates of related work packages.')
new_window = window_opened_by { click_on 'Show relations' }
switch_to_window new_window
@@ -381,15 +380,15 @@ RSpec.describe 'date inplace editor',
it 'shows a banner that the start date is limited' do
expect(page)
- .to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.',
- wait: 5)
+ .to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Changing these dates will affect dates of related work packages.',
+ wait: 5)
# When toggling manually scheduled
start_date.toggle_scheduling_mode
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
end
end
end
@@ -411,15 +410,15 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { true }
it 'shows a banner that the relations are ignored' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect banner to switch
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Automatically scheduled. Dates are derived from relations.')
new_window = window_opened_by { click_on 'Show relations' }
switch_to_window new_window
@@ -434,14 +433,14 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { false }
it 'shows a banner that the dates are not editable' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Automatically scheduled. Dates are derived from relations.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
new_window = window_opened_by { click_on 'Show relations' }
switch_to_window new_window
@@ -461,8 +460,8 @@ RSpec.describe 'date inplace editor',
end
it 'allows switching to manual scheduling to set the ignore NWD (Regression #43933)' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Automatically scheduled. Dates are derived from relations.')
# Expect "Working days only" to be checked
datepicker.expect_ignore_non_working_days_disabled
@@ -474,16 +473,16 @@ RSpec.describe 'date inplace editor',
datepicker.toggle_ignore_non_working_days
datepicker.expect_ignore_non_working_days true
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
# Reset when disabled
start_date.toggle_scheduling_mode
datepicker.expect_ignore_non_working_days_disabled
datepicker.expect_ignore_non_working_days false, disabled: true
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Automatically scheduled. Dates are derived from relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Automatically scheduled. Dates are derived from relations.')
end
end
end
@@ -509,15 +508,15 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { true }
it 'shows a banner that the relations are ignored' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
# Expect new banner info
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Available start and finish dates are limited by relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Available start and finish dates are limited by relations.')
new_window = window_opened_by { click_on 'Show relations' }
switch_to_window new_window
@@ -532,14 +531,14 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { false }
it 'shows a banner that the start date is limited' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-info')} span",
- text: 'Available start and finish dates are limited by relations.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-info')} span",
+ text: 'Available start and finish dates are limited by relations.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
end
end
end
@@ -564,15 +563,15 @@ RSpec.describe 'date inplace editor',
let(:schedule_manually) { true }
it 'shows a banner that the relations are ignored' do
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
expect(page)
- .to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ .to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Changing these dates will affect dates of related work packages.')
new_window = window_opened_by { click_on 'Show relations' }
switch_to_window new_window
@@ -588,14 +587,14 @@ RSpec.describe 'date inplace editor',
it 'shows a banner that the start date is limited' do
expect(page)
- .to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Changing these dates will affect dates of related work packages.')
+ .to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Changing these dates will affect dates of related work packages.')
# When toggling manually scheduled
start_date.toggle_scheduling_mode
- expect(page).to have_selector("#{test_selector('op-modal-banner-warning')} span",
- text: 'Manual scheduling enabled, all relations ignored.')
+ expect(page).to have_css("#{test_selector('op-modal-banner-warning')} span",
+ text: 'Manual scheduling enabled, all relations ignored.')
end
end
end
diff --git a/spec/features/work_packages/details/details_toolbar_spec.rb b/spec/features/work_packages/details/details_toolbar_spec.rb
index 0d5d5a303e6..48b9ed001fa 100644
--- a/spec/features/work_packages/details/details_toolbar_spec.rb
+++ b/spec/features/work_packages/details/details_toolbar_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Work package details toolbar', js: true, selenium: true do
+RSpec.describe 'Work package details toolbar', :js, :selenium do
let(:project) { create(:project_with_types, public: true) }
let!(:work_package) { create(:work_package, project:) }
let(:work_packages_page) { WorkPackagesPage.new(project) }
@@ -44,15 +44,15 @@ RSpec.describe 'Work package details toolbar', js: true, selenium: true do
it 'toggles the watch state' do
expect(work_package.watcher_users).not_to include(user)
- expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Watch')
+ expect(page).to have_css('.work-packages--details-toolbar button', text: 'Watch')
within '.work-packages--details-toolbar' do
click_button 'Watch'
end
- expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Unwatch')
+ expect(page).to have_css('.work-packages--details-toolbar button', text: 'Unwatch')
expect(work_package.reload.watcher_users).to include(user)
- expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Unwatch')
+ expect(page).to have_css('.work-packages--details-toolbar button', text: 'Unwatch')
end
end
end
diff --git a/spec/features/work_packages/details/inplace_editor/shared_examples.rb b/spec/features/work_packages/details/inplace_editor/shared_examples.rb
index a95d07c66f3..1b7c1a9e7ad 100644
--- a/spec/features/work_packages/details/inplace_editor/shared_examples.rb
+++ b/spec/features/work_packages/details/inplace_editor/shared_examples.rb
@@ -101,7 +101,7 @@ RSpec.shared_examples 'a workpackage autocomplete field' do
field.activate!
field.clear
field.type(" ##{wp2.id}")
- expect(page).to have_selector('.mention-list-item', text: wp2.to_s.strip)
+ expect(page).to have_css('.mention-list-item', text: wp2.to_s.strip)
end
end
@@ -132,9 +132,9 @@ RSpec.shared_examples 'a principal autocomplete field' do
field.activate!
field.clear with_backspace: true
field.input_element.send_keys(" @lau")
- expect(page).to have_selector('.mention-list-item', text: mentioned_user.name)
- expect(page).to have_selector('.mention-list-item', text: mentioned_group.name)
- expect(page).not_to have_selector('.mention-list-item', text: user.name)
+ expect(page).to have_css('.mention-list-item', text: mentioned_user.name)
+ expect(page).to have_css('.mention-list-item', text: mentioned_group.name)
+ expect(page).to have_no_css('.mention-list-item', text: user.name)
# Close the autocompleter
field.input_element.send_keys :escape
@@ -143,9 +143,9 @@ RSpec.shared_examples 'a principal autocomplete field' do
sleep 2
field.ckeditor.type_slowly '@Laura'
- expect(page).to have_selector('.mention-list-item', text: mentioned_user.name)
- expect(page).not_to have_selector('.mention-list-item', text: mentioned_group.name)
- expect(page).not_to have_selector('.mention-list-item', text: user.name)
+ expect(page).to have_css('.mention-list-item', text: mentioned_user.name)
+ expect(page).to have_no_css('.mention-list-item', text: mentioned_group.name)
+ expect(page).to have_no_css('.mention-list-item', text: user.name)
end
end
@@ -190,7 +190,7 @@ RSpec.shared_examples 'not a principal autocomplete field' do
field.clear with_backspace: true
field.input_element.send_keys(" @lau")
sleep 2
- expect(page).not_to have_selector('.mention-list-item')
+ expect(page).to have_no_css('.mention-list-item')
end
end
diff --git a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
index d482fb0cb3f..120d461958f 100644
--- a/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
+++ b/spec/features/work_packages/details/inplace_editor/version_editor_spec.rb
@@ -4,7 +4,7 @@ require 'features/work_packages/shared_contexts'
require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'subject inplace editor', js: true, selenium: true do
+RSpec.describe 'subject inplace editor', :js, :selenium do
let(:project) { create(:project_with_types, name: 'Root', public: true) }
let(:subproject1) { create(:project_with_types, name: 'Child', parent: project) }
let(:subproject2) { create(:project_with_types, name: 'Aunt', parent: project) }
@@ -62,10 +62,10 @@ RSpec.describe 'subject inplace editor', js: true, selenium: true do
field = work_package_page.work_package_field(:version)
field.activate!
- expect(page).to have_selector('.ng-option-label', text: '-')
- expect(page).to have_selector('.ng-option-label', text: version3.name)
- expect(page).to have_selector('.ng-option-label', text: version2.name)
- expect(page).to have_selector('.ng-option-label', text: version.name)
+ expect(page).to have_css('.ng-option-label', text: '-')
+ expect(page).to have_css('.ng-option-label', text: version3.name)
+ expect(page).to have_css('.ng-option-label', text: version2.name)
+ expect(page).to have_css('.ng-option-label', text: version.name)
# Expect the order to be descending by version date
labels = page.all('.ng-option-label').map { |el| el.text.strip }
@@ -103,7 +103,7 @@ RSpec.describe 'subject inplace editor', js: true, selenium: true do
field.activate!
field.input_element.find('input').set 'Version that does not exist'
- expect(page).not_to have_selector('.ng-option', text: 'Create: Version that does not exist')
+ expect(page).to have_no_css('.ng-option', text: 'Create: Version that does not exist')
end
end
end
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 d87fc7ea6a5..64a72b3c82a 100644
--- a/spec/features/work_packages/details/markdown/activity_comments_spec.rb
+++ b/spec/features/work_packages/details/markdown/activity_comments_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
require 'features/work_packages/shared_contexts'
require 'features/work_packages/details/inplace_editor/shared_examples'
-RSpec.describe 'activity comments', js: true do
+RSpec.describe 'activity comments', :js do
let(:project) { create(:project, public: true) }
let!(:work_package) do
create(:work_package,
@@ -42,7 +42,7 @@ RSpec.describe 'activity comments', js: true do
comment_field.click_and_type_slowly 'this is a comment'
comment_field.submit_by_enter
- expect(page).not_to have_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css('.user-comment .message', text: 'this is a comment')
end
it 'submits with click' do
@@ -56,7 +56,7 @@ RSpec.describe 'activity comments', js: true do
comment_field.click_and_type_slowly 'this is my first comment!1'
comment_field.submit_by_click
- expect(page).to have_selector('.user-comment > .message', count: 2)
+ expect(page).to have_css('.user-comment > .message', count: 2)
wp_page.expect_comment text: 'this is my first comment!1'
expect(comment_field.editing?).to be false
@@ -66,7 +66,7 @@ RSpec.describe 'activity comments', js: true do
comment_field.click_and_type_slowly 'this is my second comment!1'
comment_field.submit_by_click
- expect(page).to have_selector('.user-comment > .message', count: 3)
+ expect(page).to have_css('.user-comment > .message', count: 3)
wp_page.expect_comment text: 'this is my second comment!1'
expect(comment_field.editing?).to be false
@@ -77,12 +77,12 @@ RSpec.describe 'activity comments', js: true do
comment_field.submit_by_click
# Only shows three most recent
- expect(page).to have_selector('.user-comment > .message', count: 3)
+ expect(page).to have_css('.user-comment > .message', count: 3)
wp_page.expect_comment text: 'this is my third comment!1'
wp_page.switch_to_tab tab: 'Activity'
# Now showing all comments
- expect(page).to have_selector('.user-comment > .message', count: 4, wait: 10)
+ expect(page).to have_css('.user-comment > .message', count: 4, wait: 10)
expect(comment_field.editing?).to be false
comment_field.activate!
@@ -91,11 +91,11 @@ RSpec.describe 'activity comments', js: true do
comment_field.click_and_type_slowly 'this is my fifth comment!1'
comment_field.submit_by_click
- expect(page).to have_selector('.user-comment > .message', count: 4)
+ expect(page).to have_css('.user-comment > .message', count: 4)
wp_page.expect_comment text: 'this is my fifth comment!1'
# Expect no activity details
- expect(page).not_to have_selector('.work-package-details-activities-messages li')
+ expect(page).to have_no_css('.work-package-details-activities-messages li')
end
end
@@ -108,13 +108,13 @@ RSpec.describe 'activity comments', js: true do
comment_field.cancel_by_escape
expect(comment_field.editing?).to be true
- expect(page).not_to have_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css('.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).not_to have_selector('.user-comment .message', text: 'this is a comment')
+ expect(page).to have_no_css('.user-comment .message', text: 'this is a comment')
end
end
@@ -124,7 +124,7 @@ RSpec.describe 'activity comments', js: true do
it 'can move to the work package by click (Regression #30928)' do
comment_field.input_element.send_keys("##{wp2.id}")
- expect(page).to have_selector('.mention-list-item', text: wp2.to_s.strip)
+ expect(page).to have_css('.mention-list-item', text: wp2.to_s.strip)
comment_field.submit_by_click
page.find('#activity-2 a.issue', text: wp2.id).click
@@ -181,8 +181,8 @@ RSpec.describe 'activity comments', js: true do
describe 'quoting' do
it 'can quote a previous comment' do
- expect(page).to have_selector('.user-comment .message',
- text: initial_comment)
+ expect(page).to have_css('.user-comment .message',
+ text: initial_comment)
# Hover comment
quoted = page.find('.user-comment > .message')
@@ -194,7 +194,7 @@ RSpec.describe 'activity comments', js: true do
expect(comment_field.editing?).to be true
# Add our comment
- expect(comment_field.input_element).to have_selector('blockquote')
+ expect(comment_field.input_element).to have_css('blockquote')
quote = comment_field.input_element[:innerHTML]
expect(quote).to eq '<p class="op-uc-p">Anonymous wrote:</p><blockquote class="op-uc-blockquote"><p class="op-uc-p">the first comment in this WP</p></blockquote>'
@@ -227,7 +227,7 @@ RSpec.describe 'activity comments', js: true do
# Insert a new reference using the autocompleter
comment_field.input_element.send_keys "Single ##{work_package2.id}"
expect(page)
- .to have_selector('.mention-list-item', text: "#{work_package2.type.name} ##{work_package2.id}:")
+ .to have_css('.mention-list-item', text: "#{work_package2.type.name} ##{work_package2.id}:")
find('.mention-list-item', text: "#{work_package2.type.name} ##{work_package2.id}:").click
@@ -246,8 +246,8 @@ RSpec.describe 'activity comments', js: true do
comment_field.submit_by_click
wp_page.expect_comment text: "Single ##{work_package2.id}"
- expect(page).to have_selector('.user-comment opce-macro-wp-quickinfo', count: 2)
- expect(page).to have_selector('.user-comment .work-package--quickinfo.preview-trigger', count: 2)
+ expect(page).to have_css('.user-comment opce-macro-wp-quickinfo', count: 2)
+ expect(page).to have_css('.user-comment .work-package--quickinfo.preview-trigger', count: 2)
end
end
@@ -293,7 +293,7 @@ RSpec.describe 'activity comments', js: true do
end
it 'does not show the field' do
- expect(page).not_to have_selector(selector, visible: true)
+ expect(page).to have_no_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 63d7740ffc9..b05ba27261a 100644
--- a/spec/features/work_packages/details/markdown/description_editor_spec.rb
+++ b/spec/features/work_packages/details/markdown/description_editor_spec.rb
@@ -32,7 +32,7 @@ require 'features/work_packages/shared_contexts'
require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'description inplace editor', js: true, selenium: true do
+RSpec.describe 'description inplace editor', :js, :selenium do
let(:project) { create(:project_with_types, public: true) }
let(:property_name) { :description }
let(:property_title) { 'Description' }
@@ -118,7 +118,7 @@ RSpec.describe 'description inplace editor', js: true, selenium: true do
let(:user) { create(:user, member_with_roles: { project => role }) }
it 'does not show the field' do
- expect(page).not_to have_selector('.inline-edit--display-field.description.-editable')
+ expect(page).to have_no_css('.inline-edit--display-field.description.-editable')
field.display_element.click
field.expect_inactive!
diff --git a/spec/features/work_packages/details/markdown/todolist_spec.rb b/spec/features/work_packages/details/markdown/todolist_spec.rb
index 68165b9d430..47831b8436c 100644
--- a/spec/features/work_packages/details/markdown/todolist_spec.rb
+++ b/spec/features/work_packages/details/markdown/todolist_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Todolists in CKEditor', js: true do
+RSpec.describe 'Todolists in CKEditor', :js do
let(:user) { create(:admin) }
before do
@@ -83,26 +83,26 @@ RSpec.describe 'Todolists in CKEditor', js: true do
wp_page.expect_and_dismiss_toaster message: 'Successful update.'
within(field.display_element) do
- expect(page).to have_selector('.op-uc-list--task-checkbox', count: 5)
- expect(page).to have_selector('.op-uc-list--task-checkbox[checked]', count: 2)
+ expect(page).to have_css('.op-uc-list--task-checkbox', count: 5)
+ expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 2)
- expect(page).to have_selector('.op-uc-list--item', text: 'Todo item 1')
- expect(page).to have_selector('.op-uc-list--item', text: 'Todo item 2')
- expect(page).to have_selector('.op-uc-list--item', text: 'Todo item 3')
+ expect(page).to have_css('.op-uc-list--item', text: 'Todo item 1')
+ expect(page).to have_css('.op-uc-list--item', text: 'Todo item 2')
+ expect(page).to have_css('.op-uc-list--item', text: 'Todo item 3')
- expect(page).to have_selector('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
- expect(page).to have_selector('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 2')
+ expect(page).to have_css('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
+ expect(page).to have_css('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 2')
first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
- expect(first_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
first_nested_item = page.find('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
- expect(first_nested_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_nested_item).to have_css('.op-uc-list--task-checkbox[checked]')
end
# Expect still the same when editing again
field.activate!
ckeditor.in_editor do |_container, editable|
- expect(editable).to have_selector('.op-uc-list li', count: 5)
+ expect(editable).to have_css('.op-uc-list li', count: 5)
first_item = editable.all('.op-uc-list li')[0].find('input[type=checkbox]', visible: :all)
expect(first_item).to be_checked
@@ -122,16 +122,16 @@ RSpec.describe 'Todolists in CKEditor', js: true do
wp_page.expect_and_dismiss_toaster message: 'Successful update.'
within(field.display_element) do
- expect(page).to have_selector('.op-uc-list--task-checkbox', count: 5)
- expect(page).to have_selector('.op-uc-list--task-checkbox[checked]', count: 3)
+ expect(page).to have_css('.op-uc-list--task-checkbox', count: 5)
+ expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 3)
first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
- expect(first_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
first_nested_item = page.find('.op-uc-list .op-uc-list .op-uc-list--item', text: 'Nested item 1')
- expect(first_nested_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_nested_item).to have_css('.op-uc-list--task-checkbox[checked]')
last_item = page.find('.op-uc-list .op-uc-list--item', text: 'Todo item 3')
- expect(last_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(last_item).to have_css('.op-uc-list--task-checkbox[checked]')
end
end
end
@@ -181,10 +181,10 @@ RSpec.describe 'Todolists in CKEditor', js: true do
wp_page.save!
wp_page.expect_and_dismiss_toaster message: 'Successful creation.'
- expect(page).to have_selector('.op-uc-list--task-checkbox', count: 3)
- expect(page).to have_selector('.op-uc-list--task-checkbox[checked]', count: 1)
+ expect(page).to have_css('.op-uc-list--task-checkbox', count: 3)
+ expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 1)
- expect(page).to have_selector('.op-uc-list--item a[href="https://community.openproject.com/"]')
+ expect(page).to have_css('.op-uc-list--item a[href="https://community.openproject.com/"]')
nested_link = page.find('.op-uc-list--item .op-uc-list--item a[href="https://community.openproject.com/nested"]')
expect(nested_link.text).to eq 'This is a link'
@@ -216,20 +216,20 @@ RSpec.describe 'Todolists in CKEditor', js: true do
wp_page.expect_and_dismiss_toaster message: 'Successful creation.'
within(field.display_element) do
- expect(page).to have_selector('.op-uc-list--task-checkbox', count: 2)
- expect(page).to have_selector('.op-uc-list--task-checkbox[checked]', count: 1)
+ expect(page).to have_css('.op-uc-list--task-checkbox', count: 2)
+ expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 1)
- expect(page).to have_selector('.op-uc-list--item', text: 'Todo item 1')
- expect(page).to have_selector('.op-uc-list--item', text: 'Todo item 2')
+ expect(page).to have_css('.op-uc-list--item', text: 'Todo item 1')
+ expect(page).to have_css('.op-uc-list--item', text: 'Todo item 2')
first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
- expect(first_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
end
# Expect still the same when editing again
field.activate!
ckeditor.in_editor do |_container, editable|
- expect(editable).to have_selector('.op-uc-list li', count: 2)
+ expect(editable).to have_css('.op-uc-list li', count: 2)
first_item = editable.all('.op-uc-list li')[0].find('input[type=checkbox]', visible: :all)
expect(first_item).to be_checked
@@ -245,14 +245,14 @@ RSpec.describe 'Todolists in CKEditor', js: true do
wp_page.expect_and_dismiss_toaster message: 'Successful update.'
within(field.display_element) do
- expect(page).to have_selector('.op-uc-list--task-checkbox', count: 2)
- expect(page).to have_selector('.op-uc-list--task-checkbox[checked]', count: 2)
+ expect(page).to have_css('.op-uc-list--task-checkbox', count: 2)
+ expect(page).to have_css('.op-uc-list--task-checkbox[checked]', count: 2)
first_item = page.find('.op-uc-list--item', text: 'Todo item 1')
- expect(first_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(first_item).to have_css('.op-uc-list--task-checkbox[checked]')
last_item = page.find('.op-uc-list .op-uc-list--item', text: 'Todo item 2')
- expect(last_item).to have_selector('.op-uc-list--task-checkbox[checked]')
+ expect(last_item).to have_css('.op-uc-list--task-checkbox[checked]')
end
end
end
diff --git a/spec/features/work_packages/details/milestones_spec.rb b/spec/features/work_packages/details/milestones_spec.rb
index e7e3506b043..4439aa6cd57 100644
--- a/spec/features/work_packages/details/milestones_spec.rb
+++ b/spec/features/work_packages/details/milestones_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Milestones full screen v iew', js: true do
+RSpec.describe 'Milestones full screen v iew', :js do
let(:type) { create(:type, is_milestone: true) }
let(:project) { create(:project, types: [type]) }
let!(:work_package) do
@@ -31,7 +31,7 @@ RSpec.describe 'Milestones full screen v iew', js: true do
expect(button).not_to be_disabled
button.click
- expect(page).to have_selector('.menu-item', text: type.name.upcase)
+ expect(page).to have_css('.menu-item', text: type.name.upcase)
end
end
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 63b8606ad7d..92d4ec3046e 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package with relation query group', js: true, selenium: true do
+RSpec.describe 'Work package with relation query group', :js, :selenium do
include_context 'ng-select-autocomplete helpers'
let(:user) { create(:admin) }
@@ -150,7 +150,7 @@ RSpec.describe 'Work package with relation query group', js: true, selenium: tru
full_wp.visit!
full_wp.ensure_page_loaded
- expect(page).to have_selector('.attributes-group--header-text', text: query_text, wait: 20)
+ expect(page).to have_css('.attributes-group--header-text', text: query_text, wait: 20)
embedded_table.expect_work_package_listed related_work_package
embedded_table.click_inline_create
@@ -176,8 +176,8 @@ RSpec.describe 'Work package with relation query group', js: true, selenium: tru
full_wp.ensure_page_loaded
# Will first try to load the query, and then hide it.
- 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')
+ expect(page).to have_no_css('.attributes-group--header-text', text: query_text, wait: 20)
+ expect(page).to have_no_css('.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 610771b07d2..cae9d3d05c8 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'creating a child directly after the wp itself was created', js: true do
+RSpec.describe 'creating a child directly after the wp itself was created', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, types: [type]) }
let(:wp_page) { Pages::FullWorkPackageCreate.new }
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 ae67ed7a3bd..325771c868b 100644
--- a/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_milestone_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'work package hierarchies for milestones', js: true, selenium: true do
+RSpec.describe 'work package hierarchies for milestones', :js, :selenium do
let(:user) { create(:admin) }
let(:type) { create(:type, is_milestone: true) }
let(:project) { create(:project, types: [type]) }
@@ -50,9 +50,9 @@ RSpec.describe 'work package hierarchies for milestones', js: true, selenium: tr
it 'does not provide links to add children or existing children (Regression #28745)' do
within('.wp-relations--children') do
- 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')
+ expect(page).to have_no_text('Add existing child')
+ expect(page).to have_no_text('Create new child')
+ expect(page).to have_no_css('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 c786a839022..b4f0ccf8040 100644
--- a/spec/features/work_packages/details/relations/hierarchy_spec.rb
+++ b/spec/features/work_packages/details/relations/hierarchy_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.shared_examples 'work package relations tab', js: true, selenium: true do
+RSpec.shared_examples 'work package relations tab', :js, :selenium do
include_context 'ng-select-autocomplete helpers'
let(:user) { create(:admin) }
@@ -206,17 +206,17 @@ RSpec.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).not_to have_selector('.wp-relations-create-button')
+ expect(page).to have_no_css('.wp-relations-create-button')
# Test for add relation
- expect(page).not_to have_selector('#relation--add-relation')
+ expect(page).to have_no_css('#relation--add-relation')
# Test for add parent
- expect(page).not_to have_selector('.wp-relation--parent-change')
+ expect(page).to have_no_css('.wp-relation--parent-change')
# Test for add children
- expect(page).not_to have_selector('#hierarchy--add-existing-child')
- expect(page).not_to have_selector('#hierarchy--add-new-child')
+ expect(page).to have_no_css('#hierarchy--add-existing-child')
+ expect(page).to have_no_css('#hierarchy--add-new-child')
# But it should show the linked parent
expect(page).to have_test_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 4f42bcfceea..74e8ec10817 100644
--- a/spec/features/work_packages/details/relations/relations_spec.rb
+++ b/spec/features/work_packages/details/relations/relations_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package relations tab', js: true, selenium: true do
+RSpec.describe 'Work package relations tab', :js, :selenium do
include_context 'ng-select-autocomplete helpers'
let(:user) { create(:admin) }
@@ -98,20 +98,20 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
expect(page).to have_selector(toggle_btn_selector,
text: 'Group by work package type', wait: 20)
- expect(page).to have_selector('.relation-group--header', text: 'FOLLOWS')
- expect(page).to have_selector('.relation-group--header', text: 'RELATED TO')
+ expect(page).to have_css('.relation-group--header', text: 'FOLLOWS')
+ expect(page).to have_css('.relation-group--header', text: 'RELATED TO')
- expect(page).to have_selector('.relation-row--type', text: type1.name.upcase)
- expect(page).to have_selector('.relation-row--type', text: type2.name.upcase)
+ expect(page).to have_css('.relation-row--type', text: type1.name.upcase)
+ expect(page).to have_css('.relation-row--type', text: type2.name.upcase)
find(toggle_btn_selector).click
expect(page).to have_selector(toggle_btn_selector, text: 'Group by relation type', wait: 10)
- expect(page).to have_selector('.relation-group--header', text: type1.name.upcase)
- expect(page).to have_selector('.relation-group--header', text: type2.name.upcase)
+ expect(page).to have_css('.relation-group--header', text: type1.name.upcase)
+ expect(page).to have_css('.relation-group--header', text: type2.name.upcase)
- expect(page).to have_selector('.relation-row--type', text: 'Follows')
- expect(page).to have_selector('.relation-row--type', text: 'Related To')
+ expect(page).to have_css('.relation-row--type', text: 'Follows')
+ expect(page).to have_css('.relation-row--type', text: 'Related To')
end
it 'allows to edit relation types when toggled' do
@@ -119,15 +119,15 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
expect(page).to have_selector(toggle_btn_selector, text: 'Group by relation type', wait: 20)
# Expect current to be follows and other one related
- expect(page).to have_selector('.relation-row--type', text: 'Follows')
- expect(page).to have_selector('.relation-row--type', text: 'Related To')
+ expect(page).to have_css('.relation-row--type', text: 'Follows')
+ expect(page).to have_css('.relation-row--type', text: 'Related To')
# edit to blocks
relations.edit_relation_type(to1, to_type: 'Blocks')
# the other one should not be altered
- expect(page).to have_selector('.relation-row--type', text: 'Blocks')
- expect(page).to have_selector('.relation-row--type', text: 'Related To')
+ expect(page).to have_css('.relation-row--type', text: 'Blocks')
+ expect(page).to have_css('.relation-row--type', text: 'Related To')
updated_relation = Relation.find(relation1.id)
expect(updated_relation.relation_type).to eq('blocks')
@@ -136,8 +136,8 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
relations.edit_relation_type(to1, to_type: 'Blocked by')
- expect(page).to have_selector('.relation-row--type', text: 'Blocked by')
- expect(page).to have_selector('.relation-row--type', text: 'Related To')
+ expect(page).to have_css('.relation-row--type', text: 'Blocked by')
+ expect(page).to have_css('.relation-row--type', text: 'Related To')
updated_relation = Relation.find(relation1.id)
expect(updated_relation.relation_type).to eq('blocks')
@@ -162,10 +162,10 @@ RSpec.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).not_to have_selector('.wp-relations-create-button')
+ expect(page).to have_no_css('.wp-relations-create-button')
# Test for add relation
- expect(page).not_to have_selector('#relation--add-relation')
+ expect(page).to have_no_css('#relation--add-relation')
end
end
@@ -183,7 +183,7 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
tabs.expect_counter(relations_tab, 1)
relations.remove_relation(relatable)
- expect(page).not_to have_selector('.relation-group--header', text: 'FOLLOWS')
+ expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
# If there are no relations, the counter badge should not be displayed
tabs.expect_no_counter(relations_tab)
@@ -203,15 +203,15 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
# Expect to have row
relations.hover_action(relatable, :delete)
- expect(page).not_to have_selector('.relation-group--header', text: 'FOLLOWS')
- expect(page).not_to have_selector('.wp-relations--subject-field', text: relatable.subject)
+ expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
+ expect(page).to have_no_css('.wp-relations--subject-field', text: relatable.subject)
# Back to split view
page.execute_script('window.history.back()')
work_packages_page.expect_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)
+ expect(page).to have_no_css('.relation-group--header', text: 'FOLLOWS')
+ expect(page).to have_no_css('.wp-relations--subject-field', text: relatable.subject)
end
it 'follows the relation links (Regression #26794)' do
@@ -273,7 +273,7 @@ RSpec.describe 'Work package relations tab', js: true, selenium: true do
# Toggle to close
relations.hover_action(relatable, :info)
- expect(created_row).not_to have_selector('.wp-relation--description-read-value')
+ expect(created_row).to have_no_css('.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 1aecb463b28..c736a72345e 100644
--- a/spec/features/work_packages/details/workdays_spec.rb
+++ b/spec/features/work_packages/details/workdays_spec.rb
@@ -33,8 +33,7 @@ require 'features/work_packages/shared_contexts'
require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Work packages datepicker workdays',
- js: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Work packages datepicker workdays', :js, 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) }
@@ -56,19 +55,19 @@ RSpec.describe 'Work packages datepicker workdays',
shared_let(:working_days) { week_with_saturday_and_sunday_as_weekend }
it 'shows them as disabled' do
- expect(page).to have_selector('.dayContainer', count: 2)
+ expect(page).to have_css('.dayContainer', count: 2)
weekend_days = %w[1 2 8 9 15 16 22 23 29 30].map(&:to_i)
weekend_days.each do |weekend_day|
- expect(page).to have_selector('.dayContainer:first-of-type .flatpickr-day.flatpickr-non-working-day',
- text: weekend_day,
- exact_text: true)
+ expect(page).to have_css('.dayContainer:first-of-type .flatpickr-day.flatpickr-non-working-day',
+ text: weekend_day,
+ exact_text: true)
end
((1..31).to_a - weekend_days).each do |workday|
- expect(page).to have_selector('.dayContainer:first-of-type .flatpickr-day:not(.flatpickr-non-working-day)',
- text: workday,
- exact_text: true)
+ expect(page).to have_css('.dayContainer:first-of-type .flatpickr-day:not(.flatpickr-non-working-day)',
+ text: workday,
+ exact_text: true)
end
end
end
diff --git a/spec/features/work_packages/display_fields/date_field_display_spec.rb b/spec/features/work_packages/display_fields/date_field_display_spec.rb
index ce48015fc63..3cbcae25ee2 100644
--- a/spec/features/work_packages/display_fields/date_field_display_spec.rb
+++ b/spec/features/work_packages/display_fields/date_field_display_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Show the date of a Work Package', js: true do
+RSpec.describe 'Show the date of a Work Package', :js do
let(:project) { create(:project) }
let(:admin) { create(:admin) }
let(:work_package) do
@@ -60,14 +60,14 @@ RSpec.describe 'Show the date of a Work Package', js: true do
it 'is highlighted only if the WP status is open (#33457)' do
# Highlighted with an open status
- expect(page).to have_selector('.inline-edit--display-field.combinedDate .__hl_date_overdue')
+ expect(page).to have_css('.inline-edit--display-field.combinedDate .__hl_date_overdue')
# Change status to closed
status_field = WorkPackageStatusField.new(page)
status_field.update(closed_status.name)
# Not highlighted with a closed status
- expect(page).not_to have_selector('.inline-edit--display-field.combinedDate .__hl_date_overdue')
+ expect(page).to have_no_css('.inline-edit--display-field.combinedDate .__hl_date_overdue')
end
end
end
diff --git a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
index ca1140463dc..14fb0f2a6e4 100644
--- a/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
+++ b/spec/features/work_packages/display_fields/estimated_hours_display_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe 'Estimated hours display' do
]
end
- it 'work package index', js: true do
+ it 'work package index', :js do
wp_table.visit_query query
wp_table.expect_work_package_listed child
@@ -86,7 +86,7 @@ RSpec.describe 'Estimated hours display' do
)
end
- it 'work package details', js: true do
+ it 'work package details', :js do
visit work_package_path(parent.id)
expect(page).to have_content("Work\n1 h(+3 h)")
@@ -104,7 +104,7 @@ RSpec.describe 'Estimated hours display' do
]
end
- it 'work package index', js: true do
+ it 'work package index', :js do
wp_table.visit_query query
wp_table.expect_work_package_listed child
@@ -113,7 +113,7 @@ RSpec.describe 'Estimated hours display' do
)
end
- it 'work package details', js: true do
+ it 'work package details', :js do
visit work_package_path(parent.id)
expect(page).to have_content("Work\n1 h")
@@ -131,7 +131,7 @@ RSpec.describe 'Estimated hours display' do
]
end
- it 'work package index', js: true do
+ it 'work package index', :js do
wp_table.visit_query query
wp_table.expect_work_package_listed child
@@ -140,7 +140,7 @@ RSpec.describe 'Estimated hours display' do
)
end
- it 'work package details', js: true do
+ it 'work package details', :js do
visit work_package_path(parent.id)
expect(page).to have_content("Work\n0 h(+3 h)")
@@ -158,7 +158,7 @@ RSpec.describe 'Estimated hours display' do
]
end
- it 'work package index', js: true do
+ it 'work package index', :js do
wp_table.visit_query query
wp_table.expect_work_package_listed child
@@ -167,7 +167,7 @@ RSpec.describe 'Estimated hours display' do
)
end
- it 'work package details', js: true do
+ it 'work package details', :js do
visit work_package_path(parent.id)
expect(page).to have_content("Work\n0 h")
diff --git a/spec/features/work_packages/display_fields/spent_time_display_spec.rb b/spec/features/work_packages/display_fields/spent_time_display_spec.rb
index a59b898faf6..06aa0c026b4 100644
--- a/spec/features/work_packages/display_fields/spent_time_display_spec.rb
+++ b/spec/features/work_packages/display_fields/spent_time_display_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Logging time within the work package view', js: true do
+RSpec.describe 'Logging time within the work package view', :js do
shared_let(:project) { create(:project) }
shared_let(:admin) { create(:admin) }
shared_let(:work_package) { create(:work_package, project:) }
@@ -61,7 +61,7 @@ RSpec.describe 'Logging time within the work package view', js: true do
if log_for_user
time_logging_modal.update_field 'user', log_for_user.name
elsif user_field_visible
- expect(page).to have_selector('.ng-value-label', text: user.name)
+ expect(page).to have_css('.ng-value-label', text: user.name)
end
# a click on save creates a time entry
@@ -213,8 +213,8 @@ RSpec.describe 'Logging time within the work package view', js: true do
log_time_via_modal
- expect(page).to have_selector('tr:nth-of-type(1) .wp-table--cell-td.spentTime', text: '1 h')
- expect(page).to have_selector('tr:nth-of-type(2) .wp-table--cell-td.spentTime', text: '0 h')
+ expect(page).to have_css('tr:nth-of-type(1) .wp-table--cell-td.spentTime', text: '1 h')
+ expect(page).to have_css('tr:nth-of-type(2) .wp-table--cell-td.spentTime', text: '0 h')
end
end
end
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 f62e9697aa2..cfcd249be7e 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
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Switching work package view',
- js: true, with_ee: %i[conditional_highlighting] do
+RSpec.describe 'Switching work package view', :js, with_ee: %i[conditional_highlighting] do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -75,30 +74,30 @@ RSpec.describe 'Switching work package view',
# Enable highlighting
highlighting.switch_entire_row_highlight "Priority"
within "wp-single-card[data-work-package-id='#{wp_1.id}']" do
- expect(page).to have_selector(".op-wp-single-card--highlighting.__hl_background_priority_#{priority1.id}")
+ expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_priority_#{priority1.id}")
end
within "wp-single-card[data-work-package-id='#{wp_2.id}']" do
- expect(page).to have_selector(".op-wp-single-card--highlighting.__hl_background_priority_#{priority2.id}")
+ expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_priority_#{priority2.id}")
end
# Switch back to list representation & Highlighting is kept
display_representation.switch_to_list_layout
wp_table.expect_work_package_listed wp_1, wp_2
- 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_#{priority2.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_priority_#{priority2.id}")
# Change attribute
highlighting.switch_entire_row_highlight "Status"
- expect(page).to have_selector("#{wp_table.row_selector(wp_1)}.__hl_background_status_#{status.id}")
- expect(page).to have_selector("#{wp_table.row_selector(wp_2)}.__hl_background_status_#{status.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_status_#{status.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_status_#{status.id}")
# Switch back to card representation & Highlighting is kept, too
display_representation.switch_to_card_layout
within "wp-single-card[data-work-package-id='#{wp_1.id}']" do
- expect(page).to have_selector(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
+ expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
end
within "wp-single-card[data-work-package-id='#{wp_2.id}']" do
- expect(page).to have_selector(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
+ expect(page).to have_css(".op-wp-single-card--highlighting.__hl_background_status_#{status.id}")
end
end
@@ -118,12 +117,12 @@ RSpec.describe 'Switching work package view',
# A single click leads to the full view
cards.select_work_package(wp_1)
- expect(page).to have_selector('.work-packages--details--subject',
- text: wp_1.subject)
+ expect(page).to have_css('.work-packages--details--subject',
+ text: wp_1.subject)
page.find('.work-packages-back-button').click
# The query is however unchanged
- expect(page).not_to have_selector('.editable-toolbar-title--save')
+ expect(page).to have_no_css('.editable-toolbar-title--save')
url = URI.parse(page.current_url).query
expect(url).not_to match(/query_props=.+/)
diff --git a/spec/features/work_packages/edit_work_package_spec.rb b/spec/features/work_packages/edit_work_package_spec.rb
index bad5b01e7df..c8201d945a8 100644
--- a/spec/features/work_packages/edit_work_package_spec.rb
+++ b/spec/features/work_packages/edit_work_package_spec.rb
@@ -1,8 +1,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'edit work package',
- js: true do
+RSpec.describe 'edit work package', :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -168,10 +167,10 @@ RSpec.describe 'edit work package',
wp_page.visit!
# Another (empty) journal should exist now
- expect(page).to have_selector('.op-user-activity--user-name',
- text: work_package.journals.last.user.name,
- wait: 10,
- count: 2)
+ expect(page).to have_css('.op-user-activity--user-name',
+ text: work_package.journals.last.user.name,
+ wait: 10,
+ count: 2)
wp_page.expect_attributes assignee: '-'
diff --git a/spec/features/work_packages/export_spec.rb b/spec/features/work_packages/export_spec.rb
index d5c184a0359..4bf509cebc7 100644
--- a/spec/features/work_packages/export_spec.rb
+++ b/spec/features/work_packages/export_spec.rb
@@ -98,7 +98,7 @@ RSpec.describe 'work package export' do
filters.open
end
- it 'shows all work packages with the default filters', js: true do
+ it 'shows all work packages with the default filters', :js do
export!
expect(subject).to have_text(wp1.description)
@@ -110,7 +110,7 @@ RSpec.describe 'work package export' do
expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A B A)
end
- it 'shows all work packages grouped by', js: true do
+ it 'shows all work packages grouped by', :js do
group_by.enable_via_menu 'Type'
wp_table.expect_work_package_listed(wp1)
@@ -129,8 +129,7 @@ RSpec.describe 'work package export' do
expect(subject.scan(/Type (A|B)/).flatten).to eq %w(A A A B)
end
- it 'shows only the work package with the right progress if filtered this way',
- js: true do
+ it 'shows only the work package with the right progress if filtered this way', :js do
filters.add_filter_by '% Complete', 'is', ['25'], 'percentageDone'
sleep 1
@@ -142,11 +141,11 @@ RSpec.describe 'work package export' do
export!
expect(subject).to have_text(wp1.description)
- expect(subject).not_to have_text(wp2.description)
- expect(subject).not_to have_text(wp3.description)
+ expect(subject).to have_no_text(wp2.description)
+ expect(subject).to have_no_text(wp3.description)
end
- it 'shows only work packages of the filtered type', js: true do
+ it 'shows only work packages of the filtered type', :js do
filters.add_filter_by 'Type', 'is (OR)', wp3.type.name
expect(page).to have_no_content(wp2.description) # safeguard
@@ -155,12 +154,12 @@ RSpec.describe 'work package export' do
export!
- expect(subject).not_to have_text(wp1.description)
- expect(subject).not_to have_text(wp2.description)
+ expect(subject).to have_no_text(wp1.description)
+ expect(subject).to have_no_text(wp2.description)
expect(subject).to have_text(wp3.description)
end
- it 'exports selected columns', js: true do
+ it 'exports selected columns', :js do
columns.add '% Complete'
export!
@@ -170,7 +169,7 @@ RSpec.describe 'work package export' do
end
end
- describe 'with a manually sorted query', js: true do
+ describe 'with a manually sorted query', :js do
let(:query) do
create(:query,
user: current_user,
@@ -195,7 +194,7 @@ RSpec.describe 'work package export' do
export!
- expect(page).to have_selector('.job-status--modal .icon-checkmark', wait: 10)
+ expect(page).to have_css('.job-status--modal .icon-checkmark', wait: 10)
expect(page).to have_content('The export has completed successfully.')
expect(subject).to have_text(wp1.description)
@@ -209,7 +208,7 @@ RSpec.describe 'work package export' do
end
end
- context 'PDF export', js: true do
+ context 'PDF export', :js do
let(:export_type) { I18n.t('export.format.pdf_overview_table') }
let(:query) do
create(:query,
@@ -242,7 +241,7 @@ RSpec.describe 'work package export' do
# Atom exports are not downloaded. In fact, it is not even a download but rather
# a feed one can follow.
- context 'Atom export', js: true do
+ context 'Atom export', :js do
let(:export_type) { 'Atom' }
context 'with default filter' do
diff --git a/spec/features/work_packages/highlighting_spec.rb b/spec/features/work_packages/highlighting_spec.rb
index 8940fe833b4..52702c1a539 100644
--- a/spec/features/work_packages/highlighting_spec.rb
+++ b/spec/features/work_packages/highlighting_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package highlighting fields',
- js: true,
+RSpec.describe 'Work Package highlighting fields', :js,
with_ee: %i[conditional_highlighting] do
let(:user) { create(:admin) }
@@ -84,8 +83,8 @@ RSpec.describe 'Work Package highlighting fields',
"background-color")).to eq('rgba(0, 0, 0, 0)')
## Overdue
- expect(wp1_row).to have_selector('.__hl_date_overdue')
- expect(wp2_row).to have_selector('.__hl_date_due_today')
+ expect(wp1_row).to have_css('.__hl_date_overdue')
+ expect(wp2_row).to have_css('.__hl_date_due_today')
# Highlight only one attribute
highlighting.switch_inline_attribute_highlight "Priority"
@@ -104,7 +103,7 @@ RSpec.describe 'Work Package highlighting fields',
"background-color")).to eq('rgba(0, 0, 0, 0)')
## Status should not have a dot
- expect(wp1_row).not_to have_selector('.status [class^="__hl_inline_"]')
+ expect(wp1_row).to have_no_css('.status [class^="__hl_inline_"]')
# Highlight multiple attributes
highlighting.switch_inline_attribute_highlight "Priority", "Status"
@@ -120,8 +119,8 @@ RSpec.describe 'Work Package highlighting fields',
# Highlight entire row by status
highlighting.switch_entire_row_highlight 'Status'
- expect(page).to have_selector("#{wp_table.row_selector(wp_1)}.__hl_background_status_#{status1.id}")
- expect(page).to have_selector("#{wp_table.row_selector(wp_2)}.__hl_background_status_#{status2.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_status_#{status1.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_status_#{status2.id}")
# Unselect all rows to ensure we get the correct background
find('body').send_keys [:control, 'd']
@@ -138,14 +137,14 @@ RSpec.describe 'Work Package highlighting fields',
expect(query.highlighting_mode).to eq(:status)
## This disables any inline styles
- 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"]')
+ expect(page).to have_no_css('[class*="__hl_inline_status"]')
+ expect(page).to have_no_css('[class*="__hl_inline_priority"]')
+ expect(page).to have_no_css('[class*="__hl_date"]')
# Highlight entire row by priority
highlighting.switch_entire_row_highlight 'Priority'
- 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_css("#{wp_table.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_priority_#{priority_no_color.id}")
# Remove selection from table row
find('body').send_keys [:control, 'd']
@@ -157,11 +156,11 @@ RSpec.describe 'Work Package highlighting fields',
# Highlighting is kept even after a hard reload (Regression #30217)
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).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"]')
+ expect(page).to have_css("#{wp_table.row_selector(wp_1)}.__hl_background_priority_#{priority1.id}")
+ expect(page).to have_css("#{wp_table.row_selector(wp_2)}.__hl_background_priority_#{priority_no_color.id}")
+ expect(page).to have_no_css('[class*="__hl_inline_status"]')
+ expect(page).to have_no_css('[class*="__hl_inline_priority"]')
+ expect(page).to have_no_css('[class*="__hl_date"]')
# Save query
wp_table.save
@@ -170,16 +169,16 @@ RSpec.describe 'Work Package highlighting fields',
expect(query.highlighting_mode).to eq(:priority)
## This disables any inline styles
- 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"]')
+ expect(page).to have_no_css('[class*="__hl_inline_status"]')
+ expect(page).to have_no_css('[class*="__hl_inline_priority"]')
+ expect(page).to have_no_css('[class*="__hl_date"]')
# No highlighting
highlighting.switch_highlighting_mode 'No highlighting'
- 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"]')
+ expect(page).to have_no_css('[class*="__hl_background"]')
+ expect(page).to have_no_css('[class*="__hl_background_status"]')
+ expect(page).to have_no_css('[class*="__hl_background_priority"]')
+ expect(page).to have_no_css('[class*="__hl_date"]')
# Save query
wp_table.save
@@ -191,8 +190,8 @@ RSpec.describe 'Work Package highlighting fields',
# Expect highlighted fields in single view even when table disabled
wp_table.open_full_screen_by_doubleclick wp_1
- expect(page).to have_selector("#{test_selector('op-wp-status-button')} .__hl_background_status_#{status1.id}")
- expect(page).to have_selector(".__hl_inline_priority_#{priority1.id}")
+ expect(page).to have_css("#{test_selector('op-wp-status-button')} .__hl_background_status_#{status1.id}")
+ expect(page).to have_css(".__hl_inline_priority_#{priority1.id}")
end
it 'correctly parses custom selected inline attributes', :with_cuprite do
diff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rb
index e8f36490f22..08815a90d1d 100644
--- a/spec/features/work_packages/index_sums_spec.rb
+++ b/spec/features/work_packages/index_sums_spec.rb
@@ -129,66 +129,66 @@ RSpec.describe 'Work package index sums', :js do
wp_table.expect_work_package_listed work_package_1, work_package_2
# Expect the total sums row
- expect(page).to have_selector('.wp-table--sums-row', count: 1)
+ expect(page).to have_css('.wp-table--sums-row', count: 1)
- expect(page).to have_selector('.wp-table--sum-container', text: 'Total sum')
- expect(page).to have_selector('.wp-table--sum-container', text: '25')
- expect(page).to have_selector('.wp-table--sum-container', text: '12')
- expect(page).to have_selector('.wp-table--sum-container', text: '13.2')
+ expect(page).to have_css('.wp-table--sum-container', text: 'Total sum')
+ expect(page).to have_css('.wp-table--sum-container', text: '25')
+ expect(page).to have_css('.wp-table--sum-container', text: '12')
+ expect(page).to have_css('.wp-table--sum-container', text: '13.2')
# Unit costs
- expect(page).to have_selector('.wp-table--sum-container', text: '7.50')
+ expect(page).to have_css('.wp-table--sum-container', text: '7.50')
# Overall costs
- expect(page).to have_selector('.wp-table--sum-container', text: '22.50')
+ expect(page).to have_css('.wp-table--sum-container', text: '22.50')
# Labor costs
- expect(page).to have_selector('.wp-table--sum-container', text: '15.00')
+ expect(page).to have_css('.wp-table--sum-container', text: '15.00')
# Update the sum
edit_field = wp_table.edit_field(work_package_1, :estimatedTime)
edit_field.update '20'
- expect(page).to have_selector('.wp-table--sum-container', text: 'Total sum')
- expect(page).to have_selector('.wp-table--sum-container', text: '35')
- expect(page).to have_selector('.wp-table--sum-container', text: '12')
- expect(page).to have_selector('.wp-table--sum-container', text: '13.2')
+ expect(page).to have_css('.wp-table--sum-container', text: 'Total sum')
+ expect(page).to have_css('.wp-table--sum-container', text: '35')
+ expect(page).to have_css('.wp-table--sum-container', text: '12')
+ expect(page).to have_css('.wp-table--sum-container', text: '13.2')
# Unit costs
- expect(page).to have_selector('.wp-table--sum-container', text: '7.50')
+ expect(page).to have_css('.wp-table--sum-container', text: '7.50')
# Overall costs
- expect(page).to have_selector('.wp-table--sum-container', text: '22.50')
+ expect(page).to have_css('.wp-table--sum-container', text: '22.50')
# Labor costs
- expect(page).to have_selector('.wp-table--sum-container', text: '15.00')
+ expect(page).to have_css('.wp-table--sum-container', text: '15.00')
# Enable groups
group_by.enable_via_menu 'Status'
# Expect to have three sums rows now
- expect(page).to have_selector('.wp-table--sums-row', count: 3)
+ expect(page).to have_css('.wp-table--sums-row', count: 3)
# First status row
- expect(page).to have_selector('.wp-table--sum-container', text: '20 h')
- expect(page).to have_selector(".wp-table--sum-container.customField#{int_cf.id}", text: '5')
- expect(page).to have_selector(".wp-table--sum-container.customField#{float_cf.id}", text: '5.5')
+ expect(page).to have_css('.wp-table--sum-container', text: '20 h')
+ expect(page).to have_css(".wp-table--sum-container.customField#{int_cf.id}", text: '5')
+ expect(page).to have_css(".wp-table--sum-container.customField#{float_cf.id}", text: '5.5')
# Unit costs
- expect(page).to have_selector('.wp-table--sum-container.materialCosts', text: '7.50')
+ expect(page).to have_css('.wp-table--sum-container.materialCosts', text: '7.50')
# Overall costs
- expect(page).to have_selector('.wp-table--sum-container.overallCosts', text: '22.50')
+ expect(page).to have_css('.wp-table--sum-container.overallCosts', text: '22.50')
# Labor costs
- expect(page).to have_selector('.wp-table--sum-container.laborCosts', text: '15.00')
+ expect(page).to have_css('.wp-table--sum-container.laborCosts', text: '15.00')
# Second status row
- expect(page).to have_selector('.wp-table--sum-container', text: '15 h')
- expect(page).to have_selector(".wp-table--sum-container.customField#{int_cf.id}", text: '7')
- expect(page).to have_selector(".wp-table--sum-container.customField#{float_cf.id}", text: '7.7')
+ expect(page).to have_css('.wp-table--sum-container', text: '15 h')
+ expect(page).to have_css(".wp-table--sum-container.customField#{int_cf.id}", text: '7')
+ expect(page).to have_css(".wp-table--sum-container.customField#{float_cf.id}", text: '7.7')
# Total sums row is unchanged
- expect(page).to have_selector('tbody .wp-table--sum-container', text: '35')
- expect(page).to have_selector("tbody .wp-table--sum-container.customField#{int_cf.id}", text: '12')
- expect(page).to have_selector("tbody .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')
+ expect(page).to have_css('tbody .wp-table--sum-container', text: '35')
+ expect(page).to have_css("tbody .wp-table--sum-container.customField#{int_cf.id}", text: '12')
+ expect(page).to have_css("tbody .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')
# Unit costs
- expect(page).to have_selector('tbody .wp-table--sum-container.materialCosts', text: '7.50')
+ expect(page).to have_css('tbody .wp-table--sum-container.materialCosts', text: '7.50')
# Overall costs
- expect(page).to have_selector('tbody .wp-table--sum-container.overallCosts', text: '22.50')
+ expect(page).to have_css('tbody .wp-table--sum-container.overallCosts', text: '22.50')
# Labor costs
- expect(page).to have_selector('tbody .wp-table--sum-container.laborCosts', text: '15.00')
+ expect(page).to have_css('tbody .wp-table--sum-container.laborCosts', text: '15.00')
# Collapsing groups will also hide the sums row
page.find('.expander.icon-minus2', match: :first).click
@@ -196,6 +196,6 @@ RSpec.describe 'Work package index sums', :js do
page.find('.expander.icon-minus2', match: :first).click
# Expect to have only the final sums
- expect(page).to have_selector('tbody .wp-table--sums-row', count: 1)
+ expect(page).to have_css('tbody .wp-table--sums-row', count: 1)
end
end
diff --git a/spec/features/work_packages/navigation_spec.rb b/spec/features/work_packages/navigation_spec.rb
index c817a29447b..35c80815b68 100644
--- a/spec/features/work_packages/navigation_spec.rb
+++ b/spec/features/work_packages/navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package navigation', js: true, selenium: true do
+RSpec.describe 'Work package navigation', :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project, name: 'Some project', enabled_module_names: [:work_package_tracking]) }
let(:work_package) { build(:work_package, project:) }
@@ -85,7 +85,7 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
split_work_package.visit!
split_work_package.expect_subject
# Should be checked in table
- expect(global_work_packages.table_container).to have_selector(".wp-row-#{work_package.id}.-checked")
+ expect(global_work_packages.table_container).to have_css(".wp-row-#{work_package.id}.-checked")
# deep link work package show
@@ -161,10 +161,10 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
visit project_path(project)
find('#main-menu-work-packages ~ .toggler').click
- expect(page).to have_selector('.op-view-select--search-results')
+ expect(page).to have_css('.op-view-select--search-results')
find('.op-sidemenu--item-action', text: query.name).click
- expect(page).not_to have_selector('.title-container', text: 'Overview')
+ expect(page).to have_no_css('.title-container', text: 'Overview')
expect(page).to have_field('editable-toolbar-title', with: query.name)
end
@@ -224,7 +224,7 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
query
end
- it 'will filter out the work package' do
+ it 'filters out the work package' do
wp_table = Pages::WorkPackagesTable.new project
wp_table.visit!
@@ -250,7 +250,7 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
create(:work_package, subject: 'WP attachment A', project:, attachments: [attachment])
end
- it 'will show it when navigating from table to single view' do
+ it 'shows it when navigating from table to single view' do
wp_table = Pages::WorkPackagesTable.new project
wp_table.visit!
@@ -290,7 +290,7 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
context 'when visiting a query that will lead to a query validation error' do
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
- it 'will output a correct error message (Regression #39880)' do
+ it 'outputs a correct error message (Regression #39880)' do
url_query =
"query_id=%7B%22%7B%22&query_props=%7B%22c%22%3A%5B%22id%22%2C%22subject" \
"%22%2C%22type%22%2C%22status%22%2C%22assignee%22%2C%22updatedAt%22%5D%2C" \
@@ -302,7 +302,7 @@ RSpec.describe 'Work package navigation', js: true, selenium: true do
visit "/projects/#{project.identifier}/work_packages?#{url_query}"
wp_table.expect_toast message: 'Your view is erroneous and could not be processed.', type: :error
- expect(page).to have_selector 'li', text: 'Bad request: id is invalid'
+ expect(page).to have_css 'li', text: 'Bad request: id is invalid'
end
end
end
diff --git a/spec/features/work_packages/new/attributes_from_filter_spec.rb b/spec/features/work_packages/new/attributes_from_filter_spec.rb
index a67923e81bc..cb5de138a92 100644
--- a/spec/features/work_packages/new/attributes_from_filter_spec.rb
+++ b/spec/features/work_packages/new/attributes_from_filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package create uses attributes from filters', js: true, selenium: true do
+RSpec.describe 'Work package create uses attributes from filters', :js, :selenium do
let(:user) { create(:admin) }
let(:type_bug) { create(:type_bug) }
let(:type_task) { create(:type_task) }
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 829cb5c42f0..7a223b59a08 100644
--- a/spec/features/work_packages/new/new_work_package_spec.rb
+++ b/spec/features/work_packages/new/new_work_package_spec.rb
@@ -142,7 +142,7 @@ RSpec.describe 'new work package', :js, :with_cuprite do
description_field.set_value description
save_work_package!
- expect(page).to have_selector('.op-work-package-tabs')
+ expect(page).to have_css('.op-work-package-tabs')
subject_field.expect_state_text(subject)
description_field = wp_page.edit_field :description
@@ -194,7 +194,7 @@ RSpec.describe 'new work package', :js, :with_cuprite do
cf1 = find(".#{custom_fields.first.attribute_name(:camel_case)} input")
expect(cf1).not_to be_nil
- expect(page).to have_selector(".#{custom_fields.last.attribute_name(:camel_case)} ng-select")
+ expect(page).to have_css(".#{custom_fields.last.attribute_name(:camel_case)} ng-select")
cf = wp_page.edit_field custom_fields.last.attribute_name(:camel_case)
cf.field_type = 'create-autocompleter'
@@ -240,7 +240,7 @@ RSpec.describe 'new work package', :js, :with_cuprite do
end
it 'reloads the table and selects the new work package' do
- expect(page).not_to have_selector('.wp--row')
+ expect(page).to have_no_css('.wp--row')
create_work_package(type_task)
expect(page).to have_selector(safeguard_selector, wait: 10)
@@ -249,7 +249,7 @@ RSpec.describe 'new work package', :js, :with_cuprite do
save_work_package!
wp_page.dismiss_toaster!
- expect(page).to have_selector('.wp--row.-checked')
+ expect(page).to have_css('.wp--row.-checked')
# Editing the subject after creation
# Fix for WP #23879
@@ -325,7 +325,7 @@ RSpec.describe 'new work package', :js, :with_cuprite do
click_on 'Cancel'
wp_page.click_create_wp_button type_bug
- expect(page).not_to have_selector('.ng-value', text: project.name)
+ expect(page).to have_no_css('.ng-value', text: project.name)
project_field.openSelectField
project_field.set_value project.name
@@ -380,13 +380,13 @@ RSpec.describe 'new work package', :js, :with_cuprite do
create(:project, name: 'Unrelated project', types: [type_task])
end
- it 'will not show that value in the project drop down' do
+ it 'does not show that value in the project drop down' do
create_work_package_globally(type_bug, project.name)
project_field.openSelectField
- expect(page).to have_selector('.ng-dropdown-panel .ng-option', text: project.name)
- expect(page).not_to have_selector('.ng-dropdown-panel .ng-option', text: project_without_bug.name)
+ expect(page).to have_css('.ng-dropdown-panel .ng-option', text: project.name)
+ expect(page).to have_no_css('.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 6880626dd2e..3d3305b4098 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
@@ -3,7 +3,7 @@ require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
require 'features/page_objects/notification'
-RSpec.describe 'new work package', js: true do
+RSpec.describe 'new work package', :js do
let(:type_task) { create(:type_task, description: "# New Task template\n\nHello there") }
let(:type_feature) { create(:type_feature, description: "", is_default: true) }
let(:type_bug) { create(:type_bug, description: "# New Bug template\n\nGeneral Kenobi") }
@@ -26,17 +26,17 @@ RSpec.describe 'new work package', js: true do
# Changes in the description shall not be overridden.
def change_type_and_expect_description(set_project: false)
if !set_project
- expect(page).to have_selector('.inline-edit--container.type', text: type_feature.name)
+ expect(page).to have_css('.inline-edit--container.type', text: type_feature.name)
end
- expect(page).to have_selector('.inline-edit--container.description', text: '')
+ expect(page).to have_css('.inline-edit--container.description', text: '')
type_field.openSelectField
type_field.set_value type_task
- expect(page).to have_selector('.inline-edit--container.description h1', text: 'New Task template')
+ expect(page).to have_css('.inline-edit--container.description h1', text: 'New Task template')
type_field.openSelectField
type_field.set_value type_bug
- expect(page).to have_selector('.inline-edit--container.description h1', text: 'New Bug template')
+ expect(page).to have_css('.inline-edit--container.description h1', text: 'New Bug template')
description_field.set_value 'Something different than the default.'
@@ -44,13 +44,13 @@ RSpec.describe 'new work package', js: true do
type_field.openSelectField
type_field.set_value type_task
- expect(page).to have_selector('.inline-edit--container.description', text: 'Something different than the default.')
+ expect(page).to have_css('.inline-edit--container.description', text: 'Something different than the default.')
sleep 0.1
type_field.openSelectField
type_field.set_value type_bug
- expect(page).to have_selector('.inline-edit--container.description', text: 'Something different than the default.')
+ expect(page).to have_css('.inline-edit--container.description', text: 'Something different than the default.')
if set_project
project_field.openSelectField
@@ -61,7 +61,7 @@ RSpec.describe 'new work package', js: true do
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.')
+ expect(page).to have_css('.inline-edit--display-field.description', text: 'Something different than the default.')
end
before do
diff --git a/spec/features/work_packages/pagination_spec.rb b/spec/features/work_packages/pagination_spec.rb
index 0bff272fac1..d326276c470 100644
--- a/spec/features/work_packages/pagination_spec.rb
+++ b/spec/features/work_packages/pagination_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package pagination', js: true do
+RSpec.describe 'Work package pagination', :js do
shared_let(:admin) { create(:admin) }
let(:project) do
@@ -51,8 +51,8 @@ RSpec.describe 'Work package pagination', js: true do
expect(page).to have_content('All open')
within('.work-packages-partitioned-query-space--container') do
- expect(page).to have_content(work_package_1.subject)
- expect(page).not_to have_content(work_package_2.subject)
+ expect(page).to have_content(work_package_1.subject)
+ expect(page).to have_no_content(work_package_2.subject)
end
within('.op-pagination--pages') do
@@ -60,8 +60,8 @@ RSpec.describe 'Work package pagination', js: true do
end
within('.work-packages-partitioned-query-space--container') do
- expect(page).to have_content(work_package_2.subject)
- expect(page).not_to have_content(work_package_1.subject)
+ expect(page).to have_content(work_package_2.subject)
+ expect(page).to have_no_content(work_package_1.subject)
end
within('.op-pagination--options') do
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 87bebe923b9..436c8d69175 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
@@ -457,6 +457,6 @@ RSpec.shared_examples 'has a project include dropdown', :js, type: :feature do
dropdown.toggle!
dropdown.expect_open
dropdown.search 'Nonexistent'
- expect(page).not_to have_selector("[data-test-selector='op-project-include--loading']")
+ expect(page).to have_no_css("[data-test-selector='op-project-include--loading']")
end
end
diff --git a/spec/features/work_packages/reports_spec.rb b/spec/features/work_packages/reports_spec.rb
index a3ade4542f8..86c82b9f3ac 100644
--- a/spec/features/work_packages/reports_spec.rb
+++ b/spec/features/work_packages/reports_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'work package reports', js: true do
+RSpec.describe 'work package reports', :js do
let(:project) { create(:project_with_types, types: [type_a]) }
let(:user) { create(:user, member_with_permissions: { project => %i(view_work_packages) }) }
@@ -64,22 +64,22 @@ RSpec.describe 'work package reports', js: true do
.to have_content 'ACCOUNTABLE'
expect(page)
- .to have_selector 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
+ .to have_css 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
expect(page)
- .to have_selector 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
+ .to have_css 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
# Clicking on the further analyze link will lead to a page focusing on type
click_link 'Further analyze: Type'
@@ -94,22 +94,22 @@ RSpec.describe 'work package reports', js: true do
.to have_no_content 'ACCOUNTABLE'
expect(page)
- .to have_selector 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
+ .to have_css 'thead th:nth-of-type(2)', text: type_a.statuses.first.name.upcase
expect(page)
- .to have_selector 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
+ .to have_css 'thead th:nth-of-type(3)', text: type_a.statuses.last.name.upcase
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(1)', text: type_a.name
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(2)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(3)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(4)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(5)', text: 1
expect(page)
- .to have_selector 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
+ .to have_css 'tbody tr:nth-of-type(1) td:nth-of-type(6)', text: 2
# Clicking on a number in the table will lead to the wp list filtered by the type
within 'tbody tr:first-of-type td:nth-of-type(2)' do
diff --git a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
index 8611628d010..e1712597c00 100644
--- a/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
+++ b/spec/features/work_packages/scheduling/scheduling_mode_spec.rb
@@ -33,8 +33,7 @@ require 'features/work_packages/shared_contexts'
require 'support/edit_fields/edit_field'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'scheduling mode',
- js: true do
+RSpec.describe 'scheduling mode', :js do
let(:project) { create(:project_with_types, public: true) }
# Constructing a work package graph that looks like this:
#
diff --git a/spec/features/work_packages/select/select_card_view_spec.rb b/spec/features/work_packages/select/select_card_view_spec.rb
index edf8a8c6370..54251fceba4 100644
--- a/spec/features/work_packages/select/select_card_view_spec.rb
+++ b/spec/features/work_packages/select/select_card_view_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Selecting cards in the card view (regression #31962)', js: true do
+RSpec.describe 'Selecting cards in the card view (regression #31962)', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
diff --git a/spec/features/work_packages/select/select_query_spec.rb b/spec/features/work_packages/select/select_query_spec.rb
index c63b1363683..aacfe9d3894 100644
--- a/spec/features/work_packages/select/select_query_spec.rb
+++ b/spec/features/work_packages/select/select_query_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe 'Query selection' do
filters.open
end
- it 'shows the default (status) filter', js: true do
+ it 'shows the default (status) filter', :js do
filters.expect_filter_count 1
filters.expect_filter_by 'Status', 'open', nil
end
@@ -80,12 +80,12 @@ RSpec.describe 'Query selection' do
work_packages_page.select_query query
end
- it 'shows the saved filters', js: true do
+ it 'shows the saved filters', :js do
filters.open
filters.expect_filter_by 'Assignee', 'is (OR)', ['me']
filters.expect_filter_by 'Percent Complete', '>=', ['10'], 'percentageDone'
- expect(page).to have_selector("#{test_selector('wp-filter-button')} .badge", text: '2')
+ expect(page).to have_css("#{test_selector('wp-filter-button')} .badge", text: '2')
end
end
@@ -103,7 +103,7 @@ RSpec.describe 'Query selection' do
work_packages_page.select_query query
end
- it 'updates the page upon query switching', js: true do
+ it 'updates the page upon query switching', :js do
wp_page.expect_title query.name, editable: false
find('.op-sidemenu--item-action', text: query2.name).click
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 02b3c2ae8db..1be14e37900 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Select work package row', js: true, selenium: true do
+RSpec.describe 'Select work package row', :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package_1) { create(:work_package, project:) }
@@ -105,13 +105,13 @@ RSpec.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).not_to have_selector '#work-package-context-menu'
+ expect(page).to have_no_css '#work-package-context-menu'
end
def uncheck_all
find('body').send_keys [:control, 'd']
expect_row_unchecked(1, 2, 3)
- expect(page).not_to have_selector '#work-package-context-menu'
+ expect(page).to have_no_css '#work-package-context-menu'
end
it 'handles selection flows' do
@@ -204,8 +204,8 @@ RSpec.describe 'Select work package row', js: true, selenium: true do
end
it do
- expect(page).to have_selector('.work-packages--details--subject',
- text: work_package_1.subject)
+ expect(page).to have_css('.work-packages--details--subject',
+ text: work_package_1.subject)
end
end
@@ -221,7 +221,7 @@ RSpec.describe 'Select work package row', js: true, selenium: true do
split_wp.expect_attributes Subject: work_package_2.subject
find_by_id('work-packages-details-view-button').click
- expect(page).not_to have_selector('.work-packages--details')
+ expect(page).to have_no_css('.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 9ab9fcb4b80..a145ae6034b 100644
--- a/spec/features/work_packages/select/select_wp_card_spec.rb
+++ b/spec/features/work_packages/select/select_wp_card_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Select work package card', js: true, selenium: true do
+RSpec.describe 'Select work package card', :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_package_1) { create(:work_package, project:) }
@@ -54,8 +54,8 @@ RSpec.describe 'Select work package card', js: true, selenium: true do
describe 'opening' do
it 'the full screen view via double click' do
wp_card_view.open_full_screen_by_doubleclick(work_package_1)
- expect(page).to have_selector('.work-packages--details--subject',
- text: work_package_1.subject)
+ expect(page).to have_css('.work-packages--details--subject',
+ text: work_package_1.subject)
end
it 'the split screen of the selected WP' do
@@ -65,7 +65,7 @@ RSpec.describe 'Select work package card', js: true, selenium: true do
split_wp.expect_attributes Subject: work_package_2.subject
find_by_id('work-packages-details-view-button').click
- expect(page).not_to have_selector('.work-packages--details')
+ expect(page).to have_no_css('.work-packages--details')
end
end
end
diff --git a/spec/features/work_packages/share/access_spec.rb b/spec/features/work_packages/share/access_spec.rb
index b7f54d3c5b1..cf378a69aea 100644
--- a/spec/features/work_packages/share/access_spec.rb
+++ b/spec/features/work_packages/share/access_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe 'Shared Work Package Access',
results = assignee_field.autocomplete('Mean Turkey', select: false)
wait_for_network_idle
expect(results)
- .not_to have_css('.ng-option', text: 'Mean Turkey', wait: 0)
+ .to have_no_css('.ng-option', text: 'Mean Turkey', wait: 0)
assignee_field.cancel_by_escape
end
@@ -109,7 +109,7 @@ RSpec.describe 'Shared Work Package Access',
work_package_page.within_active_tab do
# Commenting is disabled
expect(page)
- .not_to have_css(add_comment_button_selector)
+ .to have_no_css(add_comment_button_selector)
end
# And so is viewing and uploading attachments
diff --git a/spec/features/work_packages/share/share_spec.rb b/spec/features/work_packages/share/share_spec.rb
index 5cf8c1aa5a5..638b7afa236 100644
--- a/spec/features/work_packages/share/share_spec.rb
+++ b/spec/features/work_packages/share/share_spec.rb
@@ -337,7 +337,7 @@ RSpec.describe 'Work package sharing',
# false positives on the button not being rendered because
# its request is still pending.
wait_for_network_idle(timeout: 10)
- expect(page).not_to have_button("Share")
+ expect(page).to have_no_button("Share")
end
end
end
diff --git a/spec/features/work_packages/shared_contexts.rb b/spec/features/work_packages/shared_contexts.rb
index 434e03f22ea..d9e8a4bb2db 100644
--- a/spec/features/work_packages/shared_contexts.rb
+++ b/spec/features/work_packages/shared_contexts.rb
@@ -37,7 +37,7 @@ RSpec.shared_context 'ensure wp details pane update done' do
# safeguard to ensure all backend queries
# have been answered before starting a new spec
- expect(page).to have_selector('.op-user-activity--user-name',
- text: update_user.name)
+ expect(page).to have_css('.op-user-activity--user-name',
+ text: update_user.name)
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 d86a0c9651e..4ca1c9f48e1 100644
--- a/spec/features/work_packages/sorting/manual_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/manual_sorting_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Manual sorting of WP table', js: true do
+RSpec.describe 'Manual sorting of WP table', :js do
let(:user) { create(:admin) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
@@ -209,25 +209,25 @@ RSpec.describe 'Manual sorting of WP table', js: true do
end
it 'updates the work packages appropriately' do
- expect(page).to have_selector('.group--value', text: 'Task (2)')
- expect(page).to have_selector('.group--value', text: 'Bug (2)')
+ expect(page).to have_css('.group--value', text: 'Task (2)')
+ expect(page).to have_css('.group--value', text: 'Bug (2)')
wp_table.drag_and_drop_work_package from: 0, to: 3
- expect(page).to have_selector('.group--value', text: 'Task (1)')
- expect(page).to have_selector('.group--value', text: 'Bug (3)')
+ expect(page).to have_css('.group--value', text: 'Task (1)')
+ expect(page).to have_css('.group--value', text: 'Bug (3)')
end
it 'dragging item with parent does not result in an error (Regression #30832)' do
- expect(page).to have_selector('.group--value', text: 'Task (2)')
- expect(page).to have_selector('.group--value', text: 'Bug (2)')
+ expect(page).to have_css('.group--value', text: 'Task (2)')
+ expect(page).to have_css('.group--value', text: 'Bug (2)')
wp_table.drag_and_drop_work_package from: 1, to: 3
- expect(page).to have_selector('.group--value', text: 'Task (1)')
- expect(page).to have_selector('.group--value', text: 'Bug (3)')
+ expect(page).to have_css('.group--value', text: 'Task (1)')
+ expect(page).to have_css('.group--value', text: 'Bug (3)')
- expect(page).not_to have_selector '.op-toast.error'
+ expect(page).to have_no_css '.op-toast.error'
end
end
end
diff --git a/spec/features/work_packages/sorting/table_sorting_spec.rb b/spec/features/work_packages/sorting/table_sorting_spec.rb
index 1a7c1acefad..231ae213096 100644
--- a/spec/features/work_packages/sorting/table_sorting_spec.rb
+++ b/spec/features/work_packages/sorting/table_sorting_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Select work package row', js: true do
+RSpec.describe 'Select work package row', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:work_packages_page) { WorkPackagesPage.new(project) }
diff --git a/spec/features/work_packages/switching_to_project_from_work_package_spec.rb b/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
index 47edc6474ab..55d4f8be577 100644
--- a/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
+++ b/spec/features/work_packages/switching_to_project_from_work_package_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Switching to project from work package', js: true do
+RSpec.describe 'Switching to project from work package', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -22,7 +22,7 @@ RSpec.describe 'Switching to project from work package', js: true do
wp_table.open_full_screen_by_link work_package
# Follow link to project
- expect(page).to have_selector('.attributes-group.-project-context')
+ expect(page).to have_css('.attributes-group.-project-context')
link = find('.attributes-group.-project-context .project-context--switch-link')
expect(link[:href]).to include(project_path(project.id))
diff --git a/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb b/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
index e3d384d270e..7dc636fa7c2 100644
--- a/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_invisible_project_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'baseline with a work package moved to an invisible project',
- js: true,
+RSpec.describe 'baseline with a work package moved to an invisible project', :js,
with_settings: { date_format: '%Y-%m-%d' } do
shared_let(:type_bug) { create(:type_bug) }
shared_let(:visible_project) { create(:project, types: [type_bug]) }
@@ -39,7 +38,8 @@ RSpec.describe 'baseline with a work package moved to an invisible project',
create(:user,
firstname: 'Itsa',
lastname: 'Me',
- member_with_permissions: { visible_project => %i[view_work_packages edit_work_packages work_package_assigned assign_versions] })
+ member_with_permissions: { visible_project => %i[view_work_packages edit_work_packages work_package_assigned
+ assign_versions] })
end
shared_let(:wp_bug) do
diff --git a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
index f3acc48a4be..dc14ac49dbb 100644
--- a/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
+++ b/spec/features/work_packages/table/baseline/baseline_rendering_spec.rb
@@ -69,7 +69,8 @@ RSpec.describe 'baseline rendering',
create(:admin,
firstname: 'Itsa',
lastname: 'Me',
- member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned assign_versions] })
+ member_with_permissions: { project => %i[view_work_packages edit_work_packages work_package_assigned
+ assign_versions] })
end
shared_let(:assignee) do
@@ -372,16 +373,16 @@ RSpec.describe 'baseline rendering',
# show icons on work package single card
display_representation.switch_to_card_layout
within "wp-single-card[data-work-package-id='#{wp_bug_was_task.id}']" do
- expect(page).to have_selector(".op-table-baseline--icon-removed")
+ expect(page).to have_css(".op-table-baseline--icon-removed")
end
within "wp-single-card[data-work-package-id='#{wp_task_was_bug.id}']" do
- expect(page).to have_selector(".op-table-baseline--icon-added")
+ expect(page).to have_css(".op-table-baseline--icon-added")
end
within "wp-single-card[data-work-package-id='#{wp_task_changed.id}']" do
- expect(page).to have_selector(".op-table-baseline--icon-changed")
+ expect(page).to have_css(".op-table-baseline--icon-changed")
end
within "wp-single-card[data-work-package-id='#{wp_task.id}']" do
- expect(page).not_to have_selector(".op-wp-single-card--content-baseline")
+ expect(page).to have_no_css(".op-wp-single-card--content-baseline")
end
end
@@ -437,10 +438,10 @@ RSpec.describe 'baseline rendering',
baseline_modal.expect_closed
baseline_modal.toggle_drop_modal
baseline_modal.expect_open
- expect(page).to have_selector(".op-baseline--enterprise-title")
+ expect(page).to have_css(".op-baseline--enterprise-title")
# only yesterday is selectable
page.select('a specific date', from: 'op-baseline-filter')
- expect(page).not_to have_select('op-baseline-filter', selected: 'a specific date')
+ expect(page).to have_no_select('op-baseline-filter', selected: 'a specific date')
page.select('yesterday', from: 'op-baseline-filter')
expect(page).to have_select('op-baseline-filter', selected: 'yesterday')
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 0060a9b0397..50538dcab35 100644
--- a/spec/features/work_packages/table/configuration_modal/column_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/column_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table configuration modal columns spec', js: true do
+RSpec.describe 'Work Package table configuration modal columns spec', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -22,8 +22,8 @@ RSpec.describe 'Work Package table configuration modal columns spec', js: true d
login_as(user)
wp_table.visit_query query
wp_table.expect_work_package_listed work_package
- expect(page).to have_selector('.wp-table--table-header', text: 'ID')
- expect(page).to have_selector('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css('.wp-table--table-header', text: 'ID')
+ expect(page).to have_css('.wp-table--table-header', text: 'SUBJECT')
end
shared_examples 'add and remove columns' do
@@ -37,9 +37,9 @@ RSpec.describe 'Work Package table configuration modal columns spec', js: true d
columns.expect_column_available 'Subject'
columns.expect_column_not_available 'Project'
- expect(page).to have_selector('.wp-table--table-header', text: 'ID')
- expect(page).to have_selector('.wp-table--table-header', text: 'PROJECT')
- expect(page).not_to have_selector('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css('.wp-table--table-header', text: 'ID')
+ expect(page).to have_css('.wp-table--table-header', text: 'PROJECT')
+ expect(page).to have_no_css('.wp-table--table-header', text: 'SUBJECT')
end
end
@@ -76,9 +76,9 @@ RSpec.describe 'Work Package table configuration modal columns spec', js: true d
sleep 1
columns.apply
- 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_selector('.wp-table--table-header', text: 'SUBJECT')
+ expect(page).to have_css('.wp-table--table-header', text: 'ID')
+ expect(page).to have_css('.wp-table--table-header', text: 'PROJECT')
+ expect(page).to have_css('.wp-table--table-header', text: 'SUBJECT')
names = all('.wp-table--table-header').map(&:text)
# Depending on what browser is used, subject column may be first or second
diff --git a/spec/features/work_packages/table/configuration_modal/filter_spec.rb b/spec/features/work_packages/table/configuration_modal/filter_spec.rb
index e8b8fbf355c..27694868bd2 100644
--- a/spec/features/work_packages/table/configuration_modal/filter_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/filter_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table configuration modal filters spec', js: true do
+RSpec.describe 'Work Package table configuration modal filters spec', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
diff --git a/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb b/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
index 2591435afd7..2cf00353f1a 100644
--- a/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
+++ b/spec/features/work_packages/table/configuration_modal/table_configuration_modal_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table configuration modal', js: true do
+RSpec.describe 'Work Package table configuration modal', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -32,6 +32,6 @@ RSpec.describe 'Work Package table configuration modal', js: true do
find('#column-context-menu .menu-item', text: 'Insert columns').click
# Expect active tab is columns
- expect(page).to have_selector('.op-tab-row--link_selected', text: 'COLUMNS')
+ expect(page).to have_css('.op-tab-row--link_selected', text: 'COLUMNS')
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 dd307679dc5..a6c7f29a4d1 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
@@ -16,8 +16,8 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
# Open full view
open_context_menu.call
menu.choose('Open fullscreen view')
- expect(page).to have_selector('.work-packages--show-view .inline-edit--container.subject',
- text: work_package.subject)
+ expect(page).to have_css('.work-packages--show-view .inline-edit--container.subject',
+ text: work_package.subject)
# Open log time
open_context_menu.call
@@ -29,16 +29,16 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
# Open Move
open_context_menu.call
menu.choose('Change project')
- expect(page).to have_selector('h2', text: I18n.t(:button_move))
- expect(page).to have_selector('a.work_package', text: "##{work_package.id}")
+ expect(page).to have_css('h2', text: I18n.t(:button_move))
+ expect(page).to have_css('a.work_package', text: "##{work_package.id}")
# Open Copy
open_context_menu.call
menu.choose('Copy')
# Split view open in copy state
expect(page)
- .to have_selector('.wp-new-top-row',
- text: "#{work_package.status.name.capitalize}\n#{work_package.type.name.upcase}")
+ .to have_css('.wp-new-top-row',
+ text: "#{work_package.status.name.capitalize}\n#{work_package.type.name.upcase}")
expect(page).to have_field('wp-new-inline-edit--field-subject', with: work_package.subject)
# Open Delete
@@ -50,11 +50,11 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
# Open create new child
open_context_menu.call
menu.choose('Create new child')
- expect(page).to have_selector('.inline-edit--container.subject input')
+ expect(page).to have_css('.inline-edit--container.subject input')
expect(current_url).to match(/.*\/create_new\?.*(&)*parent_id=#{work_package.id}/)
find_by_id('work-packages--edit-actions-cancel').click
- expect(page).not_to have_selector('.inline-edit--container.subject input')
+ expect(page).to have_no_css('.inline-edit--container.subject input')
# Timeline actions only shown when open
wp_timeline.expect_timeline!(open: false)
@@ -65,8 +65,8 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
# Copy to other project
open_context_menu.call
menu.choose('Copy to other project')
- expect(page).to have_selector('h2', text: I18n.t(:button_copy))
- expect(page).to have_selector('a.work_package', text: "##{work_package.id}")
+ expect(page).to have_css('h2', text: I18n.t(:button_copy))
+ expect(page).to have_css('a.work_package', text: "##{work_package.id}")
end
describe 'creating work packages' do
@@ -76,7 +76,7 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
it 'can create a new child from the context menu (Regression #33329)' do
open_context_menu.call
menu.choose('Create new child')
- expect(page).to have_selector('.inline-edit--container.subject input')
+ expect(page).to have_css('.inline-edit--container.subject input')
expect(current_url).to match(/.*\/create_new\?.*(&)*parent_id=#{work_package.id}/)
split_view = Pages::SplitWorkPackageCreate.new project: work_package.project
@@ -87,7 +87,7 @@ RSpec.shared_examples_for 'provides a single WP context menu' do
subject.submit_by_enter
split_view.expect_and_dismiss_toaster message: 'Successful creation.'
- expect(page).to have_selector('[data-test-selector="op-wp-breadcrumb"]', text: "Parent:\n#{work_package.subject}")
+ expect(page).to have_css('[data-test-selector="op-wp-breadcrumb"]', text: "Parent:\n#{work_package.subject}")
wp = WorkPackage.last
expect(wp.parent).to eq work_package
end
diff --git a/spec/features/work_packages/table/context_menu/context_menu_spec.rb b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
index 5cf1fdb0d4f..472213a20b7 100644
--- a/spec/features/work_packages/table/context_menu/context_menu_spec.rb
+++ b/spec/features/work_packages/table/context_menu/context_menu_spec.rb
@@ -1,7 +1,7 @@
require 'spec_helper'
require_relative 'context_menu_shared_examples'
-RSpec.describe 'Work package table context menu', js: true, with_cuprite: true do
+RSpec.describe 'Work package table context menu', :js, :with_cuprite do
shared_let(:user) { create(:admin) }
shared_let(:work_package) { create(:work_package) }
diff --git a/spec/features/work_packages/table/delete_work_packages_spec.rb b/spec/features/work_packages/table/delete_work_packages_spec.rb
index 6f3a0c19c56..4eef1626ce6 100644
--- a/spec/features/work_packages/table/delete_work_packages_spec.rb
+++ b/spec/features/work_packages/table/delete_work_packages_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Delete work package', js: true do
+RSpec.describe 'Delete work package', :js do
let(:user) { create(:admin) }
let(:context_menu) { Components::WorkPackages::ContextMenu.new }
let(:destroy_modal) { Components::WorkPackages::DestroyModal.new }
diff --git a/spec/features/work_packages/table/duration_field_spec.rb b/spec/features/work_packages/table/duration_field_spec.rb
index b90673348f1..81dbb374c80 100644
--- a/spec/features/work_packages/table/duration_field_spec.rb
+++ b/spec/features/work_packages/table/duration_field_spec.rb
@@ -1,7 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Duration field in the work package table',
- js: true do
+RSpec.describe 'Duration field in the work package table', :js do
shared_let(:current_user) { create(:admin) }
shared_let(:work_package) do
next_monday = Time.zone.today.beginning_of_week.next_occurring(:monday)
diff --git a/spec/features/work_packages/table/edit_work_packages_spec.rb b/spec/features/work_packages/table/edit_work_packages_spec.rb
index cb0ff7113c2..1b6dea4eaf5 100644
--- a/spec/features/work_packages/table/edit_work_packages_spec.rb
+++ b/spec/features/work_packages/table/edit_work_packages_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Inline editing work packages', js: true do
+RSpec.describe 'Inline editing work packages', :js do
let(:manager_role) do
create(:project_role,
permissions: %i[view_work_packages
@@ -175,9 +175,9 @@ RSpec.describe 'Inline editing work packages', js: true do
message: "#{cf_list_name} can't be blank.\n#{cf_text_name} can't be blank."
)
- expect(page).to have_selector('th a', text: cf_list_name.upcase)
- expect(page).to have_selector('th a', text: cf_text_name.upcase)
- expect(wp_table.row(work_package)).to have_selector('.wp-table--cell-container.-error', count: 2)
+ expect(page).to have_css('th a', text: cf_list_name.upcase)
+ expect(page).to have_css('th a', text: cf_text_name.upcase)
+ expect(wp_table.row(work_package)).to have_css('.wp-table--cell-container.-error', count: 2)
cf_text = wp_table.edit_field(work_package, custom_fields.last.attribute_name(:camel_case))
cf_text.update('my custom text', expect_failure: true)
diff --git a/spec/features/work_packages/table/empty_filters_spec.rb b/spec/features/work_packages/table/empty_filters_spec.rb
index f145955b6ec..8053a276618 100644
--- a/spec/features/work_packages/table/empty_filters_spec.rb
+++ b/spec/features/work_packages/table/empty_filters_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Empty query filters', js: true do
+RSpec.describe 'Empty query filters', :js do
let(:user) { create(:admin) }
let(:work_package) { create(:work_package) }
let(:wp_table) { Pages::WorkPackagesTable.new }
diff --git a/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb b/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
index 79a3bae09a9..bea6f49e021 100644
--- a/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_by_boolean_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package group by boolean field', js: true do
+RSpec.describe 'Work Package group by boolean field', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, types: [type], work_package_custom_fields: [bool_cf]) }
diff --git a/spec/features/work_packages/table/group_by/group_headers_spec.rb b/spec/features/work_packages/table/group_by/group_headers_spec.rb
index bbd5d9d0da9..37e32290854 100644
--- a/spec/features/work_packages/table/group_by/group_headers_spec.rb
+++ b/spec/features/work_packages/table/group_by/group_headers_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table group headers', js: true do
+RSpec.describe 'Work Package table group headers', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
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 b2bd7949571..cfacef7ab2f 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
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table hierarchy parent below', js: true do
+RSpec.describe 'Work Package table hierarchy parent below', :js do
let(:user) { create(:admin) }
let(:type_bug) { create(:type_bug) }
let(:type_task) { create(:type_task) }
@@ -128,10 +128,10 @@ RSpec.describe 'Work Package table hierarchy parent below', js: true do
wp_table.expect_work_package_listed(child, child2, parent, grandparent)
# Expect pagination to be correct
- expect(page).to have_selector('.op-pagination--item_current', text: '3')
+ expect(page).to have_css('.op-pagination--item_current', text: '3')
# Expect count to be correct (one additional parent shown)
- expect(page).to have_selector('.wp--row', count: 4)
+ expect(page).to have_css('.wp--row', count: 4)
# Double order result from regression
wp_table.expect_work_package_order(grandparent.id, parent.id, child.id, child2.id)
@@ -155,14 +155,14 @@ RSpec.describe 'Work Package table hierarchy parent below', js: true do
wp_table.visit!
wp_table.expect_work_package_listed(child, parent)
- expect(page).to have_selector('.wp-table--hierarchy-indicator-icon')
+ expect(page).to have_css('.wp-table--hierarchy-indicator-icon')
split_page = wp_table.open_split_view(parent)
split_page.visit_tab!("relations")
relations.remove_child(child)
loading_indicator_saveguard
- expect(page).not_to have_selector('.wp-table--hierarchy-indicator-icon')
+ expect(page).to have_no_css('.wp-table--hierarchy-indicator-icon')
end
end
end
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
index ebeb987cb09..705b0fb5a6b 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_sorting_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table hierarchy and sorting', js: true do
+RSpec.describe 'Work Package table hierarchy and sorting', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
diff --git a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
index dfc66d50a34..d1e3a8d0b35 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table hierarchy', js: true do
+RSpec.describe 'Work Package table hierarchy', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -136,7 +136,7 @@ RSpec.describe 'Work Package table hierarchy', js: true do
hierarchy.enable_hierarchy
# Should not be marked as additional row (grey)
- expect(page).not_to have_selector('.wp-table--hierarchy-aditional-row')
+ expect(page).to have_no_css('.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/hierarchy/hierarchy_vs_grouping_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
index d615f8eb5b4..9e2f4f2a0e3 100644
--- a/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/hierarchy_vs_grouping_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work Package table hierarchy vs grouping', js: true do
+RSpec.describe 'Work Package table hierarchy vs grouping', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
diff --git a/spec/features/work_packages/table/hierarchy/parent_column_spec.rb b/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
index ddab51aae8d..e4bf762a997 100644
--- a/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
+++ b/spec/features/work_packages/table/hierarchy/parent_column_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table parent column', js: true do
+RSpec.describe 'Work Package table parent column', :js do
let(:user) { create(:admin) }
let!(:parent) { create(:work_package, project:) }
let!(:child) { create(:work_package, project:, parent:) }
@@ -28,11 +28,11 @@ RSpec.describe 'Work Package table parent column', js: true do
# Hierarchy mode is enabled by default
page.within(".wp-row-#{parent.id}") do
- expect(page).to have_selector('td.parent', text: '-')
+ expect(page).to have_css('td.parent', text: '-')
end
page.within(".wp-row-#{child.id}") do
- expect(page).to have_selector('td.parent', text: "##{parent.id}")
+ expect(page).to have_css('td.parent', text: "##{parent.id}")
end
end
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 87b7adff828..29f12962e53 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
@@ -34,8 +34,8 @@ RSpec.describe 'inline create work package', :js do
wp_table.expect_work_package_listed(existing_wp)
wp_table.click_inline_create
- expect(page).to have_selector('.wp--row', count: 2)
- expect(page).to have_selector('.wp-inline-create-row')
+ expect(page).to have_css('.wp--row', count: 2)
+ expect(page).to have_css('.wp-inline-create-row')
expect(page).to have_focus_on('#wp-new-inline-edit--field-subject')
# Expect subject to be activated
@@ -52,7 +52,7 @@ RSpec.describe 'inline create work package', :js do
)
# Expect new create row to exist
- expect(page).to have_selector('.wp--row', count: 2)
+ expect(page).to have_css('.wp--row', count: 2)
expect(page).to have_button(exact_text: 'Create new work package')
wp_table.click_inline_create
@@ -65,8 +65,8 @@ RSpec.describe 'inline create work package', :js do
# Callback for adjustments
callback.call
- expect(page).to have_selector('.wp--row .subject', text: 'Some subject')
- expect(page).to have_selector('.wp--row .subject', text: 'Another subject')
+ expect(page).to have_css('.wp--row .subject', text: 'Some subject')
+ expect(page).to have_css('.wp--row .subject', text: 'Another subject')
# safeguards
wp_table.dismiss_toaster!
@@ -75,7 +75,7 @@ RSpec.describe 'inline create work package', :js do
)
# Expect no inline create open
- expect(page).not_to have_selector('.wp-inline-create-row')
+ expect(page).to have_no_css('.wp-inline-create-row')
end
end
@@ -84,7 +84,7 @@ RSpec.describe 'inline create work package', :js do
it 'renders the work package, but no create row' do
wp_table.expect_work_package_listed(existing_wp)
- expect(page).not_to have_button(exact_text: 'Create new work package')
+ expect(page).to have_no_button(exact_text: 'Create new work package')
end
end
@@ -190,8 +190,8 @@ RSpec.describe 'inline create work package', :js do
it 'renders the work packages, but no create' do
wp_table.expect_work_package_listed(existing_wp)
- expect(page).not_to have_button(exact_text: 'Create new work package')
- expect(page).to have_selector('.add-work-package[disabled]')
+ expect(page).to have_no_button(exact_text: 'Create new work package')
+ expect(page).to have_css('.add-work-package[disabled]')
end
end
end
diff --git a/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb b/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
index 064e2481536..84cbcd89286 100644
--- a/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
+++ b/spec/features/work_packages/table/inline_create/inline_create_refresh_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Refreshing in inline-create row', flaky: true, js: true do
+RSpec.describe 'Refreshing in inline-create row', :flaky, :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
@@ -23,16 +23,16 @@ RSpec.describe 'Refreshing in inline-create row', flaky: true, js: true do
end
it 'correctly updates the set of active columns' do
- expect(page).to have_selector('.wp--row', count: 0)
+ expect(page).to have_css('.wp--row', count: 0)
wp_table.click_inline_create
- expect(page).to have_selector('.wp--row', count: 1)
+ expect(page).to have_css('.wp--row', count: 1)
- expect(page).to have_selector('.wp-inline-create-row')
- expect(page).to have_selector('.wp-inline-create-row .wp-table--cell-td.subject')
- expect(page).to have_selector('.wp-inline-create-row .wp-table--cell-td.category')
+ expect(page).to have_css('.wp-inline-create-row')
+ expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.subject')
+ expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.category')
columns.add '% Complete'
- expect(page).to have_selector('.wp-inline-create-row .wp-table--cell-td.wp-table--cell-td.percentageDone')
+ expect(page).to have_css('.wp-inline-create-row .wp-table--cell-td.wp-table--cell-td.percentageDone')
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 3d3c30d9bb5..0e9b7335572 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
@@ -49,15 +49,15 @@ RSpec.describe 'Parallel work package creation spec', :js do
new_work_package_in_both 'Some subject', 'My description!'
# Save in inline create
- expect(page).to have_selector('.wp-inline-create-row')
- expect(page).to have_selector('.wp--row', count: 1)
+ expect(page).to have_css('.wp-inline-create-row')
+ expect(page).to have_css('.wp--row', count: 1)
subject_field = wp_table.edit_field(nil, :subject)
subject_field.save!
# There should be one row, and no open inline create row
- expect(page).to have_selector('.wp--row', count: 1)
- expect(page).not_to have_selector('.wp-inline-create-row')
+ expect(page).to have_css('.wp--row', count: 1)
+ expect(page).to have_no_css('.wp-inline-create-row')
wp_table.expect_toast(
message: 'Successful creation. Click here to open this work package in fullscreen view.'
@@ -81,7 +81,7 @@ RSpec.describe 'Parallel work package creation spec', :js do
new_work_package_in_both 'New subject', 'New description'
# Inline create still open
- expect(page).to have_selector('.wp-inline-create-row')
+ expect(page).to have_css('.wp-inline-create-row')
# Save in split screen
new_split = Pages::SplitWorkPackageCreate.new(project:)
@@ -94,8 +94,8 @@ RSpec.describe 'Parallel work package creation spec', :js do
message: 'Successful creation.'
)
wp_table.dismiss_toaster!
- expect(page).to have_selector('.wp--row', count: 2)
- expect(page).not_to have_selector('.wp-inline-create-row')
+ expect(page).to have_css('.wp--row', count: 2)
+ expect(page).to have_no_css('.wp-inline-create-row')
# Get the last work package
wp2 = WorkPackage.last
diff --git a/spec/features/work_packages/table/milestones_spec.rb b/spec/features/work_packages/table/milestones_spec.rb
index f9ea1a684e5..702a42791ba 100644
--- a/spec/features/work_packages/table/milestones_spec.rb
+++ b/spec/features/work_packages/table/milestones_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Inline editing milestones', js: true do
+RSpec.describe 'Inline editing milestones', :js do
let(:user) { create(:admin) }
let(:type) { create(:type, is_milestone: true) }
diff --git a/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb b/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
index 4ca541a4e64..7daced59841 100644
--- a/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/bool_cf_filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package filtering by bool custom field', js: true do
+RSpec.describe 'Work package filtering by bool custom field', :js do
let(:project) { create(:project) }
let(:type) { project.types.first }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
diff --git a/spec/features/work_packages/table/queries/default_queries_spec.rb b/spec/features/work_packages/table/queries/default_queries_spec.rb
index aa249d42ad1..f2e3053bf8e 100644
--- a/spec/features/work_packages/table/queries/default_queries_spec.rb
+++ b/spec/features/work_packages/table/queries/default_queries_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Default work package queries', js: true do
+RSpec.describe 'Default work package queries', :js do
create_shared_association_defaults_for_work_package_factory
shared_let(:user) { create(:admin) }
diff --git a/spec/features/work_packages/table/queries/filter_pagination_spec.rb b/spec/features/work_packages/table/queries/filter_pagination_spec.rb
index b78708436ef..124acc8f64a 100644
--- a/spec/features/work_packages/table/queries/filter_pagination_spec.rb
+++ b/spec/features/work_packages/table/queries/filter_pagination_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Filter updates pagination', js: true do
+RSpec.describe 'Filter updates pagination', :js do
let(:user) do
create(:user,
member_with_permissions: { project => %i[view_work_packages] })
@@ -53,12 +53,12 @@ RSpec.describe 'Filter updates pagination', js: true do
wp_table.visit!
end
- it 'will reset page to 1 if changing filter' do
+ it 'resets page to 1 if changing filter' do
wp_table.expect_work_package_listed work_package_1
wp_table.ensure_work_package_not_listed! work_package_2
# Expect pagination to be correct
- expect(page).to have_selector('.op-pagination--item_current', text: '1')
+ expect(page).to have_css('.op-pagination--item_current', text: '1')
# Go to second page
within('.op-pagination--pages') do
@@ -69,7 +69,7 @@ RSpec.describe 'Filter updates pagination', js: true do
wp_table.ensure_work_package_not_listed! work_package_1
# Expect pagination to be correct
- expect(page).to have_selector('.op-pagination--item_current', text: '2')
+ expect(page).to have_css('.op-pagination--item_current', text: '2')
# Change filter to assigned to
filters.expect_filter_count 1
@@ -81,6 +81,6 @@ RSpec.describe 'Filter updates pagination', js: true do
wp_table.ensure_work_package_not_listed! work_package_2
# Expect pagination to be back to 1
- expect(page).to have_selector('.op-pagination--range', text: '1 - 1/1')
+ expect(page).to have_css('.op-pagination--range', text: '1 - 1/1')
end
end
diff --git a/spec/features/work_packages/table/queries/filter_spec.rb b/spec/features/work_packages/table/queries/filter_spec.rb
index f8d12026fb3..ba8367868ac 100644
--- a/spec/features/work_packages/table/queries/filter_spec.rb
+++ b/spec/features/work_packages/table/queries/filter_spec.rb
@@ -146,8 +146,8 @@ RSpec.describe 'filter work packages', :js do
filters.open_autocompleter :status
- expect(page).to have_selector('.ng-option', text: closed_status.name)
- expect(page).not_to have_selector('.ng-option', text: status.name)
+ expect(page).to have_css('.ng-option', text: closed_status.name)
+ expect(page).to have_no_css('.ng-option', text: status.name)
end
end
@@ -262,7 +262,7 @@ RSpec.describe 'filter work packages', :js do
# Do not display already selected values in the autocompleter (Regression #46249)
filters.open_autocompleter list_cf.attribute_name(:camel_case)
- expect(page).not_to have_selector('.ng-option', text: list_cf.custom_options.last.value)
+ expect(page).to have_no_css('.ng-option', text: list_cf.custom_options.last.value)
wp_table.save_as('Some query name')
@@ -487,7 +487,7 @@ RSpec.describe 'filter work packages', :js do
end
it "does not offer attachment filters" do
- expect(page).not_to have_select 'add_filter_select', with_options: ['Attachment content', 'Attachment file name']
+ expect(page).to have_no_select 'add_filter_select', with_options: ['Attachment content', 'Attachment file name']
end
end
diff --git a/spec/features/work_packages/table/queries/id_filter_spec.rb b/spec/features/work_packages/table/queries/id_filter_spec.rb
index 2a9c9cad9f1..ad5681f0c91 100644
--- a/spec/features/work_packages/table/queries/id_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/id_filter_spec.rb
@@ -84,8 +84,8 @@ RSpec.describe 'Work package filtering by id', :js do
it 'can still inline create a new work package (regression #41667)' do
wp_table.click_inline_create
- expect(page).to have_selector('.wp--row', count: 2)
+ expect(page).to have_css('.wp--row', count: 2)
- expect(page).to have_selector('.wp-inline-create-row')
+ expect(page).to have_css('.wp-inline-create-row')
end
end
diff --git a/spec/features/work_packages/table/queries/me_filter_spec.rb b/spec/features/work_packages/table/queries/me_filter_spec.rb
index 11b01fe50ed..4bf19481754 100644
--- a/spec/features/work_packages/table/queries/me_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/me_filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'filter me value', js: true do
+RSpec.describe 'filter me value', :js do
let(:status) { create(:default_status) }
let!(:priority) { create(:default_priority) }
let(:project) do
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 2369dbae78c..628cb1680b7 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
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Refreshing query menu item', js: true do
+RSpec.describe 'Refreshing query menu item', :js do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
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 60a0630ff5b..32c64a99b02 100644
--- a/spec/features/work_packages/table/queries/query_menu_spec.rb
+++ b/spec/features/work_packages/table/queries/query_menu_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Query menu item', js: true do
+RSpec.describe 'Query menu item', :js do
let(:project) { create(:project) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
let(:filters) { Components::WorkPackages::Filters.new }
@@ -62,8 +62,8 @@ RSpec.describe 'Query menu item', js: true do
it 'shows the query menu with queries stored for the global page' do
wp_table.visit!
- expect(page).to have_selector('.op-view-select--search-results')
- expect(page).to have_selector('.op-sidemenu--item-action', wait: 20, minimum: 1)
+ expect(page).to have_css('.op-view-select--search-results')
+ expect(page).to have_css('.op-sidemenu--item-action', wait: 20, minimum: 1)
within '.op-sidebar' do
expect(page)
@@ -71,9 +71,9 @@ RSpec.describe 'Query menu item', js: true do
expect(page)
.to have_content(global_public_view.query.name, wait: 10)
expect(page)
- .not_to have_content(global_other_view.query.name)
+ .to have_no_content(global_other_view.query.name)
expect(page)
- .not_to have_content(project_view.query.name)
+ .to have_no_content(project_view.query.name)
end
end
end
@@ -100,7 +100,7 @@ RSpec.describe 'Query menu item', js: true do
find('.button', text: 'Save').click
- expect(page).to have_selector('.op-sidemenu--item-action', text: 'Some query name', wait: 20)
+ expect(page).to have_css('.op-sidemenu--item-action', text: 'Some query name', wait: 20)
last_query = Query.last
expect(last_query.public).to be_truthy
@@ -117,7 +117,7 @@ RSpec.describe 'Query menu item', js: true do
query_title.rename 'My special query!123'
query_title.expect_title 'My special query!123'
- expect(page).to have_selector('.op-sidemenu--item-action', text: 'My special query!123', wait: 20, count: 1)
+ expect(page).to have_css('.op-sidemenu--item-action', text: 'My special query!123', wait: 20, count: 1)
end
it 'allows filtering, saving, retrieving and altering the saved filter (Regression #25372)' do
diff --git a/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb b/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
index 2199102cb24..19a24079fa7 100644
--- a/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/shared_with_user_filter_spec.rb
@@ -50,7 +50,7 @@ RSpec.describe 'Work package filtering',
end
shared_let(:project_role_with_insufficient_permissions) do
create(:project_role, permissions: %i[view_work_packages
- save_queries])
+ save_queries])
end
shared_let(:work_package_role) do
create(:work_package_role, permissions: %i[view_work_packages])
diff --git a/spec/features/work_packages/table/queries/subject_filter_spec.rb b/spec/features/work_packages/table/queries/subject_filter_spec.rb
index a0b993df90c..d752c73be0a 100644
--- a/spec/features/work_packages/table/queries/subject_filter_spec.rb
+++ b/spec/features/work_packages/table/queries/subject_filter_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package filtering by subject', js: true do
+RSpec.describe 'Work package filtering by subject', :js do
let(:project) { create(:project, public: true) }
let(:admin) { create(:admin) }
let(:wp_table) { Pages::WorkPackagesTable.new(project) }
diff --git a/spec/features/work_packages/table/queries/summary_spec.rb b/spec/features/work_packages/table/queries/summary_spec.rb
index 687ff0a971b..861f64f13a4 100644
--- a/spec/features/work_packages/table/queries/summary_spec.rb
+++ b/spec/features/work_packages/table/queries/summary_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/work_packages/work_packages_page'
-RSpec.describe 'Work package query summary item', js: true do
+RSpec.describe 'Work package query summary item', :js do
let(:project) { create(:project, identifier: 'test_project', public: false) }
let(:role) { create(:project_role, permissions: [:view_work_packages]) }
let(:work_package) { create(:work_package, project:) }
@@ -45,7 +45,7 @@ RSpec.describe 'Work package query summary item', js: true do
it 'allows users to visit the summary page' do
find('.op-sidemenu--item-action', text: 'Summary', wait: 10).click
- expect(page).to have_selector('h2', text: 'Summary')
- expect(page).to have_selector('td', text: work_package.type.name)
+ expect(page).to have_css('h2', text: 'Summary')
+ expect(page).to have_css('td', text: work_package.type.name)
end
end
diff --git a/spec/features/work_packages/table/relations_spec.rb b/spec/features/work_packages/table/relations_spec.rb
index 2c424e4ad8e..567b72dd8de 100644
--- a/spec/features/work_packages/table/relations_spec.rb
+++ b/spec/features/work_packages/table/relations_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Work Package table relations', js: true, with_ee: %i[work_package_query_relation_columns] do
+RSpec.describe 'Work Package table relations', :js, with_ee: %i[work_package_query_relation_columns] do
let(:user) { create(:admin) }
let(:type) { create(:type) }
@@ -57,28 +57,28 @@ RSpec.describe 'Work Package table relations', js: true, with_ee: %i[work_packag
wp_from_to = wp_table.row(wp_to)
# Expect count for wp_from in both columns to be one
- expect(wp_from_row).to have_selector(".#{type_column_id} .wp-table--relation-count", text: '2')
- expect(wp_from_row).to have_selector(".#{type_column_follows} .wp-table--relation-count", text: '2')
+ expect(wp_from_row).to have_css(".#{type_column_id} .wp-table--relation-count", text: '2')
+ expect(wp_from_row).to have_css(".#{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).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")
+ expect(wp_from_to).to have_no_css(".#{type_column_id} .wp-table--relation-count")
+ expect(wp_from_to).to have_no_css(".#{type_column_follows} .wp-table--relation-count")
# Expand first column
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
- expect(page).to have_selector(".__relations-expanded-from-#{wp_from.id}", count: 2)
+ expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)
related_row = page.first(".__relations-expanded-from-#{wp_from.id}")
- expect(related_row).to have_selector('td.wp-table--relation-cell-td', text: "Precedes")
+ expect(related_row).to have_css('td.wp-table--relation-cell-td', text: "Precedes")
# Collapse
wp_from_row.find(".#{type_column_id} .wp-table--relation-indicator").click
- expect(page).not_to have_selector(".__relations-expanded-from-#{wp_from.id}")
+ expect(page).to have_no_css(".__relations-expanded-from-#{wp_from.id}")
# Expand second column
wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
- expect(page).to have_selector(".__relations-expanded-from-#{wp_from.id}", count: 2)
+ expect(page).to have_css(".__relations-expanded-from-#{wp_from.id}", count: 2)
related_row = page.first(".__relations-expanded-from-#{wp_from.id}")
- expect(related_row).to have_selector('.wp-table--relation-cell-td', text: wp_to.type)
+ expect(related_row).to have_css('.wp-table--relation-cell-td', text: wp_to.type)
# Open Timeline
# Should be initially closed
@@ -93,7 +93,7 @@ RSpec.describe 'Work Package table relations', js: true, with_ee: %i[work_packag
# Collapse
wp_from_row.find(".#{type_column_follows} .wp-table--relation-indicator").click
- expect(page).not_to have_selector(".__relations-expanded-from-#{wp_from.id}")
+ expect(page).to have_no_css(".__relations-expanded-from-#{wp_from.id}")
wp_timeline.expect_row_count(3)
end
diff --git a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
index aaf7109e2e4..0e190e3806f 100644
--- a/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
+++ b/spec/features/work_packages/table/scheduling/manual_scheduling_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Manual scheduling', js: true do
+RSpec.describe 'Manual scheduling', :js do
let(:project) { create(:project, types: [type]) }
let(:type) { create(:type) }
@@ -55,20 +55,20 @@ RSpec.describe 'Manual scheduling', js: true do
# Expect not editable
start_date.within_modal do
- expect(page).to have_selector('input[name="startDate"][disabled]')
- expect(page).to have_selector('input[name="endDate"][disabled]')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css('input[name="startDate"][disabled]')
+ expect(page).to have_css('input[name="endDate"][disabled]')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
end
start_date.toggle_scheduling_mode
# Expect editable
start_date.within_modal do
- expect(page).to have_selector('input[name="startDate"]:not([disabled])')
- expect(page).to have_selector('input[name="endDate"]:not([disabled])')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css('input[name="startDate"]:not([disabled])')
+ expect(page).to have_css('input[name="endDate"]:not([disabled])')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
end
start_date.cancel_by_click
@@ -89,10 +89,10 @@ RSpec.describe 'Manual scheduling', js: true do
# Expect not editable
start_date.within_modal do
- expect(page).to have_selector('input[name=startDate][disabled]')
- expect(page).to have_selector('input[name=endDate][disabled]')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
- expect(page).to have_selector("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
+ expect(page).to have_css('input[name=startDate][disabled]')
+ expect(page).to have_css('input[name=endDate][disabled]')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Cancel')
+ expect(page).to have_css("#{test_selector('op-datepicker-modal--action')}:not([disabled])", text: 'Save')
end
start_date.toggle_scheduling_mode
diff --git a/spec/features/work_packages/table/switch_types_spec.rb b/spec/features/work_packages/table/switch_types_spec.rb
index 291f9620107..25741bd9ca3 100644
--- a/spec/features/work_packages/table/switch_types_spec.rb
+++ b/spec/features/work_packages/table/switch_types_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Switching types in work package table', js: true do
+RSpec.describe 'Switching types in work package table', :js do
let(:user) { create(:admin) }
describe 'switching to required CF' do
@@ -131,7 +131,7 @@ RSpec.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).not_to have_selector "#{req_text_field.selector} #{req_text_field.display_selector}"
+ expect(page).to have_no_css "#{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/table/work_packages_table_project_include_spec.rb b/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
index 25a7a613283..9a7f7972564 100644
--- a/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
+++ b/spec/features/work_packages/table/work_packages_table_project_include_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require_relative '../project_include/project_include_shared_examples'
-RSpec.describe 'Work package project include', js: true do
+RSpec.describe 'Work package project include', :js do
shared_let(:enabled_modules) { %w[work_package_tracking] }
shared_let(:status) { create(:default_status) }
shared_let(:priority) { create(:default_priority) }
diff --git a/spec/features/work_packages/tabs/activity_notifications_spec.rb b/spec/features/work_packages/tabs/activity_notifications_spec.rb
index 5108ff3084e..6b215238443 100644
--- a/spec/features/work_packages/tabs/activity_notifications_spec.rb
+++ b/spec/features/work_packages/tabs/activity_notifications_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
require 'features/work_packages/work_packages_page'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Activity tab notifications', js: true, selenium: true do
+RSpec.describe 'Activity tab notifications', :js, :selenium do
shared_let(:project) { create(:project_with_types, public: true) }
shared_let(:work_package) do
create(:work_package,
@@ -31,7 +31,7 @@ RSpec.describe 'Activity tab notifications', js: true, selenium: true do
it 'shows a notification icon next to activities that have an unread notification' do
expect(page).to have_test_selector('user-activity-bubble', count: 1)
- expect(page).to have_selector("[data-qa-activity-number='4'] #{test_selector('user-activity-bubble')}")
+ expect(page).to have_css("[data-qa-activity-number='4'] #{test_selector('user-activity-bubble')}")
end
it 'shows a button to mark the notifications as read' do
diff --git a/spec/features/work_packages/tabs/activity_revisions_spec.rb b/spec/features/work_packages/tabs/activity_revisions_spec.rb
index 8c0a0bd2c96..065fce23759 100644
--- a/spec/features/work_packages/tabs/activity_revisions_spec.rb
+++ b/spec/features/work_packages/tabs/activity_revisions_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
require 'features/work_packages/work_packages_page'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Activity tab', js: true, with_cuprite: true do
+RSpec.describe 'Activity tab', :js, :with_cuprite do
let(:project) { create(:project_with_types, public: true) }
let(:creation_time) { 5.days.ago }
@@ -86,17 +86,17 @@ RSpec.describe 'Activity tab', js: true, with_cuprite: true do
activity = page.find("#activity-#{idx + 1}")
if activity.is_a?(Journal) && activity.id != subject_change_journal.id
- expect(activity).to have_selector('.user', text: activity.user.name)
- expect(activity).to have_selector('.user-comment > .message', text: activity.notes, visible: :all)
+ expect(activity).to have_css('.user', text: activity.user.name)
+ expect(activity).to have_css('.user-comment > .message', text: activity.notes, visible: :all)
elsif activity.is_a?(Changeset)
- expect(activity).to have_selector('.user', text: User.find(activity.user_id).name)
- expect(activity).to have_selector('.user-comment > .message', text: activity.notes, visible: :all)
+ expect(activity).to have_css('.user', text: User.find(activity.user_id).name)
+ expect(activity).to have_css('.user-comment > .message', text: activity.notes, visible: :all)
elsif activity == subject_change_journal
- expect(activity).to have_selector('.work-package-details-activities-messages .message',
- count: 2)
- expect(activity).to have_selector('.message',
- text: "Subject changed from #{initial_subject} " \
- "to #{activity.data.subject}")
+ expect(activity).to have_css('.work-package-details-activities-messages .message',
+ count: 2)
+ expect(activity).to have_css('.message',
+ text: "Subject changed from #{initial_subject} " \
+ "to #{activity.data.subject}")
end
end
end
@@ -111,8 +111,8 @@ RSpec.describe 'Activity tab', js: true, with_cuprite: true do
context 'with permission' do
let(:role) do
create(:project_role, permissions: %i[view_work_packages
- view_changesets
- add_work_package_notes])
+ view_changesets
+ add_work_package_notes])
end
let(:user) do
create(:user,
@@ -135,20 +135,20 @@ RSpec.describe 'Activity tab', js: true, with_cuprite: true do
end
it 'can toggle between activities and comments-only' do
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 4)
- expect(page).to have_selector('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 4)
+ expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
# Show only comments
find('.activity-comments--toggler').click
# It should remove the middle
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 2)
- expect(page).to have_selector('.user-comment > .message', text: initial_comment)
- expect(page).to have_selector('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 2)
+ expect(page).to have_css('.user-comment > .message', text: initial_comment)
+ expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
# Show all again
find('.activity-comments--toggler').click
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 4)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 4)
end
it 'can quote a previous comment' do
@@ -162,19 +162,19 @@ RSpec.describe 'Activity tab', js: true, with_cuprite: true do
# Add our comment
editor = find('.ck-content')
- expect(editor).to have_selector('blockquote', text: initial_comment)
+ expect(editor).to have_css('blockquote', text: initial_comment)
editor.base.send_keys "\nthis is some remark under a quote"
field.submit_by_click
- expect(page).to have_selector('.user-comment > .message', count: 3)
- expect(page).to have_selector('.user-comment > .message blockquote')
+ expect(page).to have_css('.user-comment > .message', count: 3)
+ expect(page).to have_css('.user-comment > .message blockquote')
end
it 'can reference a changeset (Regression #30415)' do
work_package_page.visit_tab! 'activity'
work_package_page.ensure_page_loaded
- expect(page).to have_selector('.user-comment > .message', text: initial_comment)
+ expect(page).to have_css('.user-comment > .message', text: initial_comment)
comment_field = TextEditorField.new work_package_page,
'comment',
@@ -207,7 +207,7 @@ RSpec.describe 'Activity tab', js: true, with_cuprite: true do
end
it 'shows the activities, but does not allow commenting' do
- expect(page).not_to have_selector('.work-packages--activity--add-comment', visible: :visible)
+ expect(page).to have_no_css('.work-packages--activity--add-comment', visible: :visible)
end
end
end
diff --git a/spec/features/work_packages/tabs/activity_tab_spec.rb b/spec/features/work_packages/tabs/activity_tab_spec.rb
index 272fc987c18..a56ad88a847 100644
--- a/spec/features/work_packages/tabs/activity_tab_spec.rb
+++ b/spec/features/work_packages/tabs/activity_tab_spec.rb
@@ -31,9 +31,7 @@ require 'spec_helper'
require 'features/work_packages/work_packages_page'
require 'support/edit_fields/edit_field'
-RSpec.describe 'Activity tab',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Activity tab', :js, :with_cuprite do
let(:project) do
create(:project_with_types,
types: [type_with_cf],
@@ -112,16 +110,16 @@ RSpec.describe 'Activity tab',
activity = page.find("#activity-#{idx + 1}")
if journal.id != subject_change_journal.id
- expect(activity).to have_selector('.op-user-activity--user-line', text: journal.user.name)
- expect(activity).to have_selector('.user-comment > .message', text: journal.notes, visible: :all)
+ expect(activity).to have_css('.op-user-activity--user-line', text: journal.user.name)
+ expect(activity).to have_css('.user-comment > .message', text: journal.notes, visible: :all)
end
if activity == subject_change_journal
- expect(activity).to have_selector('.work-package-details-activities-messages .message',
- count: 2)
- expect(activity).to have_selector('.message',
- text: "Subject changed from #{initial_subject} " \
- "to #{journal.data.subject}")
+ expect(activity).to have_css('.work-package-details-activities-messages .message',
+ count: 2)
+ expect(activity).to have_css('.message',
+ text: "Subject changed from #{initial_subject} " \
+ "to #{journal.data.subject}")
end
end
end
@@ -131,8 +129,8 @@ RSpec.describe 'Activity tab',
before do
work_package_page.visit_tab! 'activity'
work_package_page.ensure_page_loaded
- expect(page).to have_selector('.user-comment > .message',
- text: initial_comment)
+ expect(page).to have_css('.user-comment > .message',
+ text: initial_comment)
end
context 'with permission' do
@@ -160,27 +158,27 @@ RSpec.describe 'Activity tab',
visit "/work_packages/#{work_package.id}/activity#activity-#{comment_journal.id}"
work_package_page.ensure_page_loaded
- expect(page).to have_selector('.user-comment > .message',
- text: initial_comment)
+ expect(page).to have_css('.user-comment > .message',
+ text: initial_comment)
expect(page.current_url).to match /\/work_packages\/#{work_package.id}\/activity#activity-#{comment_journal.id}/
end
it 'can toggle between activities and comments-only' do
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 3)
- expect(page).to have_selector('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 3)
+ expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
# Show only comments
find('.activity-comments--toggler').click
# It should remove the middle
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 2)
- expect(page).to have_selector('.user-comment > .message', text: initial_comment)
- expect(page).to have_selector('.user-comment > .message', text: comment_journal.notes)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 2)
+ expect(page).to have_css('.user-comment > .message', text: initial_comment)
+ expect(page).to have_css('.user-comment > .message', text: comment_journal.notes)
# Show all again
find('.activity-comments--toggler').click
- expect(page).to have_selector('.work-package-details-activities-activity-contents', count: 3)
+ expect(page).to have_css('.work-package-details-activities-activity-contents', count: 3)
end
it 'can quote a previous comment' do
@@ -198,8 +196,8 @@ RSpec.describe 'Activity tab',
field.input_element.base.send_keys "\nthis is some remark under a quote"
field.submit_by_click
- expect(page).to have_selector('.user-comment > .message', count: 3)
- expect(page).to have_selector('.user-comment > .message blockquote')
+ expect(page).to have_css('.user-comment > .message', count: 3)
+ expect(page).to have_css('.user-comment > .message blockquote')
end
it 'can render checkboxes as part of the activity' do
@@ -222,7 +220,7 @@ RSpec.describe 'Activity tab',
end
it 'shows the activities, but does not allow commenting' do
- expect(page).not_to have_selector('.work-packages--activity--add-comment', visible: :visible)
+ expect(page).to have_no_css('.work-packages--activity--add-comment', visible: :visible)
end
end
end
diff --git a/spec/features/work_packages/tabs/keep_tab_spec.rb b/spec/features/work_packages/tabs/keep_tab_spec.rb
index 34bc2f1f088..d30cd8d60df 100644
--- a/spec/features/work_packages/tabs/keep_tab_spec.rb
+++ b/spec/features/work_packages/tabs/keep_tab_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Keep current details tab', js: true, selenium: true do
+RSpec.describe 'Keep current details tab', :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let!(:wp1) { create(:work_package, project:) }
diff --git a/spec/features/work_packages/tabs/watcher_tab_spec.rb b/spec/features/work_packages/tabs/watcher_tab_spec.rb
index 0d83ddee749..cfb1aa0e689 100644
--- a/spec/features/work_packages/tabs/watcher_tab_spec.rb
+++ b/spec/features/work_packages/tabs/watcher_tab_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Watcher tab', js: true, selenium: true do
+RSpec.describe 'Watcher tab', :js, :selenium do
include Components::Autocompleter::NgSelectAutocompleteHelpers
let(:project) { create(:project) }
@@ -20,14 +20,14 @@ RSpec.describe 'Watcher tab', js: true, selenium: true do
def expect_button_is_watching
title = I18n.t('js.label_unwatch_work_package')
- expect(page).to have_selector("#unwatch-button[title='#{title}']", wait: 10)
- expect(page).to have_selector('#unwatch-button .button--icon.icon-watched', wait: 10)
+ expect(page).to have_css("#unwatch-button[title='#{title}']", wait: 10)
+ expect(page).to have_css('#unwatch-button .button--icon.icon-watched', wait: 10)
end
def expect_button_is_not_watching
title = I18n.t('js.label_watch_work_package')
- expect(page).to have_selector("#watch-button[title='#{title}']")
- expect(page).to have_selector('#watch-button .button--icon.icon-unwatched')
+ expect(page).to have_css("#watch-button[title='#{title}']")
+ expect(page).to have_css('#watch-button .button--icon.icon-unwatched')
end
shared_examples 'watch and unwatch with button' do
@@ -53,7 +53,7 @@ RSpec.describe 'Watcher tab', js: true, selenium: true do
login_as(user)
wp_page.visit_tab! :watchers
expect_angular_frontend_initialized
- expect(page).to have_selector('.op-tab-row--link_selected', text: 'WATCHERS')
+ expect(page).to have_css('.op-tab-row--link_selected', text: 'WATCHERS')
end
it 'modifying the watcher list modifies the watch button' do
@@ -97,8 +97,8 @@ RSpec.describe 'Watcher tab', js: true, selenium: true do
query: 'foo',
results_selector: 'body'
- expect(target_dropdown).to have_selector(".ng-option", text: html_user.firstname)
- expect(target_dropdown).not_to have_selector(".ng-option em")
+ expect(target_dropdown).to have_css(".ng-option", text: html_user.firstname)
+ expect(target_dropdown).to have_no_css(".ng-option em")
end
end
@@ -157,8 +157,8 @@ RSpec.describe 'Watcher tab', js: true, selenium: true do
query: '',
results_selector: 'body'
- expect(target_dropdown).to have_selector(".ng-option", text: user.name)
- expect(target_dropdown).not_to have_selector(".ng-option", text: placeholder.name)
+ expect(target_dropdown).to have_css(".ng-option", text: user.name)
+ expect(target_dropdown).to have_no_css(".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 ffe1d464021..af4edd746d9 100644
--- a/spec/features/work_packages/timeline/timeline_dates_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_dates_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline date formatting',
- js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Work package timeline date formatting', :js, :selenium, 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') }
@@ -151,8 +150,8 @@ RSpec.describe 'Work package timeline date formatting',
let(:current_user) { create(:admin) }
it 'shows english ISO dates' do
- expect(page).to have_selector('.wp-timeline--header-element', text: '01')
- expect(page).to have_selector('.wp-timeline--header-element', text: '02')
+ expect(page).to have_css('.wp-timeline--header-element', text: '01')
+ expect(page).to have_css('.wp-timeline--header-element', text: '02')
# The last weekday determines whether there are 52 or 53 weeks
# Only if the last day in the year is exactly the day before the day configured to be
@@ -165,7 +164,7 @@ RSpec.describe 'Work package timeline date formatting',
end
expect(page).to have_css('.wp-timeline--header-element', text: number_of_weeks)
- expect(page).not_to have_css('.wp-timeline--header-element', text: number_of_weeks + 1)
+ expect(page).to have_no_css('.wp-timeline--header-element', text: number_of_weeks + 1)
# expect moment to return week 01 for start date and due date
expect_date_week work_package.start_date.iso8601, '01'
diff --git a/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb b/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
index 1c89a72de9b..80ced03b791 100644
--- a/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_hierarchy_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline hierarchies', js: true, selenium: true do
+RSpec.describe 'Work package timeline hierarchies', :js, :selenium do
let(:user) { create(:admin) }
let!(:wp_root) do
create(:work_package,
@@ -82,7 +82,7 @@ RSpec.describe 'Work package timeline hierarchies', js: true, selenium: true do
wp_timeline.expect_hidden_row(wp_leaf)
# Should now have exactly two rows (one in each split view)
- expect(page).to have_selector('.wp--row', count: 2)
+ expect(page).to have_css('.wp--row', count: 2)
end
context 'with a relation being rendered to a hidden row' do
diff --git a/spec/features/work_packages/timeline/timeline_labels_spec.rb b/spec/features/work_packages/timeline/timeline_labels_spec.rb
index be3f14ddc1e..037a8d6e075 100644
--- a/spec/features/work_packages/timeline/timeline_labels_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_labels_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline labels',
- js: true, selenium: true, with_settings: { date_format: '%Y-%m-%d' } do
+RSpec.describe 'Work package timeline labels', :js, :selenium, 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/timeline/timeline_navigation_spec.rb b/spec/features/work_packages/timeline/timeline_navigation_spec.rb
index fc750adbfbf..3929fb18a3b 100644
--- a/spec/features/work_packages/timeline/timeline_navigation_spec.rb
+++ b/spec/features/work_packages/timeline/timeline_navigation_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Work package timeline navigation', js: true, selenium: true do
+RSpec.describe 'Work package timeline navigation', :js, :selenium do
let(:user) { create(:admin) }
let(:project) { create(:project) }
let(:query_menu) { Components::WorkPackages::QueryMenu.new }
@@ -282,7 +282,7 @@ RSpec.describe 'Work package timeline navigation', js: true, selenium: true do
group_by.enable_via_menu 'Category'
# Expect table to be grouped as WP created above
- expect(page).to have_selector('.group--value .count', count: 3)
+ expect(page).to have_css('.group--value .count', count: 3)
# Expect timeline to have relation between first and second group
wp_timeline.expect_timeline_relation(wp_cat1, wp_cat2)
@@ -325,7 +325,7 @@ RSpec.describe 'Work package timeline navigation', js: true, selenium: true do
# The button to fold/expand all groups is only present when grouping
expect(page)
- .not_to have_button('wp-fold-toggle-button')
+ .to have_no_button('wp-fold-toggle-button')
group_by.enable_via_menu 'Project'
@@ -335,30 +335,30 @@ RSpec.describe 'Work package timeline navigation', js: true, selenium: true do
.click
# Folding will lead to having milestones presented within the group row
- expect(page).to have_selector('.-group-row .timeline-element.milestone')
+ expect(page).to have_css('.-group-row .timeline-element.milestone')
# Check hover labels (milestone)
milestone = find('.timeline-element.milestone')
milestone.hover
- expect(milestone).to have_selector(".labelHoverLeft.not-empty")
- expect(milestone).to have_selector(".labelHoverRight.not-empty", text: milestone_work_package.subject)
- expect(milestone).to have_selector(".labelLeft", visible: :hidden)
- expect(milestone).to have_selector(".labelRight", visible: :hidden)
- expect(milestone).to have_selector(".labelFarRight", visible: :hidden)
+ expect(milestone).to have_css(".labelHoverLeft.not-empty")
+ expect(milestone).to have_css(".labelHoverRight.not-empty", text: milestone_work_package.subject)
+ expect(milestone).to have_css(".labelLeft", visible: :hidden)
+ expect(milestone).to have_css(".labelRight", visible: :hidden)
+ expect(milestone).to have_css(".labelFarRight", visible: :hidden)
# Unfold Group rows
find('.wp-table--group-header', text: 'My Project No.')
.find('.expander')
.click
- expect(page).not_to have_selector('.-group-row .timeline-element')
+ expect(page).to have_no_css('.-group-row .timeline-element')
click_button('wp-fold-toggle-button')
click_button(I18n.t('js.button_collapse_all'))
# Will again fold all rows so the milestone elements should again be present
- expect(page).to have_selector('.-group-row .timeline-element.milestone')
+ expect(page).to have_css('.-group-row .timeline-element.milestone')
end
end
end
diff --git a/spec/features/work_packages/work_package_workflow_form_spec.rb b/spec/features/work_packages/work_package_workflow_form_spec.rb
index 2d348c90be0..7fa55e6d174 100644
--- a/spec/features/work_packages/work_package_workflow_form_spec.rb
+++ b/spec/features/work_packages/work_package_workflow_form_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
require 'features/page_objects/notification'
-RSpec.describe 'Work package transitive status workflows', js: true do
+RSpec.describe 'Work package transitive status workflows', :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
diff --git a/spec/features/work_packages/work_packages_page.rb b/spec/features/work_packages/work_packages_page.rb
index 8690cdc9e28..ad379239792 100644
--- a/spec/features/work_packages/work_packages_page.rb
+++ b/spec/features/work_packages/work_packages_page.rb
@@ -107,7 +107,7 @@ class WorkPackagesPage
def ensure_index_page_loaded
if Capybara.current_driver == Capybara.javascript_driver
- expect(page).to have_selector('.work-packages--filters-optional-container.-loaded', visible: :all, wait: 20)
+ expect(page).to have_css('.work-packages--filters-optional-container.-loaded', visible: :all, wait: 20)
end
end
end
diff --git a/spec/features/work_packages/zen_mode_spec.rb b/spec/features/work_packages/zen_mode_spec.rb
index abc0a7fe115..99a02e65e5d 100644
--- a/spec/features/work_packages/zen_mode_spec.rb
+++ b/spec/features/work_packages/zen_mode_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-RSpec.describe 'Zen mode', js: true do
+RSpec.describe 'Zen mode', :js do
let(:dev_role) do
create(:project_role,
permissions: %i[view_work_packages
diff --git a/spec/features/workflows/missing_for_sharing_wp_spec.rb b/spec/features/workflows/missing_for_sharing_wp_spec.rb
index 50805a69ed7..0af19fb1e91 100644
--- a/spec/features/workflows/missing_for_sharing_wp_spec.rb
+++ b/spec/features/workflows/missing_for_sharing_wp_spec.rb
@@ -82,6 +82,6 @@ RSpec.describe 'Configuring the workflow for work package sharing',
assignee: false).count).to eq(1)
expect(page)
- .not_to have_css('.warning-bar--item')
+ .to have_no_css('.warning-bar--item')
end
end
diff --git a/spec/features/wysiwyg/bold_behavior_spec.rb b/spec/features/wysiwyg/bold_behavior_spec.rb
index 81605aa2e57..21ce519e9de 100644
--- a/spec/features/wysiwyg/bold_behavior_spec.rb
+++ b/spec/features/wysiwyg/bold_behavior_spec.rb
@@ -28,9 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg bold behavior',
- js: true,
- with_cuprite: true do
+RSpec.describe 'Wysiwyg bold behavior', :js, :with_cuprite do
current_user { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
@@ -60,13 +58,13 @@ RSpec.describe 'Wysiwyg bold behavior',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('p') { |node|
+ expect(page).to have_css('p') { |node|
node.text.include?('some text') && node.text.include?('with bold')
}
- expect(page).to have_selector('strong', text: 'with bold')
+ expect(page).to have_css('strong', text: 'with bold')
end
end
end
diff --git a/spec/features/wysiwyg/custom_css_classes_spec.rb b/spec/features/wysiwyg/custom_css_classes_spec.rb
index 49f77cfedd6..3b94f2db08c 100644
--- a/spec/features/wysiwyg/custom_css_classes_spec.rb
+++ b/spec/features/wysiwyg/custom_css_classes_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)',
- js: true do
+RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -159,17 +158,17 @@ RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)',
editor.align_table_by_label(editor, table, 'Align table to the left')
# Table figure should now has the proper alignment class
- expect(editable).to have_selector('figure.op-uc-figure_align-start')
+ expect(editable).to have_css('figure.op-uc-figure_align-start')
editor.align_table_by_label(editor, table, 'Align table to the right')
# Table figure should now has the proper alignment class
- expect(editable).to have_selector('figure.op-uc-figure_align-end')
+ expect(editable).to have_css('figure.op-uc-figure_align-end')
editor.align_table_by_label(editor, table, 'Center table')
# Table figure should now has the proper alignment class
- expect(editable).to have_selector('figure.op-uc-figure_align-center')
+ expect(editable).to have_css('figure.op-uc-figure_align-center')
end
end
end
diff --git a/spec/features/wysiwyg/html_encoding_spec.rb b/spec/features/wysiwyg/html_encoding_spec.rb
index 7f6a6df1f2f..26c1786d9ec 100644
--- a/spec/features/wysiwyg/html_encoding_spec.rb
+++ b/spec/features/wysiwyg/html_encoding_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg escaping HTML entities (Regression #28906)',
- js: true do
+RSpec.describe 'Wysiwyg escaping HTML entities (Regression #28906)', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -45,19 +44,19 @@ RSpec.describe 'Wysiwyg escaping HTML entities (Regression #28906)',
:enter,
'\<u>foo\</u>'
- expect(editable).not_to have_selector('node')
- expect(editable).not_to have_selector('u')
+ expect(editable).to have_no_css('node')
+ expect(editable).to have_no_css('u')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('p', text: '<node foo="bar" />')
- expect(page).not_to have_selector('u')
- expect(page).not_to have_selector('node')
+ expect(page).to have_css('p', text: '<node foo="bar" />')
+ expect(page).to have_no_css('u')
+ expect(page).to have_no_css('node')
end
text = WikiPage.last.text
diff --git a/spec/features/wysiwyg/linking_spec.rb b/spec/features/wysiwyg/linking_spec.rb
index de88c8ebef8..4d8265091e8 100644
--- a/spec/features/wysiwyg/linking_spec.rb
+++ b/spec/features/wysiwyg/linking_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg linking',
- js: true do
+RSpec.describe 'Wysiwyg linking', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki work_package_tracking]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -50,7 +49,7 @@ RSpec.describe 'Wysiwyg linking',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
wiki_page = project.wiki.pages.first.reload
@@ -58,7 +57,7 @@ RSpec.describe 'Wysiwyg linking',
"[http://example.org/link with spaces](http://example.org/link%20with%20spaces)"
)
- expect(page).to have_selector('a[href="http://example.org/link%20with%20spaces"]')
+ expect(page).to have_css('a[href="http://example.org/link%20with%20spaces"]')
end
end
end
diff --git a/spec/features/wysiwyg/macros/attribute_macros_spec.rb b/spec/features/wysiwyg/macros/attribute_macros_spec.rb
index 081896efe5c..0a054b9f4e5 100644
--- a/spec/features/wysiwyg/macros/attribute_macros_spec.rb
+++ b/spec/features/wysiwyg/macros/attribute_macros_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg attribute macros', js: true do
+RSpec.describe 'Wysiwyg attribute macros', :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
let!(:project) { create(:project, identifier: 'some-project', enabled_module_names: %w[wiki work_package_tracking]) }
@@ -81,24 +81,24 @@ RSpec.describe 'Wysiwyg attribute macros', js: true do
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
# Expect output widget
within('#content') do
- expect(page).to have_selector('td', text: 'Subject')
- expect(page).to have_selector('td', text: 'Foo Bar')
- expect(page).to have_selector('td', text: 'Identifier')
- expect(page).to have_selector('td', text: 'some-project')
+ expect(page).to have_css('td', text: 'Subject')
+ expect(page).to have_css('td', text: 'Foo Bar')
+ expect(page).to have_css('td', text: 'Identifier')
+ expect(page).to have_css('td', text: 'some-project')
- expect(page).to have_selector('td', text: 'invalid subject Cannot expand macro: Requested resource could not be found')
- expect(page).to have_selector('td', text: 'invalid project Cannot expand macro: Requested resource could not be found')
+ expect(page).to have_css('td', text: 'invalid subject Cannot expand macro: Requested resource could not be found')
+ expect(page).to have_css('td', text: 'invalid project Cannot expand macro: Requested resource could not be found')
end
# Edit page again
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('tbody td', count: 6)
+ expect(container).to have_css('tbody td', count: 6)
end
end
@@ -134,10 +134,10 @@ RSpec.describe 'Wysiwyg attribute macros', js: true do
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('.custom-option', count: 6)
+ expect(page).to have_css('.custom-option', count: 6)
end
end
end
diff --git a/spec/features/wysiwyg/macros/child_pages_spec.rb b/spec/features/wysiwyg/macros/child_pages_spec.rb
index 5930b90a0fa..e3b0fcc56fd 100644
--- a/spec/features/wysiwyg/macros/child_pages_spec.rb
+++ b/spec/features/wysiwyg/macros/child_pages_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg child pages spec',
- js: true do
+RSpec.describe 'Wysiwyg child pages spec', :js do
let(:project) do
create(:project,
enabled_module_names: %w[wiki])
@@ -67,9 +66,6 @@ RSpec.describe 'Wysiwyg child pages spec',
child_page.parent = parent_page
child_page.save!
project.wiki.save!
- end
-
- before do
login_as(user)
end
@@ -81,7 +77,7 @@ RSpec.describe 'Wysiwyg child pages spec',
it 'can add and edit an child pages widget' do
editor.in_editor do |_container, editable|
- expect(editable).to have_selector('h1', text: 'My page')
+ expect(editable).to have_css('h1', text: 'My page')
editor.insert_macro 'Links to child pages'
@@ -90,19 +86,19 @@ RSpec.describe 'Wysiwyg child pages spec',
# Placeholder states `this page` and no `Include parent`
expect(placeholder).to have_text('this page')
- expect(placeholder).not_to have_text('Include parent')
+ expect(placeholder).to have_no_text('Include parent')
# Edit widget and cancel again
placeholder.click
page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
expect(page).to have_field('selected-page', with: '')
find('.spot-modal--cancel-button').click
# Edit widget and save
placeholder.click
page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
fill_in 'selected-page', with: 'parent-page'
# Save widget
@@ -110,19 +106,19 @@ RSpec.describe 'Wysiwyg child pages spec',
# Placeholder states `parent-page` and no `Include parent`
expect(placeholder).to have_text('parent-page')
- expect(placeholder).not_to have_text('Include parent')
+ expect(placeholder).to have_no_text('Include parent')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('.pages-hierarchy')
- expect(page).to have_selector('.pages-hierarchy', text: 'Child page')
- expect(page).not_to have_selector('.pages-hierarchy', text: 'Parent page')
- expect(page).to have_selector('h1', text: 'My page')
+ expect(page).to have_css('.pages-hierarchy')
+ expect(page).to have_css('.pages-hierarchy', text: 'Child page')
+ expect(page).to have_no_css('.pages-hierarchy', text: 'Parent page')
+ expect(page).to have_css('h1', text: 'My page')
SeleniumHubWaiter.wait
find('.toolbar .icon-edit').click
@@ -135,7 +131,7 @@ RSpec.describe 'Wysiwyg child pages spec',
# Edit widget and save
placeholder.click
page.find('.ck-balloon-panel .ck-button', visible: :all, text: 'Edit').click
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
page.check 'include-parent'
# Save widget
@@ -149,13 +145,13 @@ RSpec.describe 'Wysiwyg child pages spec',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('.pages-hierarchy')
- expect(page).to have_selector('.pages-hierarchy', text: 'Child page')
- expect(page).to have_selector('.pages-hierarchy', text: 'Parent page')
- expect(page).to have_selector('h1', text: 'My page')
+ expect(page).to have_css('.pages-hierarchy')
+ expect(page).to have_css('.pages-hierarchy', text: 'Child page')
+ expect(page).to have_css('.pages-hierarchy', text: 'Parent page')
+ expect(page).to have_css('h1', text: 'My page')
SeleniumHubWaiter.wait
find('.toolbar .icon-edit').click
diff --git a/spec/features/wysiwyg/macros/code_block_macro_spec.rb b/spec/features/wysiwyg/macros/code_block_macro_spec.rb
index bf4bc0bda39..3decdad4dbd 100644
--- a/spec/features/wysiwyg/macros/code_block_macro_spec.rb
+++ b/spec/features/wysiwyg/macros/code_block_macro_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg code block macro',
- js: true do
+RSpec.describe 'Wysiwyg code block macro', :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
@@ -66,20 +65,20 @@ RSpec.describe 'Wysiwyg code block macro',
editor.set_markdown expected
# Expect first macro saved to editor
- expect(container).to have_selector('.op-uc-code-block', text: snippet)
- expect(container).to have_selector('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css('.op-uc-code-block', text: snippet)
+ expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
editor.set_markdown "#{expected}\n#{expected}"
- expect(container).to have_selector('.op-uc-code-block', text: snippet, count: 2)
- expect(container).to have_selector('.op-uc-code-block--language', text: 'ruby', count: 2)
+ expect(container).to have_css('.op-uc-code-block', text: snippet, count: 2)
+ expect(container).to have_css('.op-uc-code-block--language', text: 'ruby', count: 2)
end
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
# Expect output widget
within('#content') do
- expect(page).to have_selector('pre.highlight-ruby', count: 2)
+ expect(page).to have_css('pre.highlight-ruby', count: 2)
end
SeleniumHubWaiter.wait
@@ -88,8 +87,8 @@ RSpec.describe 'Wysiwyg code block macro',
# SeleniumHubWaiter.wait
editor.in_editor do |container,|
- expect(container).to have_selector('.op-uc-code-block', text: snippet, count: 2)
- expect(container).to have_selector('.op-uc-code-block--language', text: 'ruby', count: 2)
+ expect(container).to have_css('.op-uc-code-block', text: snippet, count: 2)
+ expect(container).to have_css('.op-uc-code-block--language', text: 'ruby', count: 2)
end
end
@@ -97,17 +96,17 @@ RSpec.describe 'Wysiwyg code block macro',
editor.in_editor do |container,|
editor.click_toolbar_button 'Insert code snippet'
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
# CM wraps an accessor to the editor instance on the outer container
cm = page.find('.CodeMirror')
page.execute_script('arguments[0].CodeMirror.setValue(arguments[1]);', cm.native, 'asdf')
find('.spot-modal--submit-button').click
- expect(container).to have_selector('.op-uc-code-block', text: 'asdf')
+ expect(container).to have_css('.op-uc-code-block', text: 'asdf')
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
wp = WikiPage.last
expect(wp.text.gsub("\r\n", "\n")).to eq("```text\nasdf\n```")
@@ -116,11 +115,11 @@ RSpec.describe 'Wysiwyg code block macro',
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('.op-uc-code-block', text: 'asdf')
+ expect(container).to have_css('.op-uc-code-block', text: 'asdf')
end
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
wp.reload
# Regression added two newlines before fence here
@@ -132,7 +131,7 @@ RSpec.describe 'Wysiwyg code block macro',
editor.in_editor do |container,|
editor.click_toolbar_button 'Insert code snippet'
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
# CM wraps an accessor to the editor instance on the outer container
cm = page.find('.CodeMirror')
@@ -141,20 +140,20 @@ RSpec.describe 'Wysiwyg code block macro',
fill_in 'selected-language', with: 'ruby'
# Expect some highlighting classes
- expect(page).to have_selector('.cm-keyword', text: 'def')
- expect(page).to have_selector('.cm-def', text: 'foobar')
+ expect(page).to have_css('.cm-keyword', text: 'def')
+ expect(page).to have_css('.cm-def', text: 'foobar')
find('.spot-modal--submit-button').click
# Expect macro saved to editor
- expect(container).to have_selector('.op-uc-code-block', text: snippet)
- expect(container).to have_selector('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css('.op-uc-code-block', text: snippet)
+ expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
wiki_page = project.wiki.find_page('wiki')
text = wiki_page.text.gsub(/\r\n?/, "\n")
@@ -162,7 +161,7 @@ RSpec.describe 'Wysiwyg code block macro',
# Expect output widget
within('#content') do
- expect(page).to have_selector('pre.highlight-ruby')
+ expect(page).to have_css('pre.highlight-ruby')
end
# Edit page again, expect widget
@@ -170,16 +169,16 @@ RSpec.describe 'Wysiwyg code block macro',
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('.op-uc-code-block', text: snippet)
- expect(container).to have_selector('.op-uc-code-block--language', text: 'ruby')
+ expect(container).to have_css('.op-uc-code-block', text: snippet)
+ expect(container).to have_css('.op-uc-code-block--language', text: 'ruby')
widget = container.find('.op-uc-code-block')
page.driver.browser.action.double_click(widget.native).perform
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
- expect(page).to have_selector('.op-uc-code-block--language', text: 'ruby')
- expect(page).to have_selector('.cm-keyword', text: 'def')
- expect(page).to have_selector('.cm-def', text: 'foobar')
+ expect(page).to have_css('.op-uc-code-block--language', text: 'ruby')
+ expect(page).to have_css('.cm-keyword', text: 'def')
+ expect(page).to have_css('.cm-def', text: 'foobar')
end
end
end
diff --git a/spec/features/wysiwyg/macros/embedded_tables_spec.rb b/spec/features/wysiwyg/macros/embedded_tables_spec.rb
index f3fd8c0db4c..f02d503dad4 100644
--- a/spec/features/wysiwyg/macros/embedded_tables_spec.rb
+++ b/spec/features/wysiwyg/macros/embedded_tables_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg embedded work package tables',
- js: true do
+RSpec.describe 'Wysiwyg embedded work package tables', :js do
shared_let(:admin) { create(:admin) }
shared_let(:type_task) { create(:type_task) }
shared_let(:type_bug) { create(:type_bug) }
@@ -106,7 +105,7 @@ RSpec.describe 'Wysiwyg embedded work package tables',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
embedded_table = Pages::EmbeddedWorkPackagesTable.new find('.wiki-content')
embedded_table.expect_work_package_listed wp_task
@@ -142,7 +141,7 @@ RSpec.describe 'Wysiwyg embedded work package tables',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
# Embedded queries
wikipage = project.wiki.pages.last
@@ -167,7 +166,7 @@ RSpec.describe 'Wysiwyg embedded work package tables',
# Subproject filter is gone
filters.expect_filter_count 2
- expect(page).not_to have_text 'Subproject'
+ expect(page).to have_no_text 'Subproject'
end
end
end
diff --git a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
index 257b5d4e590..58919f33de3 100644
--- a/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
+++ b/spec/features/wysiwyg/macros/quicklink_macros_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg work package quicklink macros', js: true do
+RSpec.describe 'Wysiwyg work package quicklink macros', :js do
shared_let(:user) { create(:admin) }
shared_let(:project) { create(:project_with_types) }
let(:work_package) do
@@ -53,14 +53,14 @@ RSpec.describe 'Wysiwyg work package quicklink macros', js: true do
# Expect output widget
within('#content') do
expect(page).to have_link("##{work_package.id}")
- expect(page).not_to have_selector('.work-package--quickinfo.preview-trigger')
+ expect(page).to have_no_css('.work-package--quickinfo.preview-trigger')
end
# Edit page again
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('p', text: "##{work_package.id}")
+ expect(container).to have_css('p', text: "##{work_package.id}")
end
end
@@ -71,17 +71,17 @@ RSpec.describe 'Wysiwyg work package quicklink macros', js: true do
# Expect output widget
within('#content') do
expected_macro_text = "#{work_package.type.name.upcase} ##{work_package.id}: My subject"
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: expected_macro_text)
- expect(page).to have_selector('span', text: work_package.type.name.upcase)
- expect(page).to have_selector('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
- expect(page).to have_selector('span', text: 'My subject')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: expected_macro_text)
+ expect(page).to have_css('span', text: work_package.type.name.upcase)
+ expect(page).to have_css('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
+ expect(page).to have_css('span', text: 'My subject')
end
# Edit page again
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('p', text: "###{work_package.id}")
+ expect(container).to have_css('p', text: "###{work_package.id}")
end
end
@@ -93,21 +93,21 @@ RSpec.describe 'Wysiwyg work package quicklink macros', js: true do
within('#content') do
expected_macro_text = "#{work_package.status.name}#{work_package.type.name.upcase} " \
"##{work_package.id}: My subject (01/01/2020 - 02/01/2020)"
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: expected_macro_text)
- expect(page).to have_selector('span', text: work_package.status.name)
- expect(page).to have_selector('span', text: work_package.type.name.upcase)
- expect(page).to have_selector('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
- expect(page).to have_selector('span', text: 'My subject')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: expected_macro_text)
+ expect(page).to have_css('span', text: work_package.status.name)
+ expect(page).to have_css('span', text: work_package.type.name.upcase)
+ expect(page).to have_css('.work-package--quickinfo.preview-trigger', text: "##{work_package.id}")
+ expect(page).to have_css('span', text: 'My subject')
# Dates are being rendered in two nested spans
- expect(page).to have_selector('span', text: '01/01/2020', count: 2)
- expect(page).to have_selector('span', text: '02/01/2020', count: 2)
+ expect(page).to have_css('span', text: '01/01/2020', count: 2)
+ expect(page).to have_css('span', text: '02/01/2020', count: 2)
end
# Edit page again
click_on 'Edit'
editor.in_editor do |container,|
- expect(container).to have_selector('p', text: "####{work_package.id}")
+ expect(container).to have_css('p', text: "####{work_package.id}")
end
end
@@ -162,12 +162,12 @@ RSpec.describe 'Wysiwyg work package quicklink macros', js: true do
click_on 'Save'
within('#content') do
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: /No dates$/)
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: 'Start date only (01/01/2020 - no finish date)')
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: 'End date only (no start date - 12/31/2020)')
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: 'Both dates (01/01/2020 - 12/31/2020)')
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: 'Milestone with date (01/01/2020)')
- expect(page).to have_selector('opce-macro-wp-quickinfo', text: /Milestone without date$/)
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: /No dates$/)
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Start date only (01/01/2020 - no finish date)')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: 'End date only (no start date - 12/31/2020)')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Both dates (01/01/2020 - 12/31/2020)')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: 'Milestone with date (01/01/2020)')
+ expect(page).to have_css('opce-macro-wp-quickinfo', text: /Milestone without date$/)
end
end
end
diff --git a/spec/features/wysiwyg/macros/work_package_button_spec.rb b/spec/features/wysiwyg/macros/work_package_button_spec.rb
index 883eee52244..d8d601041d7 100644
--- a/spec/features/wysiwyg/macros/work_package_button_spec.rb
+++ b/spec/features/wysiwyg/macros/work_package_button_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg work package button spec',
- js: true do
+RSpec.describe 'Wysiwyg work package button spec', :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
@@ -58,12 +57,12 @@ RSpec.describe 'Wysiwyg work package button spec',
editor.in_editor do |_container, editable|
editor.insert_macro 'Insert create work package button'
- expect(page).to have_selector('.spot-modal')
+ expect(page).to have_css('.spot-modal')
select 'MyTaskName', from: 'selected-type'
# Cancel editing
find('.spot-modal--cancel-button').click
- expect(editable).not_to have_selector('.macro.-create_work_package_link')
+ expect(editable).to have_no_css('.macro.-create_work_package_link')
editor.insert_macro 'Insert create work package button'
select 'MyTaskName', from: 'selected-type'
@@ -86,10 +85,10 @@ RSpec.describe 'Wysiwyg work package button spec',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector("a[href=\"/projects/my-project/work_packages/new?type=#{type.id}\"]")
+ expect(page).to have_css("a[href=\"/projects/my-project/work_packages/new?type=#{type.id}\"]")
end
end
end
diff --git a/spec/features/wysiwyg/mentions_spec.rb b/spec/features/wysiwyg/mentions_spec.rb
index 478dadfcba4..4836f3617c0 100644
--- a/spec/features/wysiwyg/mentions_spec.rb
+++ b/spec/features/wysiwyg/mentions_spec.rb
@@ -164,7 +164,7 @@ RSpec.describe 'Wysiwyg work package mentions',
comment_field.input_element.send_keys("@Richard Hendricks")
page.driver.wait_for_reload
expect(page)
- .not_to have_css(".mention-list-item", text: work_package_viewer.name)
+ .to have_no_css(".mention-list-item", text: work_package_viewer.name)
comment_field.cancel_by_click
# Mentioning a group works
diff --git a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
index c85a039312c..d808753f6aa 100644
--- a/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
+++ b/spec/features/wysiwyg/paragraphs_in_lists_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)',
- js: true do
+RSpec.describe 'Wysiwyg paragraphs in lists behavior (Regression #28765)', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -60,8 +59,8 @@ RSpec.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).not_to have_selector('ol li p')
+ expect(editable).to have_css('ol li', count: 3)
+ expect(editable).to have_no_css('ol li p')
end
end
end
diff --git a/spec/features/wysiwyg/tables_spec.rb b/spec/features/wysiwyg/tables_spec.rb
index 3dadfd52bd5..1dd848d0af6 100644
--- a/spec/features/wysiwyg/tables_spec.rb
+++ b/spec/features/wysiwyg/tables_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg tables',
- js: true do
+RSpec.describe 'Wysiwyg tables', :js do
shared_let(:admin) { create(:admin) }
let(:user) { admin }
@@ -68,13 +67,13 @@ RSpec.describe 'Wysiwyg tables',
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('table td', text: 'h1')
- expect(page).to have_selector('table td', text: 'h&2')
- expect(page).to have_selector('table td', text: 'c1')
- expect(page).to have_selector('table td', text: 'c&2')
+ expect(page).to have_css('table td', text: 'h1')
+ expect(page).to have_css('table td', text: 'h&2')
+ expect(page).to have_css('table td', text: 'c1')
+ expect(page).to have_css('table td', text: 'c&2')
end
end
@@ -107,23 +106,23 @@ RSpec.describe 'Wysiwyg tables',
header_button.find('.ck-button__toggle').click
# Table should now have header
- expect(editable).to have_selector('th', count: 2)
- expect(editable).to have_selector('td', count: 2)
- expect(editable).to have_selector('th', text: 'h1')
- expect(editable).to have_selector('th', text: 'h2')
- expect(editable).to have_selector('td', text: 'a')
+ expect(editable).to have_css('th', count: 2)
+ expect(editable).to have_css('td', count: 2)
+ expect(editable).to have_css('th', text: 'h1')
+ expect(editable).to have_css('th', text: 'h2')
+ expect(editable).to have_css('td', text: 'a')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('table th', text: 'h1')
- expect(page).to have_selector('table th', text: 'h2')
- expect(page).to have_selector('table td', count: 2)
- expect(page).to have_selector('td', text: 'a')
+ expect(page).to have_css('table th', text: 'h1')
+ expect(page).to have_css('table th', text: 'h2')
+ expect(page).to have_css('table td', count: 2)
+ expect(page).to have_css('td', text: 'a')
end
SeleniumHubWaiter.wait
@@ -132,11 +131,11 @@ RSpec.describe 'Wysiwyg tables',
editor.in_editor do |_container, editable|
# Table should still have header
- expect(editable).to have_selector('th', count: 2)
- expect(editable).to have_selector('td', count: 2)
- expect(editable).to have_selector('th', text: 'h1')
- expect(editable).to have_selector('th', text: 'h2')
- expect(editable).to have_selector('td', text: 'a')
+ expect(editable).to have_css('th', count: 2)
+ expect(editable).to have_css('td', count: 2)
+ expect(editable).to have_css('th', text: 'h1')
+ expect(editable).to have_css('th', text: 'h2')
+ expect(editable).to have_css('td', text: 'a')
end
end
@@ -165,7 +164,7 @@ RSpec.describe 'Wysiwyg tables',
editor.click_hover_toolbar_button 'Cell properties'
# Enable header row
- expect(page).to have_selector('.ck-input-color input', count: 2)
+ expect(page).to have_css('.ck-input-color input', count: 2)
# Pick the latter one, it's the background color
page.all('.ck-input-color input').last.set '#123456'
# Set vertical center / horizontal top
@@ -174,20 +173,20 @@ RSpec.describe 'Wysiwyg tables',
find('.ck-button-save').click
# Table should now have header
- expect(editable).to have_selector('td[style*="background-color:#123456"]')
- expect(editable).to have_selector('td[style*="text-align:center"]')
- expect(editable).to have_selector('td[style*="vertical-align:top"]')
+ expect(editable).to have_css('td[style*="background-color:#123456"]')
+ expect(editable).to have_css('td[style*="text-align:center"]')
+ expect(editable).to have_css('td[style*="vertical-align:top"]')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('td[style*="background-color:#123456"]')
- expect(page).to have_selector('td[style*="text-align:center"]')
- expect(page).to have_selector('td[style*="vertical-align:top"]')
+ expect(page).to have_css('td[style*="background-color:#123456"]')
+ expect(page).to have_css('td[style*="text-align:center"]')
+ expect(page).to have_css('td[style*="vertical-align:top"]')
end
SeleniumHubWaiter.wait
@@ -195,7 +194,7 @@ RSpec.describe 'Wysiwyg tables',
click_on 'Edit'
editor.in_editor do |_container, editable|
- expect(editable).to have_selector('td[style*="background-color:#123456"]')
+ expect(editable).to have_css('td[style*="background-color:#123456"]')
# Change table styles
tds = editable.all('.op-uc-table .op-uc-table--cell')
@@ -221,29 +220,29 @@ RSpec.describe 'Wysiwyg tables',
find('.ck-button-save').click
# table height and width is set on figure
- expect(editable).to have_selector('figure[style*="width:500px"]')
- expect(editable).to have_selector('figure[style*="height:500px"]')
+ expect(editable).to have_css('figure[style*="width:500px"]')
+ expect(editable).to have_css('figure[style*="height:500px"]')
# rest is set on table
- expect(editable).to have_selector('table[style*="background-color:red"]')
- expect(editable).to have_selector('table[style*="border-style:dotted"]')
- expect(editable).to have_selector('table[style*="border-width:10px"]')
+ expect(editable).to have_css('table[style*="background-color:red"]')
+ expect(editable).to have_css('table[style*="border-style:dotted"]')
+ expect(editable).to have_css('table[style*="border-width:10px"]')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
# table height and width is set on figure
- expect(page).to have_selector('figure[style*="width:500px"]')
- expect(page).to have_selector('figure[style*="height:500px"]')
+ expect(page).to have_css('figure[style*="width:500px"]')
+ expect(page).to have_css('figure[style*="height:500px"]')
# rest is set on table
- expect(page).to have_selector('table[style*="background-color:red"]')
- expect(page).to have_selector('table[style*="border-style:dotted"]')
- expect(page).to have_selector('table[style*="border-width:10px"]')
+ expect(page).to have_css('table[style*="background-color:red"]')
+ expect(page).to have_css('table[style*="border-style:dotted"]')
+ expect(page).to have_css('table[style*="border-width:10px"]')
end
# Edit again
@@ -251,16 +250,16 @@ RSpec.describe 'Wysiwyg tables',
# Expect all previous changes to be there
editor.in_editor do |_container, editable|
- expect(editable).to have_selector('td[style*="background-color:#123456"]')
+ expect(editable).to have_css('td[style*="background-color:#123456"]')
# table height and width is set on figure
- expect(editable).to have_selector('figure[style*="width:500px"]')
- expect(editable).to have_selector('figure[style*="height:500px"]')
+ expect(editable).to have_css('figure[style*="width:500px"]')
+ expect(editable).to have_css('figure[style*="height:500px"]')
# rest is set on table
- expect(editable).to have_selector('table[style*="background-color:red"]')
- expect(editable).to have_selector('table[style*="border-style:dotted"]')
- expect(editable).to have_selector('table[style*="border-width:10px"]')
+ expect(editable).to have_css('table[style*="background-color:red"]')
+ expect(editable).to have_css('table[style*="border-style:dotted"]')
+ expect(editable).to have_css('table[style*="border-width:10px"]')
end
end
@@ -292,16 +291,16 @@ RSpec.describe 'Wysiwyg tables',
find('.ck-table-form__dimensions-row__width input').set '250px'
find('.ck-button-save').click
- expect(editable).to have_selector('td[style*="width:250px"]')
+ expect(editable).to have_css('td[style*="width:250px"]')
end
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('td[style*="width:250px"]')
+ expect(page).to have_css('td[style*="width:250px"]')
end
SeleniumHubWaiter.wait
@@ -309,7 +308,7 @@ RSpec.describe 'Wysiwyg tables',
click_on 'Edit'
editor.in_editor do |_container, editable|
- expect(editable).to have_selector('td[style*="width:250px"]')
+ expect(editable).to have_css('td[style*="width:250px"]')
end
end
end
@@ -354,14 +353,14 @@ RSpec.describe 'Wysiwyg tables',
it 'can show the table with header' do
within('#content') do
- expect(page).to have_selector('h2', text: 'This is markdown')
-
- expect(page).to have_selector('table thead th', text: 'A')
- expect(page).to have_selector('table thead th', text: 'B')
- expect(page).to have_selector('table td', text: 'c1')
- expect(page).to have_selector('table td', text: 'c2')
- expect(page).to have_selector('table td', text: 'c3')
- expect(page).to have_selector('table td', text: 'c4')
+ expect(page).to have_css('h2', text: 'This is markdown')
+
+ expect(page).to have_css('table thead th', text: 'A')
+ expect(page).to have_css('table thead th', text: 'B')
+ expect(page).to have_css('table td', text: 'c1')
+ expect(page).to have_css('table td', text: 'c2')
+ expect(page).to have_css('table td', text: 'c3')
+ expect(page).to have_css('table td', text: 'c4')
end
# Edit the table
@@ -369,14 +368,14 @@ RSpec.describe 'Wysiwyg tables',
# Expect wysiwyg to render table
editor.in_editor do |_, editable|
- expect(editable).to have_selector('h2', text: 'This is markdown')
-
- expect(editable).to have_selector('table thead th', text: 'A')
- expect(editable).to have_selector('table thead th', text: 'B')
- expect(editable).to have_selector('table td', text: 'c1')
- expect(editable).to have_selector('table td', text: 'c2')
- expect(editable).to have_selector('table td', text: 'c3')
- expect(editable).to have_selector('table td', text: 'c4')
+ expect(editable).to have_css('h2', text: 'This is markdown')
+
+ expect(editable).to have_css('table thead th', text: 'A')
+ expect(editable).to have_css('table thead th', text: 'B')
+ expect(editable).to have_css('table td', text: 'c1')
+ expect(editable).to have_css('table td', text: 'c2')
+ expect(editable).to have_css('table td', text: 'c3')
+ expect(editable).to have_css('table td', text: 'c4')
end
end
end
diff --git a/spec/features/wysiwyg/ui_localization_spec.rb b/spec/features/wysiwyg/ui_localization_spec.rb
index 81ea32ff47d..1c0756ad0e7 100644
--- a/spec/features/wysiwyg/ui_localization_spec.rb
+++ b/spec/features/wysiwyg/ui_localization_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'WYSIWYG UI localization',
- js: true do
+RSpec.describe 'WYSIWYG UI localization', :js do
let(:user) { create(:admin, language:) }
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
@@ -57,7 +56,7 @@ RSpec.describe 'WYSIWYG UI localization',
let(:language) { :de }
it 'renders the UI in German' do
- expect(page).to have_selector('.ck-button__label', text: 'Absatz')
+ expect(page).to have_css('.ck-button__label', text: 'Absatz')
end
end
@@ -65,7 +64,7 @@ RSpec.describe 'WYSIWYG UI localization',
let(:language) { :en }
it 'renders the UI in English' do
- expect(page).to have_selector('.ck-button__label', text: 'Paragraph')
+ expect(page).to have_css('.ck-button__label', text: 'Paragraph')
end
end
end
diff --git a/spec/features/wysiwyg/work_package_linking_spec.rb b/spec/features/wysiwyg/work_package_linking_spec.rb
index dbe7c7b06d6..97bbc66084d 100644
--- a/spec/features/wysiwyg/work_package_linking_spec.rb
+++ b/spec/features/wysiwyg/work_package_linking_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe 'Wysiwyg work package linking',
- js: true do
+RSpec.describe 'Wysiwyg work package linking', :js do
let(:user) { create(:admin) }
let(:project) { create(:project, enabled_module_names: %w[wiki work_package_tracking]) }
let(:work_package) { create(:work_package, subject: 'Foobar', project:) }
@@ -49,15 +48,15 @@ RSpec.describe 'Wysiwyg work package linking',
editor.click_and_type_slowly "##{work_package.id}"
editor.click_autocomplete work_package.subject
- expect(editor.editor_element).to have_selector('a.mention', text: "##{work_package.id}")
+ expect(editor.editor_element).to have_css('a.mention', text: "##{work_package.id}")
# Save wiki page
click_on 'Save'
- expect(page).to have_selector('.op-toast.-success')
+ expect(page).to have_css('.op-toast.-success')
within('#content') do
- expect(page).to have_selector('a.issue', count: 1)
+ expect(page).to have_css('a.issue', count: 1)
end
end
end
diff --git a/spec/helpers/no_results_helper_spec.rb b/spec/helpers/no_results_helper_spec.rb
index 1da830ea739..e26b8f23040 100644
--- a/spec/helpers/no_results_helper_spec.rb
+++ b/spec/helpers/no_results_helper_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe NoResultsHelper do
describe '#no_results_box' do
it "contains the just the title" do
expect(helper.no_results_box).to have_content 'Nothing here!'
- expect(helper.no_results_box).not_to have_link 'Add some foo'
+ expect(helper.no_results_box).to have_no_link 'Add some foo'
end
it "contains the title and content link" do
diff --git a/spec/helpers/pagination_helper_spec.rb b/spec/helpers/pagination_helper_spec.rb
index 11c25d8f530..718e06fc454 100644
--- a/spec/helpers/pagination_helper_spec.rb
+++ b/spec/helpers/pagination_helper_spec.rb
@@ -66,39 +66,39 @@ RSpec.describe PaginationHelper do
end
it "is inside a 'pagination' div" do
- expect(pagination).to have_selector('div.op-pagination')
+ expect(pagination).to have_css('div.op-pagination')
end
it 'has a next_page reference' do
- expect(pagination).to have_selector('.op-pagination--item_next')
+ expect(pagination).to have_css('.op-pagination--item_next')
end
it 'does not have a previous_page reference' do
- expect(pagination).not_to have_selector('.op-pagination--item_prev')
+ expect(pagination).to have_no_css('.op-pagination--item_prev')
end
it 'has links to every page except the current one' do
(1..(total_entries / per_page)).each do |i|
next if i == current_page
- expect(pagination).to have_selector("a[href='#{work_packages_path(page: i)}']",
- text: Regexp.new("^#{i}$"))
+ expect(pagination).to have_css("a[href='#{work_packages_path(page: i)}']",
+ text: Regexp.new("^#{i}$"))
end
end
it 'does not have a link to the current page' do
- expect(pagination).not_to have_selector('a', text: Regexp.new("^#{current_page}$"))
+ expect(pagination).to have_no_css('a', text: Regexp.new("^#{current_page}$"))
end
it 'has an element for the current page' do
- expect(pagination).to have_selector('.op-pagination--item_current',
- text: Regexp.new("^#{current_page}$"))
+ expect(pagination).to have_css('.op-pagination--item_current',
+ text: Regexp.new("^#{current_page}$"))
end
it 'shows the range of the entries displayed' do
range = "(#{(current_page * per_page) - per_page + 1} - " +
"#{current_page * per_page}/#{total_entries})"
- expect(pagination).to have_selector('.op-pagination--range', text: range)
+ expect(pagination).to have_css('.op-pagination--range', text: range)
end
it 'has different urls if the params are specified as options' do
@@ -111,7 +111,7 @@ RSpec.describe PaginationHelper do
href = work_packages_path({ page: i }.merge(params))
- expect(pagination).to have_selector("a[href='#{href}']", text: Regexp.new("^#{i}$"))
+ expect(pagination).to have_css("a[href='#{href}']", text: Regexp.new("^#{i}$"))
end
end
@@ -120,24 +120,24 @@ RSpec.describe PaginationHelper do
.to receive(:per_page_options)
.and_return("#{per_page},#{per_page * 10}")
- expect(pagination).to have_selector('.op-pagination--options')
+ expect(pagination).to have_css('.op-pagination--options')
- expect(pagination).to have_selector('.op-pagination--options .op-pagination--item_current', text: per_page)
+ expect(pagination).to have_css('.op-pagination--options .op-pagination--item_current', text: per_page)
path = work_packages_path(page: current_page, per_page: Setting.per_page_options_array.last)
- expect(pagination).to have_selector(".op-pagination--options a[href='#{path}']")
+ expect(pagination).to have_css(".op-pagination--options a[href='#{path}']")
end
describe 'WHEN the first page is the current' do
let(:current_page) { 1 }
it 'deactivates the previous page link' do
- expect(pagination).not_to have_selector('.op-pagination--item_prev')
+ expect(pagination).to have_no_css('.op-pagination--item_prev')
end
it 'has a link to the next page' do
path = work_packages_path(page: current_page + 1)
- expect(pagination).to have_selector(".op-pagination--item_next a[href='#{path}']")
+ expect(pagination).to have_css(".op-pagination--item_next a[href='#{path}']")
end
end
@@ -145,12 +145,12 @@ RSpec.describe PaginationHelper do
let(:current_page) { (total_entries / per_page) + 1 }
it 'deactivates the next page link' do
- expect(pagination).not_to have_selector('.op-pagination--item_next')
+ expect(pagination).to have_no_css('.op-pagination--item_next')
end
it 'has a link to the previous page' do
path = work_packages_path(page: current_page - 1)
- expect(pagination).to have_selector(".op-pagination--item_prev a[href='#{path}']")
+ expect(pagination).to have_css(".op-pagination--item_prev a[href='#{path}']")
end
end
@@ -158,11 +158,11 @@ RSpec.describe PaginationHelper do
let(:total_entries) { 0 }
it 'shows no pages' do
- expect(pagination).not_to have_selector('.op-pagination--items .op-pagination--item')
+ expect(pagination).to have_no_css('.op-pagination--items .op-pagination--item')
end
it 'shows no pagination' do
- expect(pagination).not_to have_selector('.op-pagination')
+ expect(pagination).to have_no_css('.op-pagination')
end
end
end
diff --git a/spec/helpers/security_badge_helper_spec.rb b/spec/helpers/security_badge_helper_spec.rb
index 4928d92cb4a..9b53f468acd 100644
--- a/spec/helpers/security_badge_helper_spec.rb
+++ b/spec/helpers/security_badge_helper_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe SecurityBadgeHelper do
uri = URI.parse(helper.security_badge_url)
query = Rack::Utils.parse_nested_query(uri.query)
expect(uri.host).to eq("releases.openproject.com")
- expect(query.keys).to match_array(["uuid", "type", "version", "db", "lang", "ee"])
+ expect(query.keys).to contain_exactly("uuid", "type", "version", "db", "lang", "ee")
expect(query["uuid"]).to eq("abcd1234")
expect(query["version"]).to eq(OpenProject::VERSION.to_semver)
expect(query["type"]).to eq("manual")
diff --git a/spec/helpers/settings_helper_spec.rb b/spec/helpers/settings_helper_spec.rb
index d00e5152ffd..9d07f4b02ff 100644
--- a/spec/helpers/settings_helper_spec.rb
+++ b/spec/helpers/settings_helper_spec.rb
@@ -77,7 +77,7 @@ RSpec.describe SettingsHelper do
it_behaves_like 'field disabled if non writable'
it 'outputs element' do
- expect(output).to have_selector 'select.form--select > option', count: 3
+ expect(output).to have_css 'select.form--select > option', count: 3
expect(output).to have_select 'settings_field', selected: 'Jello'
end
end
@@ -96,15 +96,15 @@ RSpec.describe SettingsHelper do
end
it 'has checkboxes wrapped in checkbox-container' do
- expect(output).to have_selector 'span.form--check-box-container', count: 3
+ expect(output).to have_css 'span.form--check-box-container', count: 3
end
it 'has three labels' do
- expect(output).to have_selector 'label.form--label-with-check-box', count: 3
+ expect(output).to have_css 'label.form--label-with-check-box', count: 3
end
it 'outputs element' do
- expect(output).to have_selector 'input[type="checkbox"].form--check-box', count: 3
+ expect(output).to have_css 'input[type="checkbox"].form--check-box', count: 3
end
context 'when the setting isn`t writable' do
@@ -115,8 +115,8 @@ RSpec.describe SettingsHelper do
end
it 'is disabled and has no hidden field' do
- expect(output).not_to have_selector 'input[type="hidden"][value=""]', visible: :all
- expect(output).to have_selector 'input[type="checkbox"][disabled="disabled"].form--check-box', count: 3
+ expect(output).to have_no_css 'input[type="hidden"][value=""]', visible: :all
+ expect(output).to have_css 'input[type="checkbox"][disabled="disabled"].form--check-box', count: 3
end
end
end
@@ -154,15 +154,15 @@ RSpec.describe SettingsHelper do
it_behaves_like 'not wrapped in container'
it 'is structured as a table' do
- expect(output).to have_selector 'table.form--matrix'
+ expect(output).to have_css 'table.form--matrix'
end
it 'has table headers' do
- expect(output).to have_selector 'thead th.form--matrix-header-cell', count: 3
+ expect(output).to have_css 'thead th.form--matrix-header-cell', count: 3
end
it 'has three table rows' do
- expect(output).to have_selector 'tbody > tr.form--matrix-row', count: 4
+ expect(output).to have_css 'tbody > tr.form--matrix-row', count: 4
end
it 'has cells with text labels' do
@@ -276,8 +276,8 @@ important text</textarea>
it_behaves_like 'field disabled if non writable'
it 'outputs element' do
- expect(output).to have_selector 'input[type="hidden"][value=0]', visible: :hidden
- expect(output).to have_selector 'input[type="checkbox"].custom-class.form--check-box'
+ expect(output).to have_css 'input[type="hidden"][value=0]', visible: :hidden
+ expect(output).to have_css 'input[type="checkbox"].custom-class.form--check-box'
expect(output).to have_checked_field 'settings_field'
end
@@ -289,7 +289,7 @@ important text</textarea>
end
it 'does not output a hidden field' do
- expect(output).not_to have_selector 'input[type="hidden"][value=0]', visible: :hidden
+ expect(output).to have_no_css 'input[type="hidden"][value=0]', visible: :hidden
end
end
end
@@ -305,8 +305,8 @@ important text</textarea>
it_behaves_like 'field disabled if non writable'
it 'outputs element' do
- expect(output).to have_selector 'input[type="hidden"][value=0]', visible: :hidden
- expect(output).to have_selector 'input[type="checkbox"].custom-class.form--check-box'
+ expect(output).to have_css 'input[type="hidden"][value=0]', visible: :hidden
+ expect(output).to have_css 'input[type="checkbox"].custom-class.form--check-box'
expect(output).to have_unchecked_field 'settings_field'
end
@@ -318,7 +318,7 @@ important text</textarea>
end
it 'does not output a hidden field' do
- expect(output).not_to have_selector 'input[type="hidden"][value=0]', visible: :hidden
+ expect(output).to have_no_css 'input[type="hidden"][value=0]', visible: :hidden
end
end
end
diff --git a/spec/helpers/work_packages_helper_spec.rb b/spec/helpers/work_packages_helper_spec.rb
index 36b0989cce7..e4e61a448e3 100644
--- a/spec/helpers/work_packages_helper_spec.rb
+++ b/spec/helpers/work_packages_helper_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe WorkPackagesHelper do
describe 'without parameters' do
it 'returns a link to the work package with type and id as the text if type is set' do
link_text = Regexp.new("^#{stub_type.name} ##{stub_work_package.id}$")
- expect(helper.link_to_work_package(stub_work_package)).to have_selector(
+ expect(helper.link_to_work_package(stub_work_package)).to have_css(
"a[href='#{work_package_path(stub_work_package)}']", text: link_text
)
end
@@ -57,14 +57,14 @@ RSpec.describe WorkPackagesHelper do
it 'prepends an invisible closed information if the work package is closed' do
stub_work_package.status = closed_status
- expect(helper.link_to_work_package(stub_work_package)).to have_selector('a span.hidden-for-sighted', text: 'closed')
+ expect(helper.link_to_work_package(stub_work_package)).to have_css('a span.hidden-for-sighted', text: 'closed')
end
it 'omits the invisible closed information if told so even though the work package is closed' do
stub_work_package.status = closed_status
expect(helper.link_to_work_package(stub_work_package, no_hidden: true))
- .not_to have_selector('a span.hidden-for-sighted', text: 'closed')
+ .to have_no_css('a span.hidden-for-sighted', text: 'closed')
end
end
@@ -72,7 +72,7 @@ RSpec.describe WorkPackagesHelper do
it 'returns a link to the work package with the type, id, and subject as the text' do
link_text = Regexp.new("^#{stub_type} ##{stub_work_package.id}: #{stub_work_package.subject}$")
expect(helper.link_to_work_package(stub_work_package,
- all_link: true)).to have_selector(
+ all_link: true)).to have_css(
"a[href='#{work_package_path(stub_work_package)}']", text: link_text
)
end
@@ -96,7 +96,7 @@ RSpec.describe WorkPackagesHelper do
describe 'when omitting the subject' do
it 'omits the subject' do
- expect(helper.link_to_work_package(stub_work_package, subject: false)).not_to have_text(stub_work_package.subject)
+ expect(helper.link_to_work_package(stub_work_package, subject: false)).to have_no_text(stub_work_package.subject)
end
end
@@ -104,8 +104,8 @@ RSpec.describe WorkPackagesHelper do
it 'omits the type' do
link_text = Regexp.new("^##{stub_work_package.id}$")
expect(helper.link_to_work_package(stub_work_package,
- type: false)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",
- text: link_text)
+ type: false)).to have_css("a[href='#{work_package_path(stub_work_package)}']",
+ text: link_text)
end
end
@@ -121,7 +121,7 @@ RSpec.describe WorkPackagesHelper do
end
it 'does not include the project name if the parameter is missing/false' do
- expect(helper.link_to_work_package(stub_work_package)).not_to have_text(text)
+ expect(helper.link_to_work_package(stub_work_package)).to have_no_text(text)
end
end
@@ -129,12 +129,12 @@ RSpec.describe WorkPackagesHelper do
it 'returns a link with the id as text only' do
link_text = Regexp.new("^##{stub_work_package.id}$")
expect(helper.link_to_work_package(stub_work_package,
- id_only: true)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",
- text: link_text)
+ id_only: true)).to have_css("a[href='#{work_package_path(stub_work_package)}']",
+ text: link_text)
end
it 'does not have the subject as text' do
- expect(helper.link_to_work_package(stub_work_package, id_only: true)).not_to have_text(stub_work_package.subject)
+ expect(helper.link_to_work_package(stub_work_package, id_only: true)).to have_no_text(stub_work_package.subject)
end
end
@@ -142,7 +142,7 @@ RSpec.describe WorkPackagesHelper do
it 'returns a link with the subject as text' do
link_text = Regexp.new("^#{stub_work_package.subject}$")
expect(helper.link_to_work_package(stub_work_package,
- subject_only: true)).to have_selector(
+ subject_only: true)).to have_css(
"a[href='#{work_package_path(stub_work_package)}']", text: link_text
)
end
@@ -152,8 +152,8 @@ RSpec.describe WorkPackagesHelper do
it 'returns a link with the status name contained in the text' do
link_text = Regexp.new("^#{stub_type.name} ##{stub_work_package.id} #{stub_work_package.status}$")
expect(helper.link_to_work_package(stub_work_package,
- status: true)).to have_selector("a[href='#{work_package_path(stub_work_package)}']",
- text: link_text)
+ status: true)).to have_css("a[href='#{work_package_path(stub_work_package)}']",
+ text: link_text)
end
end
end
diff --git a/spec/lib/api/v3/queries/schemas/query_filter_instance_schema_representer_spec.rb b/spec/lib/api/v3/queries/schemas/query_filter_instance_schema_representer_spec.rb
index 6c2799b3d32..ebd7178f6ac 100644
--- a/spec/lib/api/v3/queries/schemas/query_filter_instance_schema_representer_spec.rb
+++ b/spec/lib/api/v3/queries/schemas/query_filter_instance_schema_representer_spec.rb
@@ -226,10 +226,6 @@ RSpec.describe API::V3::Queries::Schemas::QueryFilterInstanceSchemaRepresenter d
form_embedded:)
.and_return(dependency)
end
- end
-
- before do
- # fill the cache
instance.to_json
end
diff --git a/spec/lib/api/v3/work_packages/eager_loading/custom_actions_integration_spec.rb b/spec/lib/api/v3/work_packages/eager_loading/custom_actions_integration_spec.rb
index eba3b44ded7..1f888d132ff 100644
--- a/spec/lib/api/v3/work_packages/eager_loading/custom_actions_integration_spec.rb
+++ b/spec/lib/api/v3/work_packages/eager_loading/custom_actions_integration_spec.rb
@@ -27,7 +27,7 @@
#++require 'rspec'
require 'spec_helper'
-require_relative './eager_loading_mock_wrapper'
+require_relative 'eager_loading_mock_wrapper'
RSpec.describe API::V3::WorkPackages::EagerLoading::CustomAction do
let!(:work_package1) { create(:work_package) }
@@ -60,10 +60,10 @@ RSpec.describe API::V3::WorkPackages::EagerLoading::CustomAction do
.not_to receive(:custom_actions)
expect(wrapped.detect { |w| w.id == work_package1.id }.custom_actions(user))
- .to match_array [status_custom_action]
+ .to contain_exactly(status_custom_action)
expect(wrapped.detect { |w| w.id == work_package2.id }.custom_actions(user))
- .to match_array [role_custom_action]
+ .to contain_exactly(role_custom_action)
end
end
end
diff --git a/spec/lib/api/v3/work_packages/eager_loading/project_integration_spec.rb b/spec/lib/api/v3/work_packages/eager_loading/project_integration_spec.rb
index 3afd7ae9517..0cd8c781485 100644
--- a/spec/lib/api/v3/work_packages/eager_loading/project_integration_spec.rb
+++ b/spec/lib/api/v3/work_packages/eager_loading/project_integration_spec.rb
@@ -27,7 +27,7 @@
#++require 'rspec'
require 'spec_helper'
-require_relative './eager_loading_mock_wrapper'
+require_relative 'eager_loading_mock_wrapper'
RSpec.describe API::V3::WorkPackages::EagerLoading::Project do
let!(:parent_work_package1) { create(:work_package, project: parent_project) }
diff --git a/spec/lib/api/v3/work_packages/schema/work_package_sums_schema_spec.rb b/spec/lib/api/v3/work_packages/schema/work_package_sums_schema_spec.rb
index fa586a21f36..40d85854f72 100644
--- a/spec/lib/api/v3/work_packages/schema/work_package_sums_schema_spec.rb
+++ b/spec/lib/api/v3/work_packages/schema/work_package_sums_schema_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe API::V3::WorkPackages::Schema::WorkPackageSumsSchema do
allow(WorkPackageCustomField)
.to receive(:summable) { [cf1, cf2, cf3] }
- expect(subject.available_custom_fields).to match_array [cf1, cf2, cf3]
+ expect(subject.available_custom_fields).to contain_exactly(cf1, cf2, cf3)
end
end
end
diff --git a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb
index e4d6d4c75b1..77db72b28b2 100644
--- a/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb
+++ b/spec/lib/api/v3/work_packages/work_package_payload_representer_spec.rb
@@ -279,7 +279,7 @@ RSpec.describe API::V3::WorkPackages::WorkPackagePayloadRepresenter do
shared_examples_for 'linked property with 0 value' do |attribute, association = attribute|
context "with a 0 for #{attribute}_id" do
before do
- work_package.send("#{association}_id=", 0)
+ work_package.send(:"#{association}_id=", 0)
end
it_behaves_like 'linked property' do
diff --git a/spec/lib/open_project/changed_by_system_spec.rb b/spec/lib/open_project/changed_by_system_spec.rb
index d7d95cc2c2d..2cf365d177c 100644
--- a/spec/lib/open_project/changed_by_system_spec.rb
+++ b/spec/lib/open_project/changed_by_system_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe OpenProject::ChangedBySystem do
it 'returns the attribute' do
expect(model.changed_by_user)
- .to match_array ['title']
+ .to contain_exactly('title')
end
end
@@ -71,7 +71,7 @@ RSpec.describe OpenProject::ChangedBySystem do
it 'returns the attribute' do
expect(model.changed_by_user)
- .to match_array ['title']
+ .to contain_exactly('title')
end
end
diff --git a/spec/lib/open_project/feature_decisions_spec.rb b/spec/lib/open_project/feature_decisions_spec.rb
index 3a6bd5771b1..493cf216b85 100644
--- a/spec/lib/open_project/feature_decisions_spec.rb
+++ b/spec/lib/open_project/feature_decisions_spec.rb
@@ -49,7 +49,7 @@ RSpec.describe OpenProject::FeatureDecisions, :settings_reset do
include_context 'when adding without env variable'
it 'is false by default' do
- expect(described_class.send("#{flag_name}_active?"))
+ expect(described_class.send(:"#{flag_name}_active?"))
.to be false
end
end
@@ -59,7 +59,7 @@ RSpec.describe OpenProject::FeatureDecisions, :settings_reset do
include_context 'when adding the given feature flag'
it 'is true' do
- expect(described_class.send("#{flag_name}_active?"))
+ expect(described_class.send(:"#{flag_name}_active?"))
.to be true
end
end
diff --git a/spec/lib/open_project/form_tag_helper_spec.rb b/spec/lib/open_project/form_tag_helper_spec.rb
index 0b7c4f24101..53e0505b527 100644
--- a/spec/lib/open_project/form_tag_helper_spec.rb
+++ b/spec/lib/open_project/form_tag_helper_spec.rb
@@ -234,7 +234,7 @@ Words are important</textarea>
it_behaves_like 'not wrapped in container', 'submit-container'
it 'outputs element' do
- expect(html).to have_selector('input[type=submit]')
+ expect(html).to have_css('input[type=submit]')
end
end
diff --git a/spec/lib/open_project/hook_spec.rb b/spec/lib/open_project/hook_spec.rb
index 13456f0ca5c..9defc1be229 100644
--- a/spec/lib/open_project/hook_spec.rb
+++ b/spec/lib/open_project/hook_spec.rb
@@ -72,7 +72,7 @@ RSpec.describe OpenProject::Hook do
test_hook1_class
expect(described_class.hook_listeners(:view_layouts_base_html_head))
- .to match_array([test_hook1_class])
+ .to contain_exactly(test_hook1_class)
end
end
@@ -90,7 +90,7 @@ RSpec.describe OpenProject::Hook do
it 'adds listeners' do
described_class.add_listener(test_class)
expect(described_class.hook_listeners(:view_layouts_base_html_head))
- .to match_array([test_class])
+ .to contain_exactly(test_class)
end
end
@@ -152,8 +152,8 @@ RSpec.describe OpenProject::Hook do
it 'calls all registered methods' do
expect(described_class.call_hook(:view_layouts_base_html_head))
- .to match_array [test_hook1_class.instance.view_layouts_base_html_head(nil),
- test_hook2_class.instance.view_layouts_base_html_head(nil)]
+ .to contain_exactly(test_hook1_class.instance.view_layouts_base_html_head(nil),
+ test_hook2_class.instance.view_layouts_base_html_head(nil))
end
end
@@ -171,7 +171,7 @@ RSpec.describe OpenProject::Hook do
it 'passes the context through' do
expect(described_class.call_hook(:view_layouts_base_html_head, **context))
- .to match_array [context]
+ .to contain_exactly(context)
end
end
@@ -187,7 +187,7 @@ RSpec.describe OpenProject::Hook do
it 'renders the link' do
expect(described_class.call_hook(:view_layouts_base_html_head))
- .to match_array ['<a href="/work_packages">Work packages</a>']
+ .to contain_exactly('<a href="/work_packages">Work packages</a>')
end
end
@@ -221,7 +221,7 @@ RSpec.describe OpenProject::Hook do
it 'adds to the context' do
expect(instance.call_hook(:view_layouts_base_html_head, {}))
- .to match_array [{ project:, controller: instance, request:, hook_caller: instance }]
+ .to contain_exactly({ project:, controller: instance, request:, hook_caller: instance })
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 f1eb2025ea4..c2fdc4bfc88 100644
--- a/spec/lib/open_project/scm/adapters/git_adapter_spec.rb
+++ b/spec/lib/open_project/scm/adapters/git_adapter_spec.rb
@@ -442,8 +442,7 @@ RSpec.describe OpenProject::SCM::Adapters::Git do
annotate = adapter.annotate('renamed_test.txt')
expect(annotate.lines.length).to eq(2)
expect(annotate.content).to eq("This is a test\nLet's pretend I'm adding a new feature!")
- expect(annotate.lines).to match_array(['This is a test',
- "Let's pretend I'm adding a new feature!"])
+ expect(annotate.lines).to contain_exactly('This is a test', "Let's pretend I'm adding a new feature!")
expect(annotate.revisions.length).to eq(2)
expect(annotate.revisions[0].identifier).to eq('fba357b886984ee71185ad2065e65fc0417d9b92')
diff --git a/spec/lib/open_project/storage_spec.rb b/spec/lib/open_project/storage_spec.rb
index 15f679583a5..36078d74404 100644
--- a/spec/lib/open_project/storage_spec.rb
+++ b/spec/lib/open_project/storage_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe OpenProject::Storage do
subject { OpenProject::Storage.known_storage_paths }
it 'contains attachments path' do
- expect(subject.length).to be == 1
+ expect(subject.length).to eq 1
expect(subject[:attachments])
.to eq(label: I18n.t('attributes.attachments'),
path: OpenProject::Configuration.attachments_storage_path.to_s)
@@ -62,7 +62,7 @@ RSpec.describe OpenProject::Storage do
it 'contains one fs entry' do
expect(File.exist?(tmpdir)).to be true
- expect(subject.length).to be == 1
+ expect(subject.length).to eq 1
entry = subject.values.first
expect(entry[:labels]).to eq(['this is foobar'])
@@ -92,12 +92,11 @@ RSpec.describe OpenProject::Storage do
subject { OpenProject::Storage.known_storage_paths }
it 'contains both paths' do
- expect(subject.length).to be == 2
+ expect(subject.length).to eq 2
labels = subject.values.pluck(:label)
expect(labels)
- .to match_array([I18n.t(:label_managed_repositories_vendor, vendor: 'Git'),
- I18n.t('attributes.attachments')])
+ .to contain_exactly(I18n.t(:label_managed_repositories_vendor, vendor: 'Git'), I18n.t('attributes.attachments'))
end
end
@@ -109,8 +108,7 @@ RSpec.describe OpenProject::Storage do
entry = subject.values.first
expect(entry[:labels])
- .to match_array([I18n.t(:label_managed_repositories_vendor, vendor: 'Git'),
- I18n.t('attributes.attachments')])
+ .to contain_exactly(I18n.t(:label_managed_repositories_vendor, vendor: 'Git'), I18n.t('attributes.attachments'))
end
context 'with multiple filesystem ids' do
diff --git a/spec/lib/open_project/text_formatting/markdown/attribute_macros_spec.rb b/spec/lib/open_project/text_formatting/markdown/attribute_macros_spec.rb
index f9adb7465f3..57ddb87155c 100644
--- a/spec/lib/open_project/text_formatting/markdown/attribute_macros_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/attribute_macros_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'Attribute macros' do
diff --git a/spec/lib/open_project/text_formatting/markdown/blockquote_spec.rb b/spec/lib/open_project/text_formatting/markdown/blockquote_spec.rb
index 43af75671ab..f06033358b6 100644
--- a/spec/lib/open_project/text_formatting/markdown/blockquote_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/blockquote_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'blockquote' do
diff --git a/spec/lib/open_project/text_formatting/markdown/code_spec.rb b/spec/lib/open_project/text_formatting/markdown/code_spec.rb
index f8078377725..d5a1da389cd 100644
--- a/spec/lib/open_project/text_formatting/markdown/code_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/code_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'code' do
diff --git a/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb b/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
index 4efb0d83d97..881c5ea65e0 100644
--- a/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/embedded_table_macro_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'toc macro' do
diff --git a/spec/lib/open_project/text_formatting/markdown/headings_spec.rb b/spec/lib/open_project/text_formatting/markdown/headings_spec.rb
index 9bc608179bc..f71c5c0888c 100644
--- a/spec/lib/open_project/text_formatting/markdown/headings_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/headings_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'headings' do
diff --git a/spec/lib/open_project/text_formatting/markdown/images_spec.rb b/spec/lib/open_project/text_formatting/markdown/images_spec.rb
index e4b97b89e36..00f8f29b406 100644
--- a/spec/lib/open_project/text_formatting/markdown/images_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/images_spec.rb
@@ -28,7 +28,7 @@
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'images' do
include_context 'expected markdown modules'
diff --git a/spec/lib/open_project/text_formatting/markdown/lists_spec.rb b/spec/lib/open_project/text_formatting/markdown/lists_spec.rb
index 4bd9afdeb9e..4d328bc892e 100644
--- a/spec/lib/open_project/text_formatting/markdown/lists_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/lists_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'lists' do
diff --git a/spec/lib/open_project/text_formatting/markdown/markdown_formatting_spec.rb b/spec/lib/open_project/text_formatting/markdown/markdown_formatting_spec.rb
index 410dc6400d5..5f7aec20493 100644
--- a/spec/lib/open_project/text_formatting/markdown/markdown_formatting_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/markdown_formatting_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting::Formats::Markdown::Formatter do
it 'modifierses' do
@@ -67,7 +67,7 @@ RSpec.describe OpenProject::TextFormatting::Formats::Markdown::Formatter do
expect_paragraph = options.delete :expect_paragraph
to_test.each do |text, expected|
- expected = expect_paragraph ? "<p class=\"op-uc-p\">#{expected}</p>" : expected
+ expected = "<p class=\"op-uc-p\">#{expected}</p>" if expect_paragraph
expect(to_html(text, options)).to be_html_eql expected
end
end
diff --git a/spec/lib/open_project/text_formatting/markdown/paragraphs_spec.rb b/spec/lib/open_project/text_formatting/markdown/paragraphs_spec.rb
index 59c73b8d846..b8cf87f2ca6 100644
--- a/spec/lib/open_project/text_formatting/markdown/paragraphs_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/paragraphs_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'paragraphs' do
diff --git a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
index eae9bde14a3..814d69ebd6b 100644
--- a/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/setting_variable_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'Setting variable' do
diff --git a/spec/lib/open_project/text_formatting/markdown/tables_spec.rb b/spec/lib/open_project/text_formatting/markdown/tables_spec.rb
index 6027bcdd03b..45552933973 100644
--- a/spec/lib/open_project/text_formatting/markdown/tables_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/tables_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'tables' do
diff --git a/spec/lib/open_project/text_formatting/markdown/toc_macro_spec.rb b/spec/lib/open_project/text_formatting/markdown/toc_macro_spec.rb
index 2593a80c43f..a90a4150515 100644
--- a/spec/lib/open_project/text_formatting/markdown/toc_macro_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/toc_macro_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'toc macro' do
diff --git a/spec/lib/open_project/text_formatting/markdown/user_provided_links_spec.rb b/spec/lib/open_project/text_formatting/markdown/user_provided_links_spec.rb
index 4d58c7813d3..9dea075cf4b 100644
--- a/spec/lib/open_project/text_formatting/markdown/user_provided_links_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/user_provided_links_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'user provided links' do
diff --git a/spec/lib/open_project/text_formatting/markdown/work_package_buttons_macro_spec.rb b/spec/lib/open_project/text_formatting/markdown/work_package_buttons_macro_spec.rb
index 228fc6582fa..a0c68c7ab58 100644
--- a/spec/lib/open_project/text_formatting/markdown/work_package_buttons_macro_spec.rb
+++ b/spec/lib/open_project/text_formatting/markdown/work_package_buttons_macro_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './expected_markdown'
+require_relative 'expected_markdown'
RSpec.describe OpenProject::TextFormatting,
'work package button macro' do
diff --git a/spec/lib/redmine/i18n_spec.rb b/spec/lib/redmine/i18n_spec.rb
index 5696825c2b5..3c60ccf8336 100644
--- a/spec/lib/redmine/i18n_spec.rb
+++ b/spec/lib/redmine/i18n_spec.rb
@@ -86,7 +86,7 @@ module OpenProject
end
it 'returns no js language as they are duplicates of the rest of the other language' do
- expect(all_languages).not_to be_any { |l| l.to_s.start_with?('js-') }
+ expect(all_languages).not_to(be_any { |l| l.to_s.start_with?('js-') })
end
# it is OK if more languages exist
diff --git a/spec/lib/tabular_form_builder_spec.rb b/spec/lib/tabular_form_builder_spec.rb
index eb80ca0452e..991d11e437f 100644
--- a/spec/lib/tabular_form_builder_spec.rb
+++ b/spec/lib/tabular_form_builder_spec.rb
@@ -65,7 +65,7 @@ RSpec.describe TabularFormBuilder do
context 'with help text' do
let(:options) { { title: 'Name', class: 'custom-class', help_text: { attribute: 'foo', 'attribute-scope': 'bar' } } }
- it 'will output a label with an attribute-help-text tag' do
+ it 'outputs a label with an attribute-help-text tag' do
expect(output).to be_html_eql(%{
<label class="form--label"
for="user_name"
@@ -209,8 +209,8 @@ JJ Abrams</textarea>
context 'an id is missing' do
it 'outputs the wysiwyg wrapper' do
- expect(output).to have_selector 'textarea'
- expect(output).to have_selector 'ckeditor-augmented-textarea'
+ expect(output).to have_css 'textarea'
+ expect(output).to have_css 'ckeditor-augmented-textarea'
end
end
@@ -218,8 +218,8 @@ JJ Abrams</textarea>
let(:options) { { id: 'my-id', title: 'Name', class: 'custom-class', with_text_formatting: true } }
it 'outputs the wysiwyg wrapper' do
- expect(output).to have_selector 'textarea'
- expect(output).to have_selector 'ckeditor-augmented-textarea'
+ expect(output).to have_css 'textarea'
+ expect(output).to have_css 'ckeditor-augmented-textarea'
end
end
end
@@ -262,8 +262,8 @@ JJ Abrams</textarea>
it_behaves_like 'wrapped in container', 'select-container'
it 'outputs element' do
- expect(output).to have_selector 'select.custom-class.form--select > option', count: 3
- expect(output).to have_selector 'option:first[value="56"]'
+ expect(output).to have_css 'select.custom-class.form--select > option', count: 3
+ expect(output).to have_css 'option:first[value="56"]'
expect(output).to have_text 'Jonas'
end
end
@@ -279,9 +279,9 @@ JJ Abrams</textarea>
it_behaves_like 'wrapped in field-container by default'
it 'outputs element' do
- expect(output).to have_selector 'select', count: 3
- expect(output).to have_selector 'select:nth-of-type(2) > option', count: 12
- expect(output).to have_selector 'select:last > option', count: 31
+ expect(output).to have_css 'select', count: 3
+ expect(output).to have_css 'select:nth-of-type(2) > option', count: 12
+ expect(output).to have_css 'select:last > option', count: 31
end
end
@@ -524,7 +524,7 @@ JJ Abrams</textarea>
it_behaves_like 'not wrapped in container', 'submit-container'
it 'outputs element' do
- expect(output).to have_selector('input[name=commit]')
+ expect(output).to have_css('input[name=commit]')
end
end
@@ -654,16 +654,16 @@ JJ Abrams</textarea>
end
it 'shows an appropriate error label' do
- expect(output).to have_selector 'label.-error',
- count: 1,
- text: 'Name'
+ expect(output).to have_css 'label.-error',
+ count: 1,
+ text: 'Name'
end
it 'contains a specific error as a hidden sub-label' do
- expect(output).to have_selector 'label.-error p',
- count: 1,
- text: 'This field is invalid: Name is invalid. ' \
- 'Name is not set to one of the allowed values.'
+ expect(output).to have_css 'label.-error p',
+ count: 1,
+ text: 'This field is invalid: Name is invalid. ' \
+ 'Name is not set to one of the allowed values.'
end
end
end
diff --git a/spec/mailers/announcement_mailer_spec.rb b/spec/mailers/announcement_mailer_spec.rb
index c5329fabb7f..16bf151bfd0 100644
--- a/spec/mailers/announcement_mailer_spec.rb
+++ b/spec/mailers/announcement_mailer_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe AnnouncementMailer do
it 'sends to the recipient' do
expect(mail.to)
- .to match_array [recipient.mail]
+ .to contain_exactly(recipient.mail)
end
end
end
diff --git a/spec/mailers/digest_mailer_spec.rb b/spec/mailers/digest_mailer_spec.rb
index 9016c1a7ce1..a06d7aa834f 100644
--- a/spec/mailers/digest_mailer_spec.rb
+++ b/spec/mailers/digest_mailer_spec.rb
@@ -84,7 +84,7 @@ RSpec.describe DigestMailer do
it 'sends to the recipient' do
expect(mail.to)
- .to match_array [recipient.mail]
+ .to contain_exactly(recipient.mail)
end
it 'sets the expected message_id header' do
diff --git a/spec/mailers/shared_examples.rb b/spec/mailers/shared_examples.rb
index 15c9a781d7f..389f5af2135 100644
--- a/spec/mailers/shared_examples.rb
+++ b/spec/mailers/shared_examples.rb
@@ -12,7 +12,7 @@ RSpec.shared_examples_for 'mail is sent' do
end
it 'is sent from the configured address' do
- expect(deliveries.first.from).to match_array([Setting.mail_from])
+ expect(deliveries.first.from).to contain_exactly(Setting.mail_from)
end
end
diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb
index 75325dbdcbf..bed4a396ae6 100644
--- a/spec/mailers/user_mailer_spec.rb
+++ b/spec/mailers/user_mailer_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe UserMailer do
subject(:deliveries) { ActionMailer::Base.deliveries }
diff --git a/spec/mailers/work_package_mailer_spec.rb b/spec/mailers/work_package_mailer_spec.rb
index 239d30bd384..b334c7f4c6f 100644
--- a/spec/mailers/work_package_mailer_spec.rb
+++ b/spec/mailers/work_package_mailer_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './shared_examples'
+require_relative 'shared_examples'
RSpec.describe WorkPackageMailer do
include OpenProject::ObjectLinking
@@ -63,7 +63,7 @@ RSpec.describe WorkPackageMailer do
it 'is sent to the recipient' do
expect(mail.to)
- .to match_array([recipient.mail])
+ .to contain_exactly(recipient.mail)
end
it 'has a project header' do
diff --git a/spec/models/activities/work_package_activity_provider_spec.rb b/spec/models/activities/work_package_activity_provider_spec.rb
index fb3febaff09..c3ac9b0dc8a 100644
--- a/spec/models/activities/work_package_activity_provider_spec.rb
+++ b/spec/models/activities/work_package_activity_provider_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe Activities::WorkPackageActivityProvider do
.map { |a| a.journable_id.to_s }
end
- it { is_expected.to eq(work_packages.reverse.first(3)) }
+ it { is_expected.to eq(work_packages.last(3).reverse) }
end
context 'when a work package has been created and then closed' do
diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb
index 57f4137e4fb..4dcc6e85d56 100644
--- a/spec/models/announcement_spec.rb
+++ b/spec/models/announcement_spec.rb
@@ -1,18 +1,41 @@
require 'spec_helper'
RSpec.describe Announcement do
- it do is_expected.to respond_to :text end
- it do is_expected.to respond_to :text= end
- it do is_expected.to respond_to :show_until end
- it do is_expected.to respond_to :show_until= end
- it do is_expected.to respond_to :active? end
- it do is_expected.to respond_to :active= end
+ it do
+ expect(subject).to respond_to :text
+ end
+
+ it do
+ expect(subject).to respond_to :text=
+ end
+
+ it do
+ expect(subject).to respond_to :show_until
+ end
+
+ it do
+ expect(subject).to respond_to :show_until=
+ end
+
+ it do
+ expect(subject).to respond_to :active?
+ end
+
+ it do
+ expect(subject).to respond_to :active=
+ end
describe 'class methods' do
describe '#only_one' do
context 'WHEN no announcement exists' do
- it do expect(Announcement.only_one.text).to eql 'Announcement' end
- it do expect(Announcement.only_one.show_until).to eql(Date.today + 14.days) end
+ it do
+ expect(Announcement.only_one.text).to eql 'Announcement'
+ end
+
+ it do
+ expect(Announcement.only_one.show_until).to eql(Date.today + 14.days)
+ end
+
it { expect(Announcement.only_one.active).to be false }
end
diff --git a/spec/models/attachment_spec.rb b/spec/models/attachment_spec.rb
index acf8a81d679..7cb4b58a8d3 100644
--- a/spec/models/attachment_spec.rb
+++ b/spec/models/attachment_spec.rb
@@ -68,7 +68,7 @@ RSpec.describe Attachment do
it 'raises an error regarding description length' do
expect(stubbed_attachment.errors[:description])
- .to match_array [I18n.t('activerecord.errors.messages.too_long', count: 255)]
+ .to contain_exactly(I18n.t('activerecord.errors.messages.too_long', count: 255))
end
end
@@ -103,7 +103,7 @@ RSpec.describe Attachment do
stubbed_attachment.valid?
expect(stubbed_attachment.errors.symbols_for(:container))
- .to match_array [:unchangeable]
+ .to contain_exactly(:unchangeable)
end
end
@@ -116,7 +116,7 @@ RSpec.describe Attachment do
stubbed_attachment.valid?
expect(stubbed_attachment.errors.symbols_for(:container))
- .to match_array [:unchangeable]
+ .to contain_exactly(:unchangeable)
end
end
@@ -129,7 +129,7 @@ RSpec.describe Attachment do
stubbed_attachment.valid?
expect(stubbed_attachment.errors.symbols_for(:container))
- .to match_array [:unchangeable]
+ .to contain_exactly(:unchangeable)
end
end
end
@@ -210,7 +210,7 @@ RSpec.describe Attachment do
# We just use with_direct_uploads here to make sure the
# FogAttachment class is defined and Fog is mocked.
- describe "#external_url", with_direct_uploads: true do
+ describe "#external_url", :with_direct_uploads do
let(:author) { create(:user) }
let(:image_path) { Rails.root.join("spec/fixtures/files/image.png") }
diff --git a/spec/models/attribute_help_text/work_package_spec.rb b/spec/models/attribute_help_text/work_package_spec.rb
index 7eee94049e1..cc940e65f30 100644
--- a/spec/models/attribute_help_text/work_package_spec.rb
+++ b/spec/models/attribute_help_text/work_package_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe AttributeHelpText::WorkPackage do
it 'returns the help text for the static attribute but not the one for the custom field' do
expect(subject)
- .to match_array([static_instance])
+ .to contain_exactly(static_instance)
end
end
@@ -100,7 +100,7 @@ RSpec.describe AttributeHelpText::WorkPackage do
it 'returns the help text for the static and cf attribute' do
expect(subject)
- .to match_array([static_instance, cf_instance])
+ .to contain_exactly(static_instance, cf_instance)
end
end
@@ -146,7 +146,7 @@ RSpec.describe AttributeHelpText::WorkPackage do
it 'returns the help text for the static and active cf attributes' do
expect(subject)
- .to match_array([static_instance, cf_instance_active, cf_instance_for_all])
+ .to contain_exactly(static_instance, cf_instance_active, cf_instance_for_all)
end
end
end
diff --git a/spec/models/custom_action_spec.rb b/spec/models/custom_action_spec.rb
index 369d4074117..63cd20e197b 100644
--- a/spec/models/custom_action_spec.rb
+++ b/spec/models/custom_action_spec.rb
@@ -96,7 +96,7 @@ RSpec.describe CustomAction do
stubbed_instance.actions = [CustomActions::Actions::AssignedTo.new(1)]
expect(stubbed_instance.actions.map { |a| [a.key, a.values] })
- .to match_array [[:assigned_to, [1]]]
+ .to contain_exactly([:assigned_to, [1]])
end
it 'can be persisted' do
@@ -105,7 +105,7 @@ RSpec.describe CustomAction do
instance.save!
expect(CustomAction.find(instance.id).actions.map { |a| [a.key, a.values] })
- .to match_array [[:assigned_to, [1]]]
+ .to contain_exactly([:assigned_to, [1]])
end
end
@@ -138,8 +138,7 @@ RSpec.describe CustomAction do
CustomActions::Conditions::Role.new(role.id)]
expect(stubbed_instance.conditions.map { |a| [a.key, a.values] })
- .to match_array [[:status, [status.id]],
- [:role, [role.id]]]
+ .to contain_exactly([:status, [status.id]], [:role, [role.id]])
end
it 'can be persisted' do
@@ -149,8 +148,7 @@ RSpec.describe CustomAction do
instance.save!
expect(CustomAction.find(instance.id).conditions.map { |a| [a.key, a.values] })
- .to match_array [[:status, [status.id]],
- [:role, [role.id]]]
+ .to contain_exactly([:status, [status.id]], [:role, [role.id]])
end
it 'existing permissions can be removed' do
@@ -216,10 +214,7 @@ RSpec.describe CustomAction do
describe '.all_conditions' do
it 'returns all available conditions with the default value initialized' do
expect(stubbed_instance.all_conditions.map { |a| [a.key, a.values] })
- .to match_array [[:status, []],
- [:role, []],
- [:type, []],
- [:project, []]]
+ .to contain_exactly([:status, []], [:role, []], [:type, []], [:project, []])
end
end
end
diff --git a/spec/models/custom_actions/shared_expectations.rb b/spec/models/custom_actions/shared_expectations.rb
index 5d191f4c93b..db3203e3f46 100644
--- a/spec/models/custom_actions/shared_expectations.rb
+++ b/spec/models/custom_actions/shared_expectations.rb
@@ -66,7 +66,7 @@ RSpec.shared_examples_for 'base custom action' do
describe '.all' do
it 'is an array with the class itself' do
expect(described_class.all)
- .to match_array [described_class]
+ .to contain_exactly(described_class)
end
end
@@ -392,7 +392,7 @@ RSpec.shared_examples_for 'int values transformation' do
instance.values = [42, nil, '23', 'some bogus', '12.34234', '42a34e324r32']
expect(instance.values)
- .to match_array [42, nil, 23]
+ .to contain_exactly(42, nil, 23)
end
end
end
@@ -403,7 +403,7 @@ RSpec.shared_examples_for 'float values transformation' do
instance.values = [42, nil, '23', 'some bogus', '12.34234', '42a34e324r32']
expect(instance.values)
- .to match_array [42, nil, 23, 12.34234]
+ .to contain_exactly(42, nil, 23, 12.34234)
end
end
end
@@ -414,7 +414,7 @@ RSpec.shared_examples_for 'string values transformation' do
instance.values = [42, nil, '23', 'some bogus', '12.34234', '42a34e324r32']
expect(instance.values)
- .to match_array ['42', nil, '23', 'some bogus', '12.34234', '42a34e324r32']
+ .to contain_exactly('42', nil, '23', 'some bogus', '12.34234', '42a34e324r32')
end
end
end
@@ -425,7 +425,7 @@ RSpec.shared_examples_for 'text values transformation' do
instance.values = [42, nil, '23', 'some bogus', '12.34234', '42a34e324r32']
expect(instance.values)
- .to match_array ['42', nil, '23', 'some bogus', '12.34234', '42a34e324r32']
+ .to contain_exactly('42', nil, '23', 'some bogus', '12.34234', '42a34e324r32')
end
end
end
@@ -436,7 +436,7 @@ RSpec.shared_examples_for 'date values transformation' do
instance.values = ["2015-03-29", Date.today, nil, (Date.today - 1.day).to_datetime, 'bogus', '%CURRENT_DATE%']
expect(instance.values)
- .to match_array [Date.parse("2015-03-29"), Date.today, nil, Date.today - 1.day, '%CURRENT_DATE%']
+ .to contain_exactly(Date.parse("2015-03-29"), Date.today, nil, Date.today - 1.day, '%CURRENT_DATE%')
end
end
end
diff --git a/spec/models/custom_option_spec.rb b/spec/models/custom_option_spec.rb
index e52fd2c0366..d5bbbe3583e 100644
--- a/spec/models/custom_option_spec.rb
+++ b/spec/models/custom_option_spec.rb
@@ -79,7 +79,7 @@ RSpec.describe CustomOption do
it 'reports an error' do
expect(custom_option.errors[:base])
- .to match_array [I18n.t(:'activerecord.errors.models.custom_field.at_least_one_custom_option')]
+ .to contain_exactly(I18n.t(:'activerecord.errors.models.custom_field.at_least_one_custom_option'))
end
it 'does not remove the custom option' do
diff --git a/spec/models/custom_style_spec.rb b/spec/models/custom_style_spec.rb
index ae6c82dca94..153277621a3 100644
--- a/spec/models/custom_style_spec.rb
+++ b/spec/models/custom_style_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe CustomStyle do
let!(:file_path) { custom_style.send(image).file.path }
before do
- custom_style.send "remove_#{image}"
+ custom_style.send :"remove_#{image}"
end
it 'deletes the file' do
diff --git a/spec/models/enterprise_token_spec.rb b/spec/models/enterprise_token_spec.rb
index 9be7e216337..e3caccc4b73 100644
--- a/spec/models/enterprise_token_spec.rb
+++ b/spec/models/enterprise_token_spec.rb
@@ -113,7 +113,7 @@ RSpec.describe EnterpriseToken do
end
context 'updating it with an invalid token' do
- it 'will fail validations' do
+ it 'fails validations' do
subject.encoded_token = "bar"
expect(subject.save).to be_falsey
end
diff --git a/spec/models/issue_priority_spec.rb b/spec/models/issue_priority_spec.rb
index 5873948db0d..0a711708da6 100644
--- a/spec/models/issue_priority_spec.rb
+++ b/spec/models/issue_priority_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe IssuePriority do
priority.transfer_relations(new_priority)
expect(new_priority.work_packages.reload)
- .to match_array [work_package3, work_package1]
+ .to contain_exactly(work_package3, work_package1)
end
end
diff --git a/spec/models/journable/timestamps_spec.rb b/spec/models/journable/timestamps_spec.rb
index d42da6701de..7356bcf0d20 100644
--- a/spec/models/journable/timestamps_spec.rb
+++ b/spec/models/journable/timestamps_spec.rb
@@ -625,7 +625,7 @@ RSpec.describe Journable::Timestamps do
end
it 'loads the custom_values relation with the historic values' do
- expect(subject.send("custom_field_#{custom_field.id}"))
+ expect(subject.send(:"custom_field_#{custom_field.id}"))
.to eq 'The custom field as it has been on Monday'
end
end
diff --git a/spec/models/journable/with_historic_attributes_spec.rb b/spec/models/journable/with_historic_attributes_spec.rb
index 726f742a74a..836c6954ae9 100644
--- a/spec/models/journable/with_historic_attributes_spec.rb
+++ b/spec/models/journable/with_historic_attributes_spec.rb
@@ -598,7 +598,7 @@ RSpec.describe Journable::WithHistoricAttributes,
context 'for a timestamp where the work package did exist' do
it 'returns the changed attributes at the timestamp compared to the current attribute values' do
expect(subject.changed_at_timestamp(Timestamp.parse("2022-01-01T00:00:00Z")))
- .to match_array ['subject']
+ .to contain_exactly('subject')
end
context 'when the work package includes custom field changes' do
diff --git a/spec/models/journal_spec.rb b/spec/models/journal_spec.rb
index cffa32b6d6f..1083c843a93 100644
--- a/spec/models/journal_spec.rb
+++ b/spec/models/journal_spec.rb
@@ -47,7 +47,7 @@ RSpec.describe Journal do
it 'has a notifications association' do
expect(journal.notifications)
- .to match_array([notification])
+ .to contain_exactly(notification)
end
it 'destroys the associated notifications upon journal destruction' do
diff --git a/spec/models/news_spec.rb b/spec/models/news_spec.rb
index 9aca488dfb6..7a19b664c00 100644
--- a/spec/models/news_spec.rb
+++ b/spec/models/news_spec.rb
@@ -57,7 +57,7 @@ RSpec.describe News do
end
it 'includes news elements from projects where news module is enabled' do
- expect(described_class.latest).to match_array [news]
+ expect(described_class.latest).to contain_exactly(news)
end
it "doesn't include news elements from projects where news module is not enabled" do
@@ -71,7 +71,7 @@ RSpec.describe News do
create(:news, project: private_project)
latest_news = described_class.latest(user: User.anonymous)
- expect(latest_news).to match_array [news]
+ expect(latest_news).to contain_exactly(news)
end
it 'limits the number of returned news elements' do
diff --git a/spec/models/notifications/scopes/reminder_mail_unsent_spec.rb b/spec/models/notifications/scopes/reminder_mail_unsent_spec.rb
index f3118ad9abb..2036b1ffb94 100644
--- a/spec/models/notifications/scopes/reminder_mail_unsent_spec.rb
+++ b/spec/models/notifications/scopes/reminder_mail_unsent_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Notifications::Scopes::MailReminderUnsent do
it 'contains the notifications with read_mail: false' do
expect(scope)
- .to match_array([unread_mail_notification])
+ .to contain_exactly(unread_mail_notification)
end
end
end
diff --git a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
index 0e94b4a5821..d700cde8548 100644
--- a/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
+++ b/spec/models/notifications/scopes/unsent_reminders_before_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Notifications::Scopes::UnsentRemindersBefore do
context 'with a unread and not reminded notification that was created before the time and for the user' do
it 'returns the notification' do
expect(scope)
- .to match_array([notification])
+ .to contain_exactly(notification)
end
end
diff --git a/spec/models/notifications/scopes/visible_spec.rb b/spec/models/notifications/scopes/visible_spec.rb
index f6024a9baaf..5bf28505535 100644
--- a/spec/models/notifications/scopes/visible_spec.rb
+++ b/spec/models/notifications/scopes/visible_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe Notifications::Scopes::Visible do
context 'with the user being recipient and being allowed to see the work package' do
it 'returns the notification' do
expect(scope)
- .to match_array([notification])
+ .to contain_exactly(notification)
end
end
diff --git a/spec/models/placeholder_users/scopes/visible_spec.rb b/spec/models/placeholder_users/scopes/visible_spec.rb
index e68e77d6f0b..e0cab80c604 100644
--- a/spec/models/placeholder_users/scopes/visible_spec.rb
+++ b/spec/models/placeholder_users/scopes/visible_spec.rb
@@ -45,7 +45,7 @@ RSpec.describe PlaceholderUsers::Scopes::Visible do
current_user { create(:user, member_with_roles: { project => role }) }
it 'sees all users' do
- expect(subject).to match_array [other_project_placeholder, global_placeholder]
+ expect(subject).to contain_exactly(other_project_placeholder, global_placeholder)
end
end
@@ -53,7 +53,7 @@ RSpec.describe PlaceholderUsers::Scopes::Visible do
current_user { create(:user, member_with_permissions: { other_project => %i[view_work_packages] }) }
it 'sees the other user in the same project' do
- expect(subject).to match_array [other_project_placeholder]
+ expect(subject).to contain_exactly(other_project_placeholder)
end
end
@@ -61,7 +61,7 @@ RSpec.describe PlaceholderUsers::Scopes::Visible do
current_user { create(:user) }
it 'sees nothing' do
- expect(subject).to match_array []
+ expect(subject).to be_empty
end
end
end
diff --git a/spec/models/principals/scopes/like_spec.rb b/spec/models/principals/scopes/like_spec.rb
index 06484eb9734..df9f3f223f4 100644
--- a/spec/models/principals/scopes/like_spec.rb
+++ b/spec/models/principals/scopes/like_spec.rb
@@ -57,22 +57,22 @@ RSpec.describe Principals::Scopes::Like do
it 'finds by login' do
expect(Principal.like('login'))
- .to match_array [login, login2]
+ .to contain_exactly(login, login2)
end
it 'finds by firstname' do
expect(Principal.like('firstname'))
- .to match_array [firstname, firstname2]
+ .to contain_exactly(firstname, firstname2)
end
it 'finds by lastname' do
expect(Principal.like('lastname'))
- .to match_array [lastname, lastname2]
+ .to contain_exactly(lastname, lastname2)
end
it 'finds by mail' do
expect(Principal.like('mail'))
- .to match_array [mail, mail2]
+ .to contain_exactly(mail, mail2)
end
end
end
diff --git a/spec/models/projects/project_acts_as_journalized_spec.rb b/spec/models/projects/project_acts_as_journalized_spec.rb
index 52c3ba276d1..f8650063c0c 100644
--- a/spec/models/projects/project_acts_as_journalized_spec.rb
+++ b/spec/models/projects/project_acts_as_journalized_spec.rb
@@ -46,32 +46,32 @@ RSpec.describe Project, 'acts_as_journalized' do
it 'notes the changes to name' do
expect(Journal.first.details[:name])
- .to match_array [nil, project.name]
+ .to contain_exactly(nil, project.name)
end
it 'notes the changes to description' do
expect(Journal.first.details[:description])
- .to match_array [nil, project.description]
+ .to contain_exactly(nil, project.description)
end
it 'notes the changes to public flag' do
expect(Journal.first.details[:public])
- .to match_array [nil, project.public]
+ .to contain_exactly(nil, project.public)
end
it 'notes the changes to identifier' do
expect(Journal.first.details[:identifier])
- .to match_array [nil, project.identifier]
+ .to contain_exactly(nil, project.identifier)
end
it 'notes the changes to active flag' do
expect(Journal.first.details[:active])
- .to match_array [nil, project.active]
+ .to contain_exactly(nil, project.active)
end
it 'notes the changes to template flag' do
expect(Journal.first.details[:templated])
- .to match_array [nil, project.templated]
+ .to contain_exactly(nil, project.templated)
end
it 'has the timestamp of the project update time for created_at' do
diff --git a/spec/models/queries/members/filters/principal_filter_spec.rb b/spec/models/queries/members/filters/principal_filter_spec.rb
index 92ca732bd04..abc177c964b 100644
--- a/spec/models/queries/members/filters/principal_filter_spec.rb
+++ b/spec/models/queries/members/filters/principal_filter_spec.rb
@@ -35,9 +35,6 @@ RSpec.describe Queries::Members::Filters::PrincipalFilter do
before do
login_as(current_user)
- end
-
- before do
principal_scope = double('principal scope')
allow(Principal)
diff --git a/spec/models/queries/principals/principal_query_integrations_spec.rb b/spec/models/queries/principals/principal_query_integrations_spec.rb
index 82f11e9f5dd..efdcabf81c0 100644
--- a/spec/models/queries/principals/principal_query_integrations_spec.rb
+++ b/spec/models/queries/principals/principal_query_integrations_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe Queries::Principals::PrincipalQuery, 'integration' do
it 'returns all principals being member' do
expect(instance.results)
- .to match_array [project_user]
+ .to contain_exactly(project_user)
end
end
@@ -80,7 +80,7 @@ RSpec.describe Queries::Principals::PrincipalQuery, 'integration' do
it 'returns all principals not being member' do
expect(instance.results)
- .to match_array [current_user, other_project_user]
+ .to contain_exactly(current_user, other_project_user)
end
end
end
diff --git a/spec/models/queries/projects/filters/type_filter_spec.rb b/spec/models/queries/projects/filters/type_filter_spec.rb
index 5b445b7c07a..33c81fe3d5d 100644
--- a/spec/models/queries/projects/filters/type_filter_spec.rb
+++ b/spec/models/queries/projects/filters/type_filter_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Queries::Projects::Filters::TypeFilter do
describe '#allowed_values' do
it 'is a list of the possible values' do
- expect(instance.allowed_values).to match_array([['Foo', '1234']])
+ expect(instance.allowed_values).to contain_exactly(['Foo', '1234'])
end
end
end
diff --git a/spec/models/queries/scopes/visible_spec.rb b/spec/models/queries/scopes/visible_spec.rb
index 29deb7d6e64..06ca67c0b05 100644
--- a/spec/models/queries/scopes/visible_spec.rb
+++ b/spec/models/queries/scopes/visible_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe Queries::Scopes::Visible do
context 'with the user having the :view_work_packages permission' do
it 'returns the queries that are public or that are the user`s' do
expect(scope)
- .to match_array([private_user_query, public_query, global_user_query, global_other_user_public_query])
+ .to contain_exactly(private_user_query, public_query, global_user_query, global_other_user_public_query)
end
end
diff --git a/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb b/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb
index 33cc50b0e99..167bd8592f6 100644
--- a/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/attachment_content_filter_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Queries::WorkPackages::Filter::AttachmentContentFilter do
perform_enqueued_jobs
expect(WorkPackage.joins(instance.joins).where(instance.where))
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
end
@@ -79,7 +79,7 @@ RSpec.describe Queries::WorkPackages::Filter::AttachmentContentFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb b/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb
index d19363f9cfa..be4b7acced0 100644
--- a/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/attachment_file_name_filter_spec.rb
@@ -53,7 +53,7 @@ RSpec.describe Queries::WorkPackages::Filter::AttachmentFileNameFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/author_filter_spec.rb b/spec/models/queries/work_packages/filter/author_filter_spec.rb
index a76987266dc..b31a4f6b268 100644
--- a/spec/models/queries/work_packages/filter/author_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/author_filter_spec.rb
@@ -107,8 +107,7 @@ RSpec.describe Queries::WorkPackages::Filter::AuthorFilter do
.and_return([[nil, user_1.id.to_s]])
expect(instance.allowed_values)
- .to match_array([[I18n.t(:label_me), 'me'],
- [nil, user_1.id.to_s]])
+ .to contain_exactly([I18n.t(:label_me), 'me'], [nil, user_1.id.to_s])
end
end
@@ -121,7 +120,7 @@ RSpec.describe Queries::WorkPackages::Filter::AuthorFilter do
.and_return([[nil, user_1.id.to_s]])
expect(instance.allowed_values)
- .to match_array([[nil, user_1.id.to_s]])
+ .to contain_exactly([nil, user_1.id.to_s])
end
end
end
diff --git a/spec/models/queries/work_packages/filter/category_filter_spec.rb b/spec/models/queries/work_packages/filter/category_filter_spec.rb
index 1ba52b99104..f1e83ad435c 100644
--- a/spec/models/queries/work_packages/filter/category_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/category_filter_spec.rb
@@ -74,7 +74,7 @@ RSpec.describe Queries::WorkPackages::Filter::CategoryFilter do
it 'returns an array of type options' do
expect(instance.allowed_values)
- .to match_array [[category.name, category.id.to_s]]
+ .to contain_exactly([category.name, category.id.to_s])
end
end
@@ -92,7 +92,7 @@ RSpec.describe Queries::WorkPackages::Filter::CategoryFilter do
it 'returns an array of category' do
expect(instance.value_objects)
- .to match_array [category2]
+ .to contain_exactly(category2)
end
end
diff --git a/spec/models/queries/work_packages/filter/comment_filter_spec.rb b/spec/models/queries/work_packages/filter/comment_filter_spec.rb
index 1eb458c8ed6..fb1bdcdd184 100644
--- a/spec/models/queries/work_packages/filter/comment_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/comment_filter_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Queries::WorkPackages::Filter::CommentFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/custom_fields/contains_text_custom_field_filter_spec.rb b/spec/models/queries/work_packages/filter/custom_fields/contains_text_custom_field_filter_spec.rb
index adb988939a1..ecd7b85ca73 100644
--- a/spec/models/queries/work_packages/filter/custom_fields/contains_text_custom_field_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/custom_fields/contains_text_custom_field_filter_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe Queries::WorkPackages::Filter::CustomFieldFilter,
it 'returns the one matching work package' do
expect(subject)
- .to match_array [wp_contains]
+ .to contain_exactly(wp_contains)
end
end
@@ -89,7 +89,7 @@ RSpec.describe Queries::WorkPackages::Filter::CustomFieldFilter,
it 'returns the three non-matching work package' do
expect(subject)
- .to match_array [wp_not_contains, wp_empty, wp_nil]
+ .to contain_exactly(wp_not_contains, wp_empty, wp_nil)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/description_filter_spec.rb b/spec/models/queries/work_packages/filter/description_filter_spec.rb
index f4cb3dd1358..e3b2bfdb261 100644
--- a/spec/models/queries/work_packages/filter/description_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/description_filter_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Queries::WorkPackages::Filter::DescriptionFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/duration_filter_spec.rb b/spec/models/queries/work_packages/filter/duration_filter_spec.rb
index dcf402e13d0..fda515ab51a 100644
--- a/spec/models/queries/work_packages/filter/duration_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/duration_filter_spec.rb
@@ -63,12 +63,12 @@ RSpec.describe Queries::WorkPackages::Filter::DurationFilter do
end
it 'finds zero and none values also including milestones' do
- expect(subject).to match_array [work_package_zero_duration, work_package_no_duration, work_package_with_milestone]
+ expect(subject).to contain_exactly(work_package_zero_duration, work_package_no_duration, work_package_with_milestone)
end
end
it 'does not returns milestone work packages' do
- expect(subject).to match_array [work_package_with_duration]
+ expect(subject).to contain_exactly(work_package_with_duration)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/estimated_hours_filter_spec.rb b/spec/models/queries/work_packages/filter/estimated_hours_filter_spec.rb
index 9cfae180147..6cf763e9f85 100644
--- a/spec/models/queries/work_packages/filter/estimated_hours_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/estimated_hours_filter_spec.rb
@@ -58,7 +58,7 @@ RSpec.describe Queries::WorkPackages::Filter::EstimatedHoursFilter do
end
it 'finds zero and none values' do
- expect(WorkPackage.where(instance.where)).to match_array [work_package_zero_hour, work_package_no_hours]
+ expect(WorkPackage.where(instance.where)).to contain_exactly(work_package_zero_hour, work_package_no_hours)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/group_filter_spec.rb b/spec/models/queries/work_packages/filter/group_filter_spec.rb
index c3a341c8af4..5be366010b3 100644
--- a/spec/models/queries/work_packages/filter/group_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/group_filter_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Queries::WorkPackages::Filter::GroupFilter do
it 'is an array of group values' do
expect(instance.allowed_values)
- .to match_array [[group.name, group.id.to_s]]
+ .to contain_exactly([group.name, group.id.to_s])
end
end
@@ -87,7 +87,7 @@ RSpec.describe Queries::WorkPackages::Filter::GroupFilter do
it 'returns an array of groups' do
expect(instance.value_objects)
- .to match_array([group2])
+ .to contain_exactly(group2)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/id_filter_spec.rb b/spec/models/queries/work_packages/filter/id_filter_spec.rb
index 975df2cfa8e..4ebcc8e0d04 100644
--- a/spec/models/queries/work_packages/filter/id_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/id_filter_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Queries::WorkPackages::Filter::IdFilter do
it 'filters' do
expect(WorkPackage.where(instance.where))
- .to match_array [visible_wp]
+ .to contain_exactly(visible_wp)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/manual_sort_filter_spec.rb b/spec/models/queries/work_packages/filter/manual_sort_filter_spec.rb
index 1ac6b4dbf1b..6b5079f7605 100644
--- a/spec/models/queries/work_packages/filter/manual_sort_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/manual_sort_filter_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Queries::WorkPackages::Filter::ManualSortFilter do
describe '#where' do
it 'filters based on the manual sort order' do
expect(WorkPackage.where(instance.where))
- .to match_array [in_order2, in_order]
+ .to contain_exactly(in_order2, in_order)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/parent_filter_spec.rb b/spec/models/queries/work_packages/filter/parent_filter_spec.rb
index 084597cc205..58c294a323a 100644
--- a/spec/models/queries/work_packages/filter/parent_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/parent_filter_spec.rb
@@ -114,7 +114,7 @@ RSpec.describe Queries::WorkPackages::Filter::ParentFilter do
.and_return([visible_wp])
expect(instance.value_objects)
- .to match_array [visible_wp]
+ .to contain_exactly(visible_wp)
end
context "with the 'templated' value" do
@@ -161,7 +161,7 @@ RSpec.describe Queries::WorkPackages::Filter::ParentFilter do
instance.valid_values!
expect(instance.values)
- .to match_array [visible_wp.id.to_s]
+ .to contain_exactly(visible_wp.id.to_s)
end
end
@@ -181,7 +181,7 @@ RSpec.describe Queries::WorkPackages::Filter::ParentFilter do
instance.valid_values!
expect(instance.values)
- .to match_array [visible_wp.id.to_s]
+ .to contain_exactly(visible_wp.id.to_s)
end
end
end
@@ -282,7 +282,7 @@ RSpec.describe Queries::WorkPackages::Filter::ParentFilter do
.where(instance.where)
expect(scope)
- .to match_array [visible_wp]
+ .to contain_exactly(visible_wp)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/principal_loader_spec.rb b/spec/models/queries/work_packages/filter/principal_loader_spec.rb
index 63a392bc86b..029f4a6bdf5 100644
--- a/spec/models/queries/work_packages/filter/principal_loader_spec.rb
+++ b/spec/models/queries/work_packages/filter/principal_loader_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#user_values' do
it 'returns a user array' do
- expect(instance.user_values).to match_array([[nil, user.id.to_s]])
+ expect(instance.user_values).to contain_exactly([nil, user.id.to_s])
end
it 'is empty if no user exists' do
@@ -58,7 +58,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#group_values' do
it 'returns a group array' do
- expect(instance.group_values).to match_array([[nil, group.id.to_s]])
+ expect(instance.group_values).to contain_exactly([nil, group.id.to_s])
end
it 'is empty if no group exists' do
@@ -73,9 +73,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#principal_values' do
it 'returns an array of principals as [name, id]' do
expect(instance.principal_values)
- .to match_array([[nil, group.id.to_s],
- [nil, user.id.to_s],
- [nil, placeholder_user.id.to_s]])
+ .to contain_exactly([nil, group.id.to_s], [nil, user.id.to_s], [nil, placeholder_user.id.to_s])
end
it 'is empty if no principal exists' do
@@ -105,7 +103,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#user_values' do
it 'returns a user array' do
- expect(instance.user_values).to match_array([[nil, user.id.to_s]])
+ expect(instance.user_values).to contain_exactly([nil, user.id.to_s])
end
context 'if no user exists' do
@@ -119,7 +117,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#group_values' do
it 'returns a group array' do
- expect(instance.group_values).to match_array([[nil, group.id.to_s]])
+ expect(instance.group_values).to contain_exactly([nil, group.id.to_s])
end
context 'if no group exists' do
@@ -134,9 +132,7 @@ RSpec.describe Queries::WorkPackages::Filter::PrincipalLoader do
describe '#principal_values' do
it 'returns an array of principals as [name, id]' do
expect(instance.principal_values)
- .to match_array([[nil, group.id.to_s],
- [nil, user.id.to_s],
- [nil, placeholder_user.id.to_s]])
+ .to contain_exactly([nil, group.id.to_s], [nil, user.id.to_s], [nil, placeholder_user.id.to_s])
end
context 'if no principals exist' do
diff --git a/spec/models/queries/work_packages/filter/priority_filter_spec.rb b/spec/models/queries/work_packages/filter/priority_filter_spec.rb
index 4e6e9c45711..ee3e02d0abe 100644
--- a/spec/models/queries/work_packages/filter/priority_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/priority_filter_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe Queries::WorkPackages::Filter::PriorityFilter do
it 'is an array of group values' do
expect(instance.allowed_values)
- .to match_array [[priority.name, priority.id.to_s]]
+ .to contain_exactly([priority.name, priority.id.to_s])
end
end
@@ -86,7 +86,7 @@ RSpec.describe Queries::WorkPackages::Filter::PriorityFilter do
it 'returns an array of priorities' do
expect(instance.value_objects)
- .to match_array([priority2])
+ .to contain_exactly(priority2)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/project_filter_spec.rb b/spec/models/queries/work_packages/filter/project_filter_spec.rb
index 3fec5cbb11c..8f9946ef221 100644
--- a/spec/models/queries/work_packages/filter/project_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/project_filter_spec.rb
@@ -99,8 +99,7 @@ RSpec.describe Queries::WorkPackages::Filter::ProjectFilter do
.and_yield(child, 1)
expect(instance.allowed_values)
- .to match_array [[parent.name, parent.id.to_s],
- ["-- #{child.name}", child.id.to_s]]
+ .to contain_exactly([parent.name, parent.id.to_s], ["-- #{child.name}", child.id.to_s])
end
end
@@ -124,7 +123,7 @@ RSpec.describe Queries::WorkPackages::Filter::ProjectFilter do
it 'returns an array of projects' do
expect(instance.value_objects)
- .to match_array([selected])
+ .to contain_exactly(selected)
end
context 'with a visible child' do
@@ -133,7 +132,7 @@ RSpec.describe Queries::WorkPackages::Filter::ProjectFilter do
it 'still only returns the parent object' do
expect(instance.value_objects)
- .to match_array([selected])
+ .to contain_exactly(selected)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/search_filter_spec.rb b/spec/models/queries/work_packages/filter/search_filter_spec.rb
index 96228dbf462..8f03344563c 100644
--- a/spec/models/queries/work_packages/filter/search_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/search_filter_spec.rb
@@ -48,13 +48,13 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
it 'finds in subject' do
instance.values = ['bogus subject']
expect(subject)
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
it 'finds in description' do
instance.values = ['short description']
expect(subject)
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
it 'finds in comments' do
@@ -63,7 +63,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
instance.values = [journal.notes]
expect(subject)
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
end
end
@@ -76,7 +76,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
it 'finds in subject' do
instance.values = ['big cat']
expect(subject)
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
end
@@ -88,7 +88,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
it 'does not match a partial result currently' do
instance.values = ['big cat']
expect(subject)
- .to match_array []
+ .to be_empty
end
end
@@ -114,7 +114,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
instance.values = ['ipsum']
expect(WorkPackage.joins(instance.joins).where(instance.where))
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
it "finds in attachment file name" do
@@ -122,7 +122,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
instance.values = [filename]
expect(WorkPackage.joins(instance.joins).where(instance.where))
- .to match_array [work_package]
+ .to contain_exactly(work_package)
end
end
@@ -148,7 +148,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
instance.values = ['plaintext']
expect(WorkPackage.joins(instance.joins).where(instance.where).pluck(:id))
- .to match_array [work_package.id]
+ .to contain_exactly(work_package.id)
end
end
end
@@ -177,7 +177,7 @@ RSpec.describe Queries::WorkPackages::Filter::SearchFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/status_filter_spec.rb b/spec/models/queries/work_packages/filter/status_filter_spec.rb
index e478cff57d3..d198b2b61ed 100644
--- a/spec/models/queries/work_packages/filter/status_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/status_filter_spec.rb
@@ -63,7 +63,7 @@ RSpec.describe Queries::WorkPackages::Filter::StatusFilter do
it 'is an array of status values' do
expect(instance.allowed_values)
- .to match_array [[status.name, status.id.to_s]]
+ .to contain_exactly([status.name, status.id.to_s])
end
end
@@ -79,7 +79,7 @@ RSpec.describe Queries::WorkPackages::Filter::StatusFilter do
it 'remove the invalid value' do
instance.valid_values!
- expect(instance.values).to match_array [status.id.to_s]
+ expect(instance.values).to contain_exactly(status.id.to_s)
end
end
@@ -94,7 +94,7 @@ RSpec.describe Queries::WorkPackages::Filter::StatusFilter do
instance.values = [status.id.to_s]
expect(instance.value_objects)
- .to match_array [status]
+ .to contain_exactly(status)
end
end
diff --git a/spec/models/queries/work_packages/filter/subject_filter_spec.rb b/spec/models/queries/work_packages/filter/subject_filter_spec.rb
index 5192efcfae0..1c04a6e72e2 100644
--- a/spec/models/queries/work_packages/filter/subject_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/subject_filter_spec.rb
@@ -52,7 +52,7 @@ RSpec.describe Queries::WorkPackages::Filter::SubjectFilter do
instance.valid_values!
expect(instance.values)
- .to match_array ['none', 'is', 'changed']
+ .to contain_exactly('none', 'is', 'changed')
end
end
diff --git a/spec/models/queries/work_packages/filter/subproject_filter_spec.rb b/spec/models/queries/work_packages/filter/subproject_filter_spec.rb
index f8422f22747..f79d42576f6 100644
--- a/spec/models/queries/work_packages/filter/subproject_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/subproject_filter_spec.rb
@@ -114,8 +114,8 @@ RSpec.describe Queries::WorkPackages::Filter::SubprojectFilter do
let(:projects) { [subproject1, subproject2] }
it 'returns a list of all visible descendants' do
- expect(instance.allowed_values).to match_array [[subproject1.name, subproject1.id.to_s],
- [subproject2.name, subproject2.id.to_s]]
+ expect(instance.allowed_values).to contain_exactly([subproject1.name, subproject1.id.to_s],
+ [subproject2.name, subproject2.id.to_s])
end
end
diff --git a/spec/models/queries/work_packages/filter/type_filter_spec.rb b/spec/models/queries/work_packages/filter/type_filter_spec.rb
index 0dbbe8d7cfc..4d87c724c89 100644
--- a/spec/models/queries/work_packages/filter/type_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/type_filter_spec.rb
@@ -89,7 +89,7 @@ RSpec.describe Queries::WorkPackages::Filter::TypeFilter do
it 'returns an array of type options' do
expect(instance.allowed_values)
- .to match_array [[type.name, type.id.to_s]]
+ .to contain_exactly([type.name, type.id.to_s])
end
end
@@ -104,7 +104,7 @@ RSpec.describe Queries::WorkPackages::Filter::TypeFilter do
it 'returns an array of type options' do
expect(instance.allowed_values)
- .to match_array [[type.name, type.id.to_s]]
+ .to contain_exactly([type.name, type.id.to_s])
end
end
end
@@ -130,7 +130,7 @@ RSpec.describe Queries::WorkPackages::Filter::TypeFilter do
it 'returns an array of types' do
expect(instance.value_objects)
- .to match_array([type1, type2])
+ .to contain_exactly(type1, type2)
end
end
end
diff --git a/spec/models/queries/work_packages/filter/version_filter_spec.rb b/spec/models/queries/work_packages/filter/version_filter_spec.rb
index 07981944b3d..e9e4eff6b58 100644
--- a/spec/models/queries/work_packages/filter/version_filter_spec.rb
+++ b/spec/models/queries/work_packages/filter/version_filter_spec.rb
@@ -85,7 +85,7 @@ RSpec.describe Queries::WorkPackages::Filter::VersionFilter do
context 'within a project' do
before do
expect(instance.allowed_values)
- .to match_array [[version.id.to_s, version.id.to_s]]
+ .to contain_exactly([version.id.to_s, version.id.to_s])
end
end
@@ -94,7 +94,7 @@ RSpec.describe Queries::WorkPackages::Filter::VersionFilter do
before do
expect(instance.allowed_values)
- .to match_array [[version.id.to_s, version.id.to_s]]
+ .to contain_exactly([version.id.to_s, version.id.to_s])
end
end
end
@@ -120,7 +120,7 @@ RSpec.describe Queries::WorkPackages::Filter::VersionFilter do
it 'returns an array of versions' do
expect(instance.value_objects)
- .to match_array([version1])
+ .to contain_exactly(version1)
end
end
end
diff --git a/spec/models/query/results_subject_filter_integration_spec.rb b/spec/models/query/results_subject_filter_integration_spec.rb
index 57279276f86..6a5817d8fc1 100644
--- a/spec/models/query/results_subject_filter_integration_spec.rb
+++ b/spec/models/query/results_subject_filter_integration_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe Query::Results, 'Subject filter integration' do
it 'returns the work packages containing the string regardless of order' do
expect(query_results.work_packages)
- .to match_array [contains_wp, contains_reversed_wp]
+ .to contain_exactly(contains_wp, contains_reversed_wp)
end
end
@@ -92,7 +92,7 @@ RSpec.describe Query::Results, 'Subject filter integration' do
it 'returns the work packages not containing the string regardless of order' do
expect(query_results.work_packages)
- .to match_array [not_contains_wp, partially_contains_wp]
+ .to contain_exactly(not_contains_wp, partially_contains_wp)
end
end
end
diff --git a/spec/models/relations/scopes/visible_spec.rb b/spec/models/relations/scopes/visible_spec.rb
index 02604bfb301..9c9f5731c0d 100644
--- a/spec/models/relations/scopes/visible_spec.rb
+++ b/spec/models/relations/scopes/visible_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe Relations::Scopes::Visible do
it 'returns the relations' do
expect(Relation.visible(user))
- .to match_array([relation1, relation2])
+ .to contain_exactly(relation1, relation2)
end
end
@@ -73,7 +73,7 @@ RSpec.describe Relations::Scopes::Visible do
it 'returns the relation within the one project' do
expect(Relation.visible(user))
- .to match_array([relation1])
+ .to contain_exactly(relation1)
end
end
diff --git a/spec/models/type_spec.rb b/spec/models/type_spec.rb
index c83db94cfe8..8287ccc3456 100644
--- a/spec/models/type_spec.rb
+++ b/spec/models/type_spec.rb
@@ -42,7 +42,7 @@ RSpec.describe Type do
end
it 'returns the types enabled in the provided project' do
- expect(Type.enabled_in(project)).to match_array([type])
+ expect(Type.enabled_in(project)).to contain_exactly(type)
end
end
diff --git a/spec/models/types/scopes/milestone_spec.rb b/spec/models/types/scopes/milestone_spec.rb
index 622b5242509..aaf33ba623d 100644
--- a/spec/models/types/scopes/milestone_spec.rb
+++ b/spec/models/types/scopes/milestone_spec.rb
@@ -37,7 +37,7 @@ RSpec.describe Types::Scopes::Milestone do
it 'returns only milestones' do
expect(subject)
- .to match_array [milestone]
+ .to contain_exactly(milestone)
end
end
end
diff --git a/spec/models/user_preference_spec.rb b/spec/models/user_preference_spec.rb
index 6e994116e4f..94a18fd3c4b 100644
--- a/spec/models/user_preference_spec.rb
+++ b/spec/models/user_preference_spec.rb
@@ -224,7 +224,7 @@ RSpec.describe UserPreference do
describe '[]=' do
let(:user) { create(:user) }
- it 'will save the values on sending "save"' do
+ it 'saves the values on sending "save"' do
subject.save
value_warn_on_leaving_unsaved = !subject[:warn_on_leaving_unsaved]
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index e8d02f79153..b4e9431ab4b 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -797,10 +797,10 @@ RSpec.describe User do
expect([user1.id, user2.id]).to include(match2.id)
matches = described_class.where_mail_with_suffix('[email protected]')
- expect(matches.pluck(:id)).to match_array [user1.id, user2.id]
+ expect(matches.pluck(:id)).to contain_exactly(user1.id, user2.id)
matches = described_class.where_mail_with_suffix('[email protected]')
- expect(matches.pluck(:id)).to match_array [user1.id]
+ expect(matches.pluck(:id)).to contain_exactly(user1.id)
end
end
@@ -816,7 +816,7 @@ RSpec.describe User do
expect([user1.id, user2.id, user3.id]).to include(match2.id)
matches = described_class.where_mail_with_suffix('[email protected]')
- expect(matches.pluck(:id)).to match_array [user1.id, user2.id, user3.id]
+ expect(matches.pluck(:id)).to contain_exactly(user1.id, user2.id, user3.id)
end
end
end
diff --git a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
index 285198faa38..e4719942d37 100644
--- a/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
+++ b/spec/models/users/scopes/having_reminder_mail_to_send_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
context 'for a user whose local time is matching the configured time' do
it 'contains the user' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -135,7 +135,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -179,7 +179,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([hawaii_user])
+ .to contain_exactly(hawaii_user)
end
context 'when the user disables Wednesday as a workday' do
@@ -217,7 +217,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([hawaii_user])
+ .to contain_exactly(hawaii_user)
end
end
end
@@ -249,7 +249,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([samoa_user])
+ .to contain_exactly(samoa_user)
end
context 'when the user disables Wednesday as a workday' do
@@ -283,7 +283,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([moscow_user])
+ .to contain_exactly(moscow_user)
end
end
@@ -301,7 +301,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -319,7 +319,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -381,7 +381,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -428,7 +428,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'contains the user' do
expect(scope)
- .to match_array([kathmandu_user])
+ .to contain_exactly(kathmandu_user)
end
end
@@ -569,7 +569,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'is including the user as Etc/UTC is assumed' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -590,7 +590,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'is including the user as Etc/UTC is assumed' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -606,7 +606,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'is including the user as Etc/UTC at 08:00 is assumed' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
@@ -648,7 +648,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'is including the configured default timezone is assumed' do
expect(scope)
- .to match_array([moscow_user])
+ .to contain_exactly(moscow_user)
end
end
@@ -671,7 +671,7 @@ RSpec.describe User, '.having_reminder_mail_to_send' do
it 'is including the user as Etc/UTC at 08:00 is assumed' do
expect(scope)
- .to match_array([paris_user])
+ .to contain_exactly(paris_user)
end
end
diff --git a/spec/models/version_spec.rb b/spec/models/version_spec.rb
index c898927fe9a..485a96b6113 100644
--- a/spec/models/version_spec.rb
+++ b/spec/models/version_spec.rb
@@ -87,7 +87,7 @@ RSpec.describe Version do
version.sharing = 'system'
version.save!
- expect(described_class.systemwide).to match_array [version]
+ expect(described_class.systemwide).to contain_exactly(version)
end
it 'is empty if the version is not shared' do
@@ -258,52 +258,41 @@ RSpec.describe Version do
it 'returns project the version is defined in for unshared' do
unshared_version.save
- expect(unshared_version.projects).to match_array([parent_project])
+ expect(unshared_version.projects).to contain_exactly(parent_project)
end
it 'returns all projects the version is shared with (hierarchy)' do
hierarchy_shared_version.save!
- expect(hierarchy_shared_version.projects).to match_array([grand_parent_project,
- parent_project,
- child_project,
- sibling_project])
+ expect(hierarchy_shared_version.projects).to contain_exactly(grand_parent_project, parent_project, child_project,
+ sibling_project)
end
it 'returns all projects the version is shared with (descendants)' do
descendants_shared_version.save!
- expect(descendants_shared_version.projects).to match_array([parent_project,
- child_project,
- sibling_project])
+ expect(descendants_shared_version.projects).to contain_exactly(parent_project, child_project, sibling_project)
end
it 'returns all projects the version is shared with (tree)' do
tree_shared_version.save!
- expect(tree_shared_version.projects).to match_array([grand_parent_project,
- parent_project,
- sibling_parent_project,
- child_project,
- sibling_project])
+ expect(tree_shared_version.projects).to contain_exactly(grand_parent_project, parent_project, sibling_parent_project,
+ child_project, sibling_project)
end
it 'returns all projects the version is shared with (system)' do
system_shared_version.save!
- expect(system_shared_version.projects).to match_array([grand_parent_project,
- parent_project,
- sibling_parent_project,
- child_project,
- sibling_project,
- unrelated_project])
+ expect(system_shared_version.projects).to contain_exactly(grand_parent_project, parent_project, sibling_parent_project,
+ child_project, sibling_project, unrelated_project)
end
it 'returns only the projects for the version although there is a system shared version' do
unshared_version.save
system_shared_version.save!
- expect(unshared_version.projects).to match_array([parent_project])
+ expect(unshared_version.projects).to contain_exactly(parent_project)
end
end
diff --git a/spec/models/versions/scopes/rolled_up_spec.rb b/spec/models/versions/scopes/rolled_up_spec.rb
index 2f2e320255d..01c9b0b6161 100644
--- a/spec/models/versions/scopes/rolled_up_spec.rb
+++ b/spec/models/versions/scopes/rolled_up_spec.rb
@@ -43,14 +43,14 @@ RSpec.describe Versions::Scopes::RolledUp do
describe '.rolled_up' do
it 'includes versions of self and all descendants' do
expect(project.rolled_up_versions)
- .to match_array [version, child_version, grand_child_version]
+ .to contain_exactly(version, child_version, grand_child_version)
end
it 'excludes versions from inactive projects' do
grand_child_project.update(active: false)
expect(project.rolled_up_versions)
- .to match_array [version, child_version]
+ .to contain_exactly(version, child_version)
end
end
end
diff --git a/spec/models/versions/scopes/shared_with_spec.rb b/spec/models/versions/scopes/shared_with_spec.rb
index afaace78930..8ba486266d1 100644
--- a/spec/models/versions/scopes/shared_with_spec.rb
+++ b/spec/models/versions/scopes/shared_with_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe Versions::Scopes::SharedWith do
it 'is visible within the original project' do
expect(Version.shared_with(project))
- .to match_array [version]
+ .to contain_exactly(version)
end
it 'is not visible in any other project' do
@@ -69,7 +69,7 @@ RSpec.describe Versions::Scopes::SharedWith do
child_project,
grand_child_project].each do |p|
expect(Version.shared_with(p))
- .to match_array [version]
+ .to contain_exactly(version)
end
end
@@ -110,7 +110,7 @@ RSpec.describe Versions::Scopes::SharedWith do
child_project,
grand_child_project].each do |p|
expect(Version.shared_with(p))
- .to match_array [version]
+ .to contain_exactly(version)
end
end
@@ -151,7 +151,7 @@ RSpec.describe Versions::Scopes::SharedWith do
aunt_project,
sibling_project].each do |p|
expect(Version.shared_with(p))
- .to match_array [version]
+ .to contain_exactly(version)
end
end
@@ -191,7 +191,7 @@ RSpec.describe Versions::Scopes::SharedWith do
sibling_project,
other_root_project].each do |p|
expect(Version.shared_with(p))
- .to match_array [version]
+ .to contain_exactly(version)
end
end
diff --git a/spec/models/watcher_spec.rb b/spec/models/watcher_spec.rb
index 00b5bf4794a..75520efab4d 100644
--- a/spec/models/watcher_spec.rb
+++ b/spec/models/watcher_spec.rb
@@ -205,7 +205,7 @@ RSpec.describe Watcher do
.to match_array(saved_user)
end
- it 'will not add the same user when called twice' do
+ it 'does not add the same user when called twice' do
saved_watchable.add_watcher(saved_user)
saved_watchable.add_watcher(saved_user)
@@ -253,7 +253,7 @@ RSpec.describe Watcher do
expect(saved_watchable)
.to be_valid
expect(saved_watchable.watchers.map(&:user))
- .to match_array([saved_user])
+ .to contain_exactly(saved_user)
end
end
end
diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb
index 3f113e28545..1403c7f83f4 100644
--- a/spec/models/wiki_page_spec.rb
+++ b/spec/models/wiki_page_spec.rb
@@ -91,7 +91,7 @@ RSpec.describe WikiPage do
context 'with another default language', with_settings: { default_language: 'de' } do
let(:wiki_page) { build(:wiki_page, wiki:, title: 'Übersicht') }
- it 'will still use english slug methods' do
+ it 'stills use english slug methods' do
expect(wiki_page.save).to be true
expect(wiki_page.slug).to eq 'ubersicht'
end
@@ -100,7 +100,7 @@ RSpec.describe WikiPage do
context 'with another I18n.locale set', with_settings: { default_language: 'de' } do
let(:wiki_page) { build(:wiki_page, wiki:, title: 'Übersicht') }
- it 'will still use english slug methods' do
+ it 'stills use english slug methods' do
I18n.locale = :de
expect(wiki_page.save).to be true
expect(wiki_page.slug).to eq 'ubersicht'
@@ -176,7 +176,7 @@ RSpec.describe WikiPage do
new_wiki_page.valid?
expect(new_wiki_page.errors.symbols_for(:title))
- .to match_array [:blank]
+ .to contain_exactly(:blank)
end
end
end
@@ -284,7 +284,7 @@ RSpec.describe WikiPage do
it 'returns all pages for which the user has the \'view_wiki_pages\' permission' do
expect(described_class.visible(user))
- .to match_array [wiki_page]
+ .to contain_exactly(wiki_page)
end
end
diff --git a/spec/models/work_package/work_package_custom_actions_spec.rb b/spec/models/work_package/work_package_custom_actions_spec.rb
index 04689085fb6..64493120cc6 100644
--- a/spec/models/work_package/work_package_custom_actions_spec.rb
+++ b/spec/models/work_package/work_package_custom_actions_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe WorkPackage, 'custom_actions' do
it 'returns the action' do
expect(work_package.custom_actions(user))
- .to match_array [custom_action]
+ .to contain_exactly(custom_action)
end
end
@@ -79,7 +79,7 @@ RSpec.describe WorkPackage, 'custom_actions' do
it 'returns the action' do
expect(work_package.custom_actions(user))
- .to match_array [custom_action]
+ .to contain_exactly(custom_action)
end
end
@@ -103,7 +103,7 @@ RSpec.describe WorkPackage, 'custom_actions' do
context 'with the user having the same role' do
it 'returns the action' do
expect(work_package.custom_actions(user))
- .to match_array [custom_action]
+ .to contain_exactly(custom_action)
end
end
diff --git a/spec/models/work_package/work_package_custom_fields_spec.rb b/spec/models/work_package/work_package_custom_fields_spec.rb
index 2ff3b3a3b8f..8a6bca2d127 100644
--- a/spec/models/work_package/work_package_custom_fields_spec.rb
+++ b/spec/models/work_package/work_package_custom_fields_spec.rb
@@ -60,7 +60,7 @@ RSpec.describe WorkPackage do
def self.change_custom_field_value(work_package, value, save: true)
val = custom_field.custom_options.find { |co| co.value == value }.try(:id)
- work_package.custom_field_values = { custom_field.id => (val || value) }
+ work_package.custom_field_values = { custom_field.id => val || value }
work_package.save if save
end
end
@@ -168,7 +168,7 @@ RSpec.describe WorkPackage do
it 'stores the symbol' do
actual_symbols = work_package.errors.symbols_for(custom_field_key)
- expect(actual_symbols).to match_array([error_key.to_sym])
+ expect(actual_symbols).to contain_exactly(error_key.to_sym)
end
end
diff --git a/spec/models/work_package/work_package_visibility_spec.rb b/spec/models/work_package/work_package_visibility_spec.rb
index 9c334d32389..2bb0d9bfee0 100644
--- a/spec/models/work_package/work_package_visibility_spec.rb
+++ b/spec/models/work_package/work_package_visibility_spec.rb
@@ -46,7 +46,7 @@ RSpec.describe 'WorkPackage-Visibility' do
# is a default in Redmine::DefaultData::Loader - but this not loaded in the tests: here we
# just make sure, that the work package is visible, when this permission is set
ProjectRole.anonymous.add_permission! :view_work_packages
- expect(WorkPackage.visible(anonymous)).to match_array [subject]
+ expect(WorkPackage.visible(anonymous)).to contain_exactly(subject)
end
end
@@ -54,11 +54,11 @@ RSpec.describe 'WorkPackage-Visibility' do
subject { create(:work_package, project: private_project) }
it 'is visible for the admin, even if the project is private' do
- expect(WorkPackage.visible(admin)).to match_array [subject]
+ expect(WorkPackage.visible(admin)).to contain_exactly(subject)
end
it 'is not visible for anonymous users, when the project is private' do
- expect(WorkPackage.visible(anonymous)).to match_array []
+ expect(WorkPackage.visible(anonymous)).to be_empty
end
it 'is visible for members of the project, with the view_work_packages permission' do
@@ -67,7 +67,7 @@ RSpec.describe 'WorkPackage-Visibility' do
project: private_project,
role_ids: [view_work_packages.id])
- expect(WorkPackage.visible(user)).to match_array [subject]
+ expect(WorkPackage.visible(user)).to contain_exactly(subject)
end
it 'is only returned once for members with two roles having view_work_packages permission' do
@@ -79,11 +79,11 @@ RSpec.describe 'WorkPackage-Visibility' do
role_ids: [view_work_packages.id,
view_work_packages_role2.id])
- expect(WorkPackage.visible(user).pluck(:id)).to match_array [subject.id]
+ expect(WorkPackage.visible(user).pluck(:id)).to contain_exactly(subject.id)
end
it 'is not visible for non-members of the project without the view_work_packages permission' do
- expect(WorkPackage.visible(user)).to match_array []
+ expect(WorkPackage.visible(user)).to be_empty
end
it 'is not visible for members of the project, without the view_work_packages permission' do
@@ -93,7 +93,7 @@ RSpec.describe 'WorkPackage-Visibility' do
project: private_project,
role_ids: [no_permission.id])
- expect(WorkPackage.visible(user)).to match_array []
+ expect(WorkPackage.visible(user)).to be_empty
end
end
end
diff --git a/spec/models/work_packages/scopes/for_scheduling_spec.rb b/spec/models/work_packages/scopes/for_scheduling_spec.rb
index f58f9ab09b4..7f99d65c51c 100644
--- a/spec/models/work_packages/scopes/for_scheduling_spec.rb
+++ b/spec/models/work_packages/scopes/for_scheduling_spec.rb
@@ -129,7 +129,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the parent' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent])
+ .to contain_exactly(parent)
end
end
@@ -138,7 +138,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor])
+ .to contain_exactly(successor)
end
end
@@ -166,7 +166,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the successor, its child and parent' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_parent])
+ .to contain_exactly(successor, successor_child, successor_parent)
end
end
@@ -188,7 +188,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the successor and its child' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child])
+ .to contain_exactly(successor, successor_child)
end
end
@@ -214,7 +214,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the successor, its child and parent and the successor successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_parent, successor_successor])
+ .to contain_exactly(successor, successor_child, successor_parent, successor_successor)
end
end
@@ -225,7 +225,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the successor, its child and successor successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_successor])
+ .to contain_exactly(successor, successor_child, successor_successor)
end
end
@@ -251,7 +251,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the successor, its child and parent' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_parent])
+ .to contain_exactly(successor, successor_parent)
end
end
@@ -273,7 +273,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor])
+ .to contain_exactly(successor)
end
end
@@ -296,7 +296,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the successor, its child and the successor˚s successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_child2, successor_successor])
+ .to contain_exactly(successor, successor_child, successor_child2, successor_successor)
end
end
@@ -307,7 +307,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the successor, its automatically scheduled child and the successor˚s successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor_child, successor, successor_successor])
+ .to contain_exactly(successor_child, successor, successor_successor)
end
end
@@ -329,7 +329,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the parent, grandparent' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent, grandparent])
+ .to contain_exactly(parent, grandparent)
end
end
@@ -338,7 +338,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the parent, parent successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent, parent_successor])
+ .to contain_exactly(parent, parent_successor)
end
end
@@ -348,7 +348,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the parent, self and the whole parent successor hierarchy' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent, parent_successor, parent_successor_parent, parent_successor_child])
+ .to contain_exactly(parent, parent_successor, parent_successor_parent, parent_successor_child)
end
end
@@ -359,7 +359,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'consists of the parent' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent])
+ .to contain_exactly(parent)
end
end
@@ -381,7 +381,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the parent and self' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([parent])
+ .to contain_exactly(parent)
end
end
end
@@ -392,7 +392,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of both successors' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_successor])
+ .to contain_exactly(successor, successor_successor)
end
end
@@ -414,7 +414,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor])
+ .to contain_exactly(successor)
end
end
end
@@ -425,7 +425,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of both successors' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_grandchild])
+ .to contain_exactly(successor, successor_child, successor_grandchild)
end
end
@@ -436,7 +436,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array [successor]
+ .to contain_exactly(successor)
end
end
end
@@ -451,7 +451,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
context 'with all scheduled automatically' do
it 'consists of the successor with its descendants' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_grandchild, successor_grandchild2])
+ .to contain_exactly(successor, successor_child, successor_grandchild, successor_grandchild2)
end
end
@@ -462,7 +462,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the successor and the non automatically scheduled descendants' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, successor_child, successor_grandchild2])
+ .to contain_exactly(successor, successor_child, successor_grandchild2)
end
end
@@ -474,7 +474,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'includes successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor])
+ .to contain_exactly(successor)
end
end
@@ -498,7 +498,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the successor' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array [successor]
+ .to contain_exactly(successor)
end
end
end
@@ -515,7 +515,7 @@ RSpec.describe WorkPackages::Scopes::ForScheduling, 'allowed scope' do
it 'contains the successor and the parents but not the siblings' do
expect(WorkPackage.for_scheduling([origin]))
- .to match_array([successor, parent, successor_parent])
+ .to contain_exactly(successor, parent, successor_parent)
end
end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 8da493b6910..58fb8e04892 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -74,9 +74,9 @@ require 'rubocop/rspec/support'
# may lead to broken specs on the CI, if we don't sort here
# (example: with_config.rb has to precede with_direct_uploads.rb).
#
-require_relative "./support/parallel_helper"
-require_relative "./support/download_list"
-require_relative "./support/capybara"
+require_relative "support/parallel_helper"
+require_relative "support/download_list"
+require_relative "support/capybara"
Dir[Rails.root.join('spec/support/**/*.rb')].sort.each { |f| require_relative f }
Dir[Rails.root.join('spec/features/support/**/*.rb')].sort.each { |f| require f }
Dir[Rails.root.join('spec/lib/api/v3/support/**/*.rb')].sort.each { |f| require f }
@@ -88,7 +88,7 @@ ActiveRecord::Migration.maintain_test_schema! unless ENV['CI']
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{Rails.root}/spec/fixtures"
+ config.fixture_path = "#{Rails.root.join('spec/fixtures')}"
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
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 63656d1d463..f662e7d5121 100644
--- a/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb
+++ b/spec/requests/api/v3/attachments/attachment_resource_shared_examples.rb
@@ -536,7 +536,7 @@ RSpec.shared_examples 'an APIv3 attachment resource', content_type: :json, type:
subject(:response) { last_response }
describe '#get' do
- let(:get_path) { api_v3_paths.send "attachments_by_#{attachment_type}", container.id }
+ let(:get_path) { api_v3_paths.send :"attachments_by_#{attachment_type}", container.id }
before do
create_list(:attachment, 2, container:)
@@ -551,7 +551,7 @@ RSpec.shared_examples 'an APIv3 attachment resource', content_type: :json, type:
end
describe '#post' do
- let(:request_path) { api_v3_paths.send "attachments_by_#{attachment_type}", container.id }
+ let(:request_path) { api_v3_paths.send :"attachments_by_#{attachment_type}", container.id }
let(:request_parts) { { metadata: metadata.to_json, file: } }
let(:metadata) { { fileName: 'cat.png' } }
let(:file) { mock_uploaded_file(name: 'original-filename.txt') }
diff --git a/spec/requests/api/v3/attachments/wiki_page_spec.rb b/spec/requests/api/v3/attachments/wiki_page_spec.rb
index 3996029ba6b..7b4c0263c33 100644
--- a/spec/requests/api/v3/attachments/wiki_page_spec.rb
+++ b/spec/requests/api/v3/attachments/wiki_page_spec.rb
@@ -27,7 +27,7 @@
#++
require 'spec_helper'
-require_relative './attachment_resource_shared_examples'
+require_relative 'attachment_resource_shared_examples'
RSpec.describe "wiki page attachments" do
it_behaves_like "an APIv3 attachment resource" do
diff --git a/spec/requests/api/v3/notifications/show_resource_spec.rb b/spec/requests/api/v3/notifications/show_resource_spec.rb
index 64c4c751144..a7c19b0bbc2 100644
--- a/spec/requests/api/v3/notifications/show_resource_spec.rb
+++ b/spec/requests/api/v3/notifications/show_resource_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
require 'spec_helper'
-require_relative './show_resource_examples'
+require_relative 'show_resource_examples'
RSpec.describe API::V3::Notifications::NotificationsAPI,
'show',
diff --git a/spec/requests/api/v3/queries/schemas/query_filter_instance_schema_resource_spec.rb b/spec/requests/api/v3/queries/schemas/query_filter_instance_schema_resource_spec.rb
index ff02fca2c7f..90b23da77af 100644
--- a/spec/requests/api/v3/queries/schemas/query_filter_instance_schema_resource_spec.rb
+++ b/spec/requests/api/v3/queries/schemas/query_filter_instance_schema_resource_spec.rb
@@ -62,7 +62,7 @@ RSpec.describe 'API v3 Query Filter Schema resource' do
%i[global
project].each do |current_path|
context current_path do
- let(:path) { send "#{current_path}_path".to_sym }
+ let(:path) { send :"#{current_path}_path" }
it 'succeeds' do
expect(subject.status)
diff --git a/spec/requests/api/v3/relations/relations_index_spec.rb b/spec/requests/api/v3/relations/relations_index_spec.rb
index e6e706d007a..12e9f94c098 100644
--- a/spec/requests/api/v3/relations/relations_index_spec.rb
+++ b/spec/requests/api/v3/relations/relations_index_spec.rb
@@ -85,31 +85,31 @@ RSpec.describe 'GET /api/v3/relations' do
# This saves about 75% on the runtime (6s vs 24s on this machine) of the spec.
it 'work' do
expect(filter_relations("id", "=", [relations[0], relations[2]]))
- .to match_array [relations[0], relations[2]]
+ .to contain_exactly(relations[0], relations[2])
expect(filter_relations("id", "!", [relations[0], relations[2]]))
- .to match_array [relations[1], relations[3]]
+ .to contain_exactly(relations[1], relations[3])
expect(filter_relations("from", "=", [work_package.id]))
- .to match_array [relations[0], relations[1]]
+ .to contain_exactly(relations[0], relations[1])
expect(filter_relations("from", "!", [work_package.id]))
- .to match_array [relations[2], relations[3]]
+ .to contain_exactly(relations[2], relations[3])
expect(filter_relations("to", "=", [work_package.id]))
.to eq [relations[2]]
expect(filter_relations("to", "!", [work_package.id]))
- .to match_array [relations[0], relations[1], relations[3]]
+ .to contain_exactly(relations[0], relations[1], relations[3])
expect(filter_relations("involved", "=", [work_package.id]))
- .to match_array [relations[0], relations[1], relations[2]]
+ .to contain_exactly(relations[0], relations[1], relations[2])
expect(filter_relations("involved", "!", [work_package.id]))
.to eq [relations[3]]
expect(filter_relations("type", "=", ["blocks"]))
- .to match_array [relations[1], relations[3]]
+ .to contain_exactly(relations[1], relations[3])
expect(filter_relations("type", "=", ["blocks", "precedes"]))
- .to match_array [relations[0], relations[1], relations[2], relations[3]]
+ .to contain_exactly(relations[0], relations[1], relations[2], relations[3])
expect(filter_relations("type", "!", ["blocks"]))
- .to match_array [relations[0], relations[2]]
+ .to contain_exactly(relations[0], relations[2])
end
end
end
diff --git a/spec/requests/api/v3/root_resource_spec.rb b/spec/requests/api/v3/root_resource_spec.rb
index 252280c7870..255b4698a37 100644
--- a/spec/requests/api/v3/root_resource_spec.rb
+++ b/spec/requests/api/v3/root_resource_spec.rb
@@ -80,7 +80,7 @@ RSpec.describe 'API v3 Root resource' do
expect(subject).to have_json_path('instanceName')
end
- context 'without the X-requested-with header', skip_xhr_header: true do
+ context 'without the X-requested-with header', :skip_xhr_header do
it 'returns OK because GET requests are allowed' do
expect(response.status).to eq(200)
expect(subject).to have_json_path('instanceName')
diff --git a/spec/requests/api/v3/user/filters_spec.rb b/spec/requests/api/v3/user/filters_spec.rb
index 0bbc773d6f4..f2f417931d3 100644
--- a/spec/requests/api/v3/user/filters_spec.rb
+++ b/spec/requests/api/v3/user/filters_spec.rb
@@ -61,29 +61,29 @@ RSpec.describe 'GET /api/v3/users' do
describe 'status filter' do
it '=' do
- expect(filter_users("status", "=", :active)).to match_array ["admin", "h.wurst", "m.mario"]
+ expect(filter_users("status", "=", :active)).to contain_exactly("admin", "h.wurst", "m.mario")
end
it '!' do
- expect(filter_users("status", "!", :active)).to match_array ["h.heine"]
+ expect(filter_users("status", "!", :active)).to contain_exactly("h.heine")
end
end
describe 'login filter' do
it '=' do
- expect(filter_users("login", "=", "admin")).to match_array ["admin"]
+ expect(filter_users("login", "=", "admin")).to contain_exactly("admin")
end
it '!' do
- expect(filter_users("login", "!", "admin")).to match_array ["h.wurst", "h.heine", "m.mario"]
+ expect(filter_users("login", "!", "admin")).to contain_exactly("h.wurst", "h.heine", "m.mario")
end
it '~' do
- expect(filter_users("login", "~", "h.")).to match_array ["h.wurst", "h.heine"]
+ expect(filter_users("login", "~", "h.")).to contain_exactly("h.wurst", "h.heine")
end
it '!~' do
- expect(filter_users("login", "!~", "h.")).to match_array ["admin", "m.mario"]
+ expect(filter_users("login", "!~", "h.")).to contain_exactly("admin", "m.mario")
end
end
end
diff --git a/spec/requests/api/v3/versions/project_resource_spec.rb b/spec/requests/api/v3/versions/project_resource_spec.rb
index 7657746e223..cac5d1b62d3 100644
--- a/spec/requests/api/v3/versions/project_resource_spec.rb
+++ b/spec/requests/api/v3/versions/project_resource_spec.rb
@@ -78,7 +78,7 @@ RSpec.describe "API v3 version's projects resource" do
it 'includes only the projects which the user can see' do
id_in_response = JSON.parse(response.body)['_embedded']['elements'].map { |p| p['id'] }
- expect(id_in_response).to match_array [project.id, project2.id, project3.id]
+ expect(id_in_response).to contain_exactly(project.id, project2.id, project3.id)
end
end
diff --git a/spec/requests/api/v3/work_packages/available_projects_on_edit_api_spec.rb b/spec/requests/api/v3/work_packages/available_projects_on_edit_api_spec.rb
index 8b9f076fe2b..90a3b82d8a1 100644
--- a/spec/requests/api/v3/work_packages/available_projects_on_edit_api_spec.rb
+++ b/spec/requests/api/v3/work_packages/available_projects_on_edit_api_spec.rb
@@ -34,7 +34,7 @@ RSpec.describe 'API::V3::WorkPackages::AvailableProjectsOnEditAPI' do
let(:edit_role) do
create(:project_role, permissions: %i[edit_work_packages
- view_work_packages])
+ view_work_packages])
end
let(:move_role) do
create(:project_role, permissions: [:move_work_packages])
diff --git a/spec/requests/api/v3/work_packages/show_resource_spec.rb b/spec/requests/api/v3/work_packages/show_resource_spec.rb
index abf2c2264d1..05438fa1c49 100644
--- a/spec/requests/api/v3/work_packages/show_resource_spec.rb
+++ b/spec/requests/api/v3/work_packages/show_resource_spec.rb
@@ -121,7 +121,7 @@ RSpec.describe 'API v3 Work package resource',
# resolves links
expect(subject['html'])
- .to have_selector("opce-macro-wp-quickinfo[data-id='#{other_wp.id}']")
+ .to have_css("opce-macro-wp-quickinfo[data-id='#{other_wp.id}']")
# resolves macros, e.g. toc
expect(subject['html'])
.to have_css('.op-uc-toc--list-item', text: "OpenProject Masterplan for 2015")
diff --git a/spec/requests/auth/auth_source_sso_spec.rb b/spec/requests/auth/auth_source_sso_spec.rb
index 26f7007effe..26eb723c72c 100644
--- a/spec/requests/auth/auth_source_sso_spec.rb
+++ b/spec/requests/auth/auth_source_sso_spec.rb
@@ -28,8 +28,7 @@
require 'spec_helper'
-RSpec.describe AuthSourceSSO,
- skip_2fa_stage: true, # Prevent redirects to 2FA stage
+RSpec.describe AuthSourceSSO, :skip_2fa_stage, # Prevent redirects to 2FA stage
type: :rails_request do
let(:sso_config) do
{
diff --git a/spec/requests/openid_google_provider_callback_spec.rb b/spec/requests/openid_google_provider_callback_spec.rb
index e92620b4389..21f294622f6 100644
--- a/spec/requests/openid_google_provider_callback_spec.rb
+++ b/spec/requests/openid_google_provider_callback_spec.rb
@@ -90,7 +90,7 @@ RSpec.describe 'OpenID Google provider callback', with_ee: %i[openid_providers]
}
end
- it 'redirects user without errors', webmock: true, with_settings: {
+ it 'redirects user without errors', :webmock, with_settings: {
plugin_openproject_openid_connect: {
"providers" => { "google" => { "identifier" => "identifier", "secret" => "secret" } }
}
diff --git a/spec/requests/rate_limiting/lost_password_rate_limiting_spec.rb b/spec/requests/rate_limiting/lost_password_rate_limiting_spec.rb
index 7df4ad442d0..1fc76692422 100644
--- a/spec/requests/rate_limiting/lost_password_rate_limiting_spec.rb
+++ b/spec/requests/rate_limiting/lost_password_rate_limiting_spec.rb
@@ -31,7 +31,6 @@ require 'spec_helper'
RSpec.describe 'Rate limiting lost_password',
:with_rack_attack,
type: :rails_request do
-
before do
allow_any_instance_of(ActionController::Base) # rubocop:disable RSpec/AnyInstance
.to(receive(:protect_against_forgery?))
diff --git a/spec/routing/activities_spec.rb b/spec/routing/activities_spec.rb
index e2d676ed493..342885be454 100644
--- a/spec/routing/activities_spec.rb
+++ b/spec/routing/activities_spec.rb
@@ -39,6 +39,7 @@ RSpec.describe ActivitiesController, 'routing' do
action: 'index',
format: 'atom')
}
+
it {
expect(get('/activity/menu')).to route_to(controller: 'activities',
action: 'menu')
diff --git a/spec/seeders/demo_data/work_package_seeder_spec.rb b/spec/seeders/demo_data/work_package_seeder_spec.rb
index 161a6a14e13..3e4d4b1d3dd 100644
--- a/spec/seeders/demo_data/work_package_seeder_spec.rb
+++ b/spec/seeders/demo_data/work_package_seeder_spec.rb
@@ -74,7 +74,7 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will start n days after the Monday of the current week' do
+ it 'starts n days after the Monday of the current week' do
current_week_monday = Date.current.monday
expect(WorkPackage.first.start_date).to eq(current_week_monday + 2.days)
expect(WorkPackage.second.start_date).to eq(current_week_monday + 42.days)
@@ -89,7 +89,7 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will start n days before the Monday of the current week' do
+ it 'starts n days before the Monday of the current week' do
current_week_monday = Date.current.monday
expect(WorkPackage.first.start_date).to eq(current_week_monday - 3.days)
expect(WorkPackage.second.start_date).to eq(current_week_monday - 17.days)
@@ -105,7 +105,7 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will have finish date calculated being start + duration - 1' do
+ it 'has finish date calculated being start + duration - 1' do
current_week_monday = Date.current.monday
expect(WorkPackage.first.due_date).to eq(current_week_monday)
expect(WorkPackage.second.due_date).to eq(current_week_monday + 5.days)
@@ -120,11 +120,11 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will have no duration' do
+ it 'has no duration' do
expect(WorkPackage.first.duration).to be_nil
end
- it 'will have no finish date' do
+ it 'has no finish date' do
expect(WorkPackage.first.due_date).to be_nil
end
end
@@ -136,17 +136,17 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will have ignore_non_working_day set to true' do
+ it 'has ignore_non_working_day set to true' do
expect(WorkPackage.first.ignore_non_working_days).to be(false)
end
- it 'will have finish date calculated from duration based on real days' do
+ it 'has finish date calculated from duration based on real days' do
work_package = WorkPackage.first
expect(work_package.due_date).to eq(work_package.start_date + 9.days)
expect(work_package.due_date.wday).to eq(4)
end
- it 'will have duration adjusted to count only working days' do
+ it 'has duration adjusted to count only working days' do
expect(WorkPackage.first.duration).to eq(8)
end
end
@@ -159,12 +159,12 @@ RSpec.describe DemoData::WorkPackageSeeder do
]
end
- it 'will have ignore_non_working_day set to true' do
+ it 'has ignore_non_working_day set to true' do
expect(WorkPackage.first.ignore_non_working_days).to be(true)
expect(WorkPackage.second.ignore_non_working_days).to be(true)
end
- it 'will have duration being the same as defined' do
+ it 'has duration being the same as defined' do
expect(WorkPackage.first.duration).to eq(3)
expect(WorkPackage.second.duration).to eq(7)
end
diff --git a/spec/services/authorization/query_transformation_spec.rb b/spec/services/authorization/query_transformation_spec.rb
index ddafb06fcaa..d1bb100b8f3 100644
--- a/spec/services/authorization/query_transformation_spec.rb
+++ b/spec/services/authorization/query_transformation_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe Authorization::QueryTransformation do
context 'apply' do
it 'calls the block' do
- expect(instance.apply(1, 2, 3)).to match_array [1, 2, 3]
+ expect(instance.apply(1, 2, 3)).to contain_exactly(1, 2, 3)
end
end
end
diff --git a/spec/services/authorization/query_transformations_spec.rb b/spec/services/authorization/query_transformations_spec.rb
index 52f0276d481..5f4a3baf26c 100644
--- a/spec/services/authorization/query_transformations_spec.rb
+++ b/spec/services/authorization/query_transformations_spec.rb
@@ -54,7 +54,7 @@ RSpec.describe Authorization::QueryTransformations do
expect(instance.for(:on)[0].on).to be :on
expect(instance.for(:on)[0].name).to be :name
- expect(instance.for(:on)[0].block.call(1, 2, 3)).to match_array [1, 2, 3]
+ expect(instance.for(:on)[0].block.call(1, 2, 3)).to contain_exactly(1, 2, 3)
end
it 'is nil for another name' do
@@ -94,7 +94,7 @@ RSpec.describe Authorization::QueryTransformations do
expect(instance.for(:on)[1].on).to be :on
expect(instance.for(:on)[1].name).to be :transformation1
- expect(instance.for(:on)[1].block.call(1, 2, 3)).to match_array [1, 2, 3]
+ expect(instance.for(:on)[1].block.call(1, 2, 3)).to contain_exactly(1, 2, 3)
end
end
end
@@ -130,7 +130,7 @@ RSpec.describe Authorization::QueryTransformations do
expect(instance.for(:on)[1].on).to be :on
expect(instance.for(:on)[1].name).to be :transformation1
- expect(instance.for(:on)[1].block.call(1, 2, 3)).to match_array [1, 2, 3]
+ expect(instance.for(:on)[1].block.call(1, 2, 3)).to contain_exactly(1, 2, 3)
end
end
end
diff --git a/spec/services/authorization/user_allowed_query_spec.rb b/spec/services/authorization/user_allowed_query_spec.rb
index a660fd385b6..0237efce486 100644
--- a/spec/services/authorization/user_allowed_query_spec.rb
+++ b/spec/services/authorization/user_allowed_query_spec.rb
@@ -69,7 +69,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the user' do
- expect(described_class.query(action, project)).to match_array [user]
+ expect(described_class.query(action, project)).to contain_exactly(user)
end
end
@@ -81,7 +81,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the user' do
- expect(described_class.query(action, project)).to match_array [user]
+ expect(described_class.query(action, project)).to contain_exactly(user)
end
end
@@ -162,7 +162,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the user' do
- expect(described_class.query(action, project)).to match_array [user]
+ expect(described_class.query(action, project)).to contain_exactly(user)
end
end
@@ -180,7 +180,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the anonymous user' do
- expect(described_class.query(action, project)).to match_array([anonymous])
+ expect(described_class.query(action, project)).to contain_exactly(anonymous)
end
end
@@ -248,7 +248,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the user' do
- expect(described_class.query(public_action, project)).to match_array [user]
+ expect(described_class.query(public_action, project)).to contain_exactly(user)
end
end
@@ -262,7 +262,7 @@ RSpec.describe Authorization::UserAllowedQuery do
end
it 'returns the user and anonymous' do
- expect(described_class.query(public_action, project)).to match_array [user, anonymous]
+ expect(described_class.query(public_action, project)).to contain_exactly(user, anonymous)
end
end
diff --git a/spec/services/custom_actions/update_service_spec.rb b/spec/services/custom_actions/update_service_spec.rb
index 4604c174731..29b135972ca 100644
--- a/spec/services/custom_actions/update_service_spec.rb
+++ b/spec/services/custom_actions/update_service_spec.rb
@@ -138,7 +138,7 @@ RSpec.describe CustomActions::UpdateService do
.map { |a| [a.key, a.values] }
expect(new_actions)
- .to match_array [[:assigned_to, [2]], [:priority, [3]]]
+ .to contain_exactly([:assigned_to, [2]], [:priority, [3]])
end
it 'handles unknown actions' do
@@ -149,7 +149,7 @@ RSpec.describe CustomActions::UpdateService do
.map { |a| [a.key, a.values] }
expect(new_actions)
- .to match_array [[:inexistent, ['3']]]
+ .to contain_exactly([:inexistent, ['3']])
end
it 'updates the conditions' do
@@ -165,7 +165,7 @@ RSpec.describe CustomActions::UpdateService do
.map { |a| [a.key, a.values] }
expect(new_conditions)
- .to match_array [[:status, [new_status.id]]]
+ .to contain_exactly([:status, [new_status.id]])
end
it 'handles unknown conditions' do
@@ -176,7 +176,7 @@ RSpec.describe CustomActions::UpdateService do
.map { |a| [a.key, a.values] }
expect(new_conditions)
- .to match_array [[:inexistent, [3]]]
+ .to contain_exactly([:inexistent, [3]])
end
end
end
diff --git a/spec/services/notifications/create_from_journal_job_shared.rb b/spec/services/notifications/create_from_journal_job_shared.rb
index 9cf5cd0b836..41234362c77 100644
--- a/spec/services/notifications/create_from_journal_job_shared.rb
+++ b/spec/services/notifications/create_from_journal_job_shared.rb
@@ -87,7 +87,7 @@ RSpec.shared_context 'with CreateFromJournalJob context' do
.and_return(ServiceResult.success(result: notification))
expect(call.all_results)
- .to match_array([notification])
+ .to contain_exactly(notification)
expect(notifications_service)
.to have_received(:call)
diff --git a/spec/services/notifications/create_from_model_service_comment_spec.rb b/spec/services/notifications/create_from_model_service_comment_spec.rb
index 25ec8b5035e..981bd479bca 100644
--- a/spec/services/notifications/create_from_model_service_comment_spec.rb
+++ b/spec/services/notifications/create_from_model_service_comment_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'spec_helper'
-require_relative './create_from_journal_job_shared'
+require_relative 'create_from_journal_job_shared'
RSpec.describe Notifications::CreateFromModelService, 'comment', with_settings: { journal_aggregation_time_minutes: 0 } do
subject(:call) do
diff --git a/spec/services/notifications/create_from_model_service_message_spec.rb b/spec/services/notifications/create_from_model_service_message_spec.rb
index 989a110a024..b21702e52e8 100644
--- a/spec/services/notifications/create_from_model_service_message_spec.rb
+++ b/spec/services/notifications/create_from_model_service_message_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'spec_helper'
-require_relative './create_from_journal_job_shared'
+require_relative 'create_from_journal_job_shared'
RSpec.describe Notifications::CreateFromModelService, 'message', with_settings: { journal_aggregation_time_minutes: 0 } do
subject(:call) do
diff --git a/spec/services/notifications/create_from_model_service_news_spec.rb b/spec/services/notifications/create_from_model_service_news_spec.rb
index 4dba5a1bea3..f99c6f78b46 100644
--- a/spec/services/notifications/create_from_model_service_news_spec.rb
+++ b/spec/services/notifications/create_from_model_service_news_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'spec_helper'
-require_relative './create_from_journal_job_shared'
+require_relative 'create_from_journal_job_shared'
RSpec.describe Notifications::CreateFromModelService, 'news', with_settings: { journal_aggregation_time_minutes: 0 } do
subject(:call) do
diff --git a/spec/services/notifications/create_from_model_service_wiki_spec.rb b/spec/services/notifications/create_from_model_service_wiki_spec.rb
index 85224b497bf..70efcc2b750 100644
--- a/spec/services/notifications/create_from_model_service_wiki_spec.rb
+++ b/spec/services/notifications/create_from_model_service_wiki_spec.rb
@@ -26,7 +26,7 @@
# See COPYRIGHT and LICENSE files for more details.
#++
require 'spec_helper'
-require_relative './create_from_journal_job_shared'
+require_relative 'create_from_journal_job_shared'
RSpec.describe Notifications::CreateFromModelService, 'wiki', with_settings: { journal_aggregation_time_minutes: 0 } do
subject(:call) do
diff --git a/spec/services/notifications/create_service_intergration_spec.rb b/spec/services/notifications/create_service_intergration_spec.rb
index 96ddf6621ba..fbae6c67130 100644
--- a/spec/services/notifications/create_service_intergration_spec.rb
+++ b/spec/services/notifications/create_service_intergration_spec.rb
@@ -82,7 +82,7 @@ RSpec.describe Notifications::CreateService, 'integration', type: :model do
.to be_failure
expect(service_result.errors.details[:journal_id])
- .to match_array [{ error: :does_not_exist }]
+ .to contain_exactly({ error: :does_not_exist })
end
end
end
diff --git a/spec/services/notifications/mail_service_mentioned_integration_spec.rb b/spec/services/notifications/mail_service_mentioned_integration_spec.rb
index c5450737fd9..b31521b207a 100644
--- a/spec/services/notifications/mail_service_mentioned_integration_spec.rb
+++ b/spec/services/notifications/mail_service_mentioned_integration_spec.rb
@@ -78,7 +78,7 @@ RSpec.describe Notifications::MailService, 'Mentioned integration', type: :model
expect(assigned_notification.mail_alert_sent).to be false
end
- it 'will trigger only one mention notification mail when editing attributes afterwards' do
+ it 'triggers only one mention notification mail when editing attributes afterwards' do
allow(WorkPackageMailer)
.to receive(:mentioned)
.and_call_original
diff --git a/spec/services/notifications/mail_service_spec.rb b/spec/services/notifications/mail_service_spec.rb
index 1a4c1ed79ba..6b5550af8de 100644
--- a/spec/services/notifications/mail_service_spec.rb
+++ b/spec/services/notifications/mail_service_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
RSpec.describe Notifications::MailService, type: :model do
- require_relative './mentioned_journals_shared'
+ require_relative 'mentioned_journals_shared'
subject(:call) { instance.call }
diff --git a/spec/services/parse_schema_filter_params_service_spec.rb b/spec/services/parse_schema_filter_params_service_spec.rb
index 0571075d4bb..acd11fccd24 100644
--- a/spec/services/parse_schema_filter_params_service_spec.rb
+++ b/spec/services/parse_schema_filter_params_service_spec.rb
@@ -67,7 +67,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns the [project, type] pair' do
- expect(result.result).to match_array [[project, type]]
+ expect(result.result).to contain_exactly([project, type])
end
end
@@ -79,7 +79,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns an empty array' do
- expect(result.result).to match_array []
+ expect(result.result).to be_empty
end
end
@@ -91,7 +91,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns an empty array' do
- expect(result.result).to match_array []
+ expect(result.result).to be_empty
end
end
@@ -109,7 +109,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns an error message' do
- expect(result.errors.messages[:base]).to match_array ['The operator is not supported.']
+ expect(result.errors.messages[:base]).to contain_exactly('The operator is not supported.')
end
end
@@ -127,7 +127,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns an error message' do
- expect(result.errors.messages[:base]).to match_array ['A value is invalid.']
+ expect(result.errors.messages[:base]).to contain_exactly('A value is invalid.')
end
end
@@ -145,7 +145,7 @@ RSpec.describe ParseSchemaFilterParamsService do
end
it 'returns an error message' do
- expect(result.errors.messages[:base]).to match_array ['An \'id\' filter is required.']
+ expect(result.errors.messages[:base]).to contain_exactly('An \'id\' filter is required.')
end
end
end
diff --git a/spec/services/projects/copy_service_integration_spec.rb b/spec/services/projects/copy_service_integration_spec.rb
index 01a2bb804af..d48b613d147 100644
--- a/spec/services/projects/copy_service_integration_spec.rb
+++ b/spec/services/projects/copy_service_integration_spec.rb
@@ -216,7 +216,6 @@ RSpec.describe(
context 'with all modules selected' do
let(:only_args) { all_modules }
- # rubocop:disable RSpec/IndexedLet
let(:storage1) { source_automatic_project_storage.storage }
let(:storage2) { source_manual_project_storage.storage }
# rubocop:enable RSpec/IndexedLet
@@ -1014,7 +1013,7 @@ RSpec.describe(
context 'with wiki' do
let(:only_args) { %i[wiki] }
- it 'will copy wiki menu items' do
+ it 'copies wiki menu items' do
source.wiki.wiki_menu_items << create(:wiki_menu_item_with_parent, wiki: source.wiki)
expect(subject).to be_success
@@ -1057,7 +1056,7 @@ RSpec.describe(
let(:only_args) { nil }
# rubocop:disable RSpec/MultipleExpectations
- it 'will set attributes only without copying dependencies' do
+ it 'sets attributes only without copying dependencies' do
expect(subject).to be_success
expect(project_copy.members.count).to eq 1
@@ -1102,7 +1101,7 @@ RSpec.describe(
create(:group, members: [user])
end
- it 'will not copy group members' do
+ it 'does not copy group members' do
Members::CreateService
.new(user: current_user, contract_class: EmptyContract)
.call(principal: group, roles: [another_role], project: source)
diff --git a/spec/services/projects/delete_service_spec.rb b/spec/services/projects/delete_service_spec.rb
index 7eb0c9aa69e..e7bfb97ea10 100644
--- a/spec/services/projects/delete_service_spec.rb
+++ b/spec/services/projects/delete_service_spec.rb
@@ -48,7 +48,7 @@ RSpec.describe Projects::DeleteService, type: :model do
.not_to have_received(:new)
end
- context 'when the file storages are involved', webmock: true do
+ context 'when the file storages are involved', :webmock do
it 'removes any remote storages defined for the project' do
storage = create(:nextcloud_storage)
project_storage = create(:project_storage, project:, storage:)
diff --git a/spec/services/projects/set_attributes_service_integration_spec.rb b/spec/services/projects/set_attributes_service_integration_spec.rb
index 3209949332f..4f87d001909 100644
--- a/spec/services/projects/set_attributes_service_integration_spec.rb
+++ b/spec/services/projects/set_attributes_service_integration_spec.rb
@@ -43,7 +43,7 @@ RSpec.describe Projects::SetAttributesService, 'integration', type: :model do
describe 'with a project name starting with numbers' do
let(:attributes) { { name: '100 Project A' } }
- it 'will create an identifier including the numbers' do
+ it 'creates an identifier including the numbers' do
expect(service_result).to be_success
expect(service_result.result.identifier).to eq '100-project-a'
end
@@ -56,7 +56,7 @@ RSpec.describe Projects::SetAttributesService, 'integration', type: :model do
context 'and a new project with no identifier set' do
let(:project) { Project.new name: 'My new project' }
- it 'will auto-correct the identifier' do
+ it 'auto-corrects the identifier' do
expect(service_result).to be_success
expect(service_result.result.identifier).to eq 'my-new-project-1'
end
@@ -65,7 +65,7 @@ RSpec.describe Projects::SetAttributesService, 'integration', type: :model do
context 'and a new project with the same identifier set' do
let(:project) { Project.new name: 'My new project', identifier: 'my-new-project' }
- it 'will result in an error' do
+ it 'results in an error' do
expect(service_result).not_to be_success
expect(service_result.result.identifier).to eq 'my-new-project'
diff --git a/spec/services/relations/update_service_spec.rb b/spec/services/relations/update_service_spec.rb
index 45731bdefb2..cb6e633f189 100644
--- a/spec/services/relations/update_service_spec.rb
+++ b/spec/services/relations/update_service_spec.rb
@@ -138,7 +138,7 @@ RSpec.describe Relations::UpdateService do
it 'has a dependent result for the from-work package' do
expect(subject.dependent_results)
- .to match_array [set_schedule_work_package2_result]
+ .to contain_exactly(set_schedule_work_package2_result)
end
end
diff --git a/spec/services/scm/create_managed_repository_service_spec.rb b/spec/services/scm/create_managed_repository_service_spec.rb
index 612e7449c4c..21b6dd34637 100644
--- a/spec/services/scm/create_managed_repository_service_spec.rb
+++ b/spec/services/scm/create_managed_repository_service_spec.rb
@@ -141,7 +141,7 @@ RSpec.describe SCM::CreateManagedRepositoryService, skip_if_command_unavailable:
end
end
- context 'with managed remote config', webmock: true do
+ context 'with managed remote config', :webmock do
let(:url) { 'http://myreposerver.example.com/api/' }
let(:config) do
{
diff --git a/spec/services/scm/delete_managed_repository_service_spec.rb b/spec/services/scm/delete_managed_repository_service_spec.rb
index ac90129d537..9af99b6dc7a 100644
--- a/spec/services/scm/delete_managed_repository_service_spec.rb
+++ b/spec/services/scm/delete_managed_repository_service_spec.rb
@@ -115,7 +115,7 @@ RSpec.describe SCM::DeleteManagedRepositoryService, skip_if_command_unavailable:
end
end
- context 'with managed remote config', webmock: true do
+ context 'with managed remote config', :webmock do
let(:url) { 'http://myreposerver.example.com/api/' }
let(:config) do
{
diff --git a/spec/services/settings/update_service_spec.rb b/spec/services/settings/update_service_spec.rb
index abff0b6e38e..f29ab572242 100644
--- a/spec/services/settings/update_service_spec.rb
+++ b/spec/services/settings/update_service_spec.rb
@@ -28,7 +28,6 @@ require 'spec_helper'
require_relative 'shared/shared_call_examples'
require_relative 'shared/shared_setup_context'
-
RSpec.describe Settings::UpdateService do
include_context 'with update service setup'
diff --git a/spec/services/users/create_service_spec.rb b/spec/services/users/create_service_spec.rb
index 2ebfb5655c1..4df2c4af537 100644
--- a/spec/services/users/create_service_spec.rb
+++ b/spec/services/users/create_service_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Users::CreateService do
context 'and the mail is present' do
let(:model_instance) { build(:invited_user, mail: '[email protected]') }
- it 'will call UserInvitation' do
+ it 'calls UserInvitation' do
expect(UserInvitation).to receive(:invite_user!).with(model_instance).and_return(model_instance)
expect(subject).to be_success
end
@@ -45,7 +45,7 @@ RSpec.describe Users::CreateService do
context 'and the user has no names set' do
let(:model_instance) { build(:invited_user, firstname: nil, lastname: nil, mail: '[email protected]') }
- it 'will call UserInvitation' do
+ it 'calls UserInvitation' do
expect(UserInvitation).to receive(:invite_user!).with(model_instance).and_return(model_instance)
expect(subject).to be_success
end
@@ -54,7 +54,7 @@ RSpec.describe Users::CreateService do
context 'and the mail is empty' do
let(:model_instance) { build(:invited_user, mail: nil) }
- it 'will call not call UserInvitation' do
+ it 'calls not call UserInvitation' do
expect(UserInvitation).not_to receive(:invite_user!)
expect(subject).not_to be_success
expect(subject.errors.details[:mail]).to eq [{ error: :blank }]
diff --git a/spec/services/users/logout_service_spec.rb b/spec/services/users/logout_service_spec.rb
index 2e1ee7ee9ee..bf8996a7aa3 100644
--- a/spec/services/users/logout_service_spec.rb
+++ b/spec/services/users/logout_service_spec.rb
@@ -103,7 +103,6 @@ RSpec.describe Users::LogoutService, type: :model do
expect(Sessions::UserSession.for_user(user).count).to eq(2)
end
-
describe 'autologin cookie' do
let!(:token) { create(:autologin_token, user:) }
let!(:other_token) { create(:autologin_token, user:) }
diff --git a/spec/services/work_packages/update_ancestors/loader_spec.rb b/spec/services/work_packages/update_ancestors/loader_spec.rb
index be6daaa28fa..7243c76bf24 100644
--- a/spec/services/work_packages/update_ancestors/loader_spec.rb
+++ b/spec/services/work_packages/update_ancestors/loader_spec.rb
@@ -216,38 +216,29 @@ RSpec.describe WorkPackages::UpdateAncestors::Loader, type: :model do
context 'for the work_package' do
it 'is its child (as a hash)' do
expect(instance.descendants_of(work_package))
- .to match_array([descendants_of_hash(child)])
+ .to contain_exactly(descendants_of_hash(child))
end
end
context 'for the parent' do
it 'is the work package, its child (as a hash) and its sibling (as a hash)' do
expect(instance.descendants_of(parent))
- .to match_array([descendants_of_hash(child),
- work_package,
- descendants_of_hash(sibling)])
+ .to contain_exactly(descendants_of_hash(child), work_package, descendants_of_hash(sibling))
end
end
context 'for the grandparent' do
it 'is the parent, the work package, its child (as a hash) and its sibling (as a hash)' do
expect(instance.descendants_of(grandparent))
- .to match_array([parent,
- work_package,
- descendants_of_hash(child),
- descendants_of_hash(sibling)])
+ .to contain_exactly(parent, work_package, descendants_of_hash(child), descendants_of_hash(sibling))
end
end
context 'for the grandgrandparent (the root)' do
it 'is the complete tree, partly as a hash and partly as the preloaded work packages' do
expect(instance.descendants_of(grandgrandparent))
- .to match_array([descendants_of_hash(grandparent_sibling),
- grandparent,
- parent,
- work_package,
- descendants_of_hash(child),
- descendants_of_hash(sibling)])
+ .to contain_exactly(descendants_of_hash(grandparent_sibling), grandparent, parent, work_package,
+ descendants_of_hash(child), descendants_of_hash(sibling))
end
end
end
@@ -265,30 +256,28 @@ RSpec.describe WorkPackages::UpdateAncestors::Loader, type: :model do
context 'for the work_package' do
it 'is its child (as a hash)' do
expect(instance.children_of(work_package))
- .to match_array([children_of_hash(child)])
+ .to contain_exactly(children_of_hash(child))
end
end
context 'for the parent' do
it 'is the work package and its sibling (as a hash)' do
expect(instance.children_of(parent))
- .to match_array([work_package,
- children_of_hash(sibling)])
+ .to contain_exactly(work_package, children_of_hash(sibling))
end
end
context 'for the grandparent' do
it 'is the parent' do
expect(instance.children_of(grandparent))
- .to match_array([parent])
+ .to contain_exactly(parent)
end
end
context 'for the grandgrandparent' do
it 'is the grandparent and its sibling (as a hash)' do
expect(instance.children_of(grandgrandparent))
- .to match_array([children_of_hash(grandparent_sibling),
- grandparent])
+ .to contain_exactly(children_of_hash(grandparent_sibling), grandparent)
end
end
end
diff --git a/spec/support/angular.rb b/spec/support/angular.rb
index 713b1973cd2..e1aa5a96d1d 100644
--- a/spec/support/angular.rb
+++ b/spec/support/angular.rb
@@ -29,5 +29,5 @@
##
# Wait for the angular bootstrap to have happened
def expect_angular_frontend_initialized
- expect(page).to have_selector('.__ng2-bootstrap-has-run', wait: 20)
+ expect(page).to have_css('.__ng2-bootstrap-has-run', wait: 20)
end
diff --git a/spec/support/capybara/additional_accessible_selectors.rb b/spec/support/capybara/additional_accessible_selectors.rb
index 98fc32b1e6d..335bee8158c 100644
--- a/spec/support/capybara/additional_accessible_selectors.rb
+++ b/spec/support/capybara/additional_accessible_selectors.rb
@@ -49,12 +49,12 @@ end
module Capybara
module RSpecMatchers
%i[list list_item].each do |selector|
- define_method "have_#{selector}" do |locator = nil, **options, &optional_filter_block|
+ define_method :"have_#{selector}" do |locator = nil, **options, &optional_filter_block|
Matchers::HaveSelector.new(selector, locator, **options, &optional_filter_block)
end
- define_method "have_no_#{selector}" do |*args, **options, &optional_filter_block|
- Matchers::NegatedMatcher.new(send("have_#{selector}", *args, **options, &optional_filter_block))
+ define_method :"have_no_#{selector}" do |*args, **options, &optional_filter_block|
+ Matchers::NegatedMatcher.new(send(:"have_#{selector}", *args, **options, &optional_filter_block))
end
end
end
diff --git a/spec/support/components/admin/type_configuration_form.rb b/spec/support/components/admin/type_configuration_form.rb
index e894132dbf0..e88407a96a4 100644
--- a/spec/support/components/admin/type_configuration_form.rb
+++ b/spec/support/components/admin/type_configuration_form.rb
@@ -58,7 +58,7 @@ module Components
end
def expect_empty
- expect(page).not_to have_selector('#draggable-groups .group-head')
+ expect(page).to have_no_css('#draggable-groups .group-head')
end
def find_group(name)
@@ -88,7 +88,7 @@ module Components
attribute = page.find(attribute_selector(key))
unless translation.nil?
- expect(attribute).to have_selector('.attribute-name', text: translation)
+ expect(attribute).to have_css('.attribute-name', text: translation)
end
end
@@ -134,7 +134,7 @@ module Components
modal = ::Components::WorkPackages::TableConfigurationModal.new
- within find('.relation-filter-selector') do
+ within '.relation-filter-selector' do
select I18n.t("js.relation_labels.#{relation_filter}")
# While we are here, let's check that all relation filters are present.
@@ -198,7 +198,7 @@ module Components
input.set(to)
input.send_keys(:return)
- expect(page).to have_selector('.group-edit-handler', text: to.upcase)
+ expect(page).to have_css('.group-edit-handler', text: to.upcase)
end
def remove_group(name)
@@ -206,15 +206,15 @@ module Components
container.find('.delete-group').click
- expect(page).not_to have_selector('.group-head', text: name.upcase)
+ expect(page).to have_no_css('.group-head', text: name.upcase)
end
def expect_no_attribute(attribute, group)
- expect(find_group(group)).not_to have_selector(attribute_selector(attribute).to_s)
+ expect(find_group(group)).to have_no_selector(attribute_selector(attribute).to_s)
end
def expect_group(_label, translation, *attributes)
- expect(find_group(translation)).to have_selector(".group-edit-handler", text: translation.upcase)
+ expect(find_group(translation)).to have_css(".group-edit-handler", text: translation.upcase)
within find_group(translation) do
attributes.each do |attribute|
@@ -224,7 +224,7 @@ module Components
end
def expect_inactive(attribute)
- expect(inactive_drop).to have_selector(".type-form-conf-attribute[data-key='#{attribute}']")
+ expect(inactive_drop).to have_css(".type-form-conf-attribute[data-key='#{attribute}']")
end
end
end
diff --git a/spec/support/components/attachments_list.rb b/spec/support/components/attachments_list.rb
index 449dc12d4c0..4e55a507b6b 100644
--- a/spec/support/components/attachments_list.rb
+++ b/spec/support/components/attachments_list.rb
@@ -27,11 +27,11 @@ module Components
end
def expect_empty
- expect(page).not_to have_selector("#{context_selector} [data-test-selector='op-attachment-list-item']")
+ expect(page).to have_no_css("#{context_selector} [data-test-selector='op-attachment-list-item']")
end
def expect_attached(name, count: 1)
- expect(page).to have_selector("#{context_selector} [data-test-selector='op-attachment-list-item']", text: name, count:)
+ expect(page).to have_css("#{context_selector} [data-test-selector='op-attachment-list-item']", text: name, count:)
end
def wait_until_visible
diff --git a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
index 54c04323275..40701070723 100644
--- a/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
+++ b/spec/support/components/autocompleter/ng_select_autocomplete_helpers.rb
@@ -10,7 +10,7 @@ module Components::Autocompleter
# Wait for autocompleter options to be loaded (data fetching is debounced by 250ms after creation or typing)
wait_for_network_idle if using_cuprite? && wait_for_fetched_options
- expect(element).not_to have_selector('.ng-spinner-loader')
+ expect(element).to have_no_css('.ng-spinner-loader')
# Insert the text to find
within(element) do
@@ -18,7 +18,7 @@ module Components::Autocompleter
end
# Wait for options to be refreshed after having entered some text.
- expect(element).not_to have_selector('.ng-spinner-loader')
+ expect(element).to have_no_css('.ng-spinner-loader')
# probably not necessary anymore
sleep(0.5) unless using_cuprite?
@@ -42,13 +42,13 @@ module Components::Autocompleter
def expect_ng_option(element, option, results_selector: nil)
within(ng_find_dropdown(element, results_selector:)) do
- expect(page).to have_selector('.ng-option', text: option)
+ expect(page).to have_css('.ng-option', text: option)
end
end
def expect_no_ng_option(element, option, results_selector: nil)
within(ng_find_dropdown(element, results_selector:)) do
- expect(page).not_to have_selector('.ng-option', text: option)
+ expect(page).to have_no_css('.ng-option', text: option)
end
end
diff --git a/spec/support/components/common/sidemenu.rb b/spec/support/components/common/sidemenu.rb
index f92ae7598e1..7a0be6b48ec 100644
--- a/spec/support/components/common/sidemenu.rb
+++ b/spec/support/components/common/sidemenu.rb
@@ -34,11 +34,11 @@ module Components
include RSpec::Matchers
def expect_open
- expect(page).to have_selector('[data-test-selector="op-sidemenu"]')
+ expect(page).to have_css('[data-test-selector="op-sidemenu"]')
end
def expect_item_not_visible(item)
- expect(page).not_to have_selector(item_selector, text: item)
+ expect(page).to have_no_selector(item_selector, text: item)
end
def expect_item_with_count(item, count)
@@ -61,17 +61,17 @@ module Components
def finished_loading
wait_for_network_idle if using_cuprite?
- expect(page).not_to have_selector('[data-test-selector="op-ian-center--loading-indicator"]')
+ expect(page).to have_no_css('[data-test-selector="op-ian-center--loading-indicator"]')
end
private
def expect_count(count)
- expect(page).to have_selector('.op-bubble', text: count)
+ expect(page).to have_css('.op-bubble', text: count)
end
def expect_no_count
- expect(page).not_to have_selector('.op-bubble')
+ expect(page).to have_no_css('.op-bubble')
end
def item_action_selector(item)
diff --git a/spec/support/components/datepicker/datepicker.rb b/spec/support/components/datepicker/datepicker.rb
index cb9ccb3c3ad..d075465ec01 100644
--- a/spec/support/components/datepicker/datepicker.rb
+++ b/spec/support/components/datepicker/datepicker.rb
@@ -44,11 +44,11 @@ module Components
end
def expect_visible
- expect(container).to have_selector('.flatpickr-calendar .flatpickr-current-month', wait: 10)
+ expect(container).to have_css('.flatpickr-calendar .flatpickr-current-month', wait: 10)
end
def expect_not_visible
- expect(container).not_to have_selector('.flatpickr-calendar .flatpickr-current-month', wait: 10)
+ expect(container).to have_no_css('.flatpickr-calendar .flatpickr-current-month', wait: 10)
end
##
@@ -124,13 +124,13 @@ module Components
##
# Expect the selected day
def expect_day(value)
- expect(flatpickr_container).to have_selector('.flatpickr-day.selected', text: value)
+ expect(flatpickr_container).to have_css('.flatpickr-day.selected', text: value)
end
##
# Expect the selected year
def expect_year(value)
- expect(flatpickr_container).to have_selector('.cur-year') { |field|
+ expect(flatpickr_container).to have_css('.cur-year') { |field|
field.value.to_i == value.to_i
}
end
@@ -150,32 +150,32 @@ module Components
# Expect the given date to be non working
def expect_non_working(date)
label = date.strftime('%B %-d, %Y')
- expect(page).to have_selector(".flatpickr-day.flatpickr-non-working-day[aria-label='#{label}']",
- wait: 20)
+ expect(page).to have_css(".flatpickr-day.flatpickr-non-working-day[aria-label='#{label}']",
+ wait: 20)
end
##
# Expect the given date to be non working
def expect_working(date)
label = date.strftime('%B %-d, %Y')
- expect(page).to have_selector(".flatpickr-day:not(.flatpickr-non-working-day)[aria-label='#{label}']",
- wait: 20)
+ expect(page).to have_css(".flatpickr-day:not(.flatpickr-non-working-day)[aria-label='#{label}']",
+ wait: 20)
end
##
# Expect the given date to be non working
def expect_disabled(date)
label = date.strftime('%B %-d, %Y')
- expect(page).to have_selector(".flatpickr-day.flatpickr-disabled[aria-label='#{label}']",
- wait: 20)
+ expect(page).to have_css(".flatpickr-day.flatpickr-disabled[aria-label='#{label}']",
+ wait: 20)
end
##
# Expect the given date to be non working
def expect_not_disabled(date)
label = date.strftime('%B %-d, %Y')
- expect(page).to have_selector(".flatpickr-day:not(.flatpickr-disabled)[aria-label='#{label}']",
- wait: 20)
+ expect(page).to have_css(".flatpickr-day:not(.flatpickr-disabled)[aria-label='#{label}']",
+ wait: 20)
end
protected
diff --git a/spec/support/components/datepicker/range_datepicker.rb b/spec/support/components/datepicker/range_datepicker.rb
index 749d0babba9..c3d4698218f 100644
--- a/spec/support/components/datepicker/range_datepicker.rb
+++ b/spec/support/components/datepicker/range_datepicker.rb
@@ -1,4 +1,4 @@
-require_relative './basic_datepicker'
+require_relative 'basic_datepicker'
module Components
class RangeDatepicker < BasicDatepicker
diff --git a/spec/support/components/datepicker/work_package_datepicker.rb b/spec/support/components/datepicker/work_package_datepicker.rb
index 9ce64b92b2f..7dae71dc634 100644
--- a/spec/support/components/datepicker/work_package_datepicker.rb
+++ b/spec/support/components/datepicker/work_package_datepicker.rb
@@ -87,11 +87,11 @@ module Components
end
def expect_start_highlighted
- expect(container).to have_selector('[data-test-selector="op-datepicker-modal--start-date-field"][data-qa-highlighted]')
+ expect(container).to have_css('[data-test-selector="op-datepicker-modal--start-date-field"][data-qa-highlighted]')
end
def expect_due_highlighted
- expect(container).to have_selector('[data-test-selector="op-datepicker-modal--end-date-field"][data-qa-highlighted]')
+ expect(container).to have_css('[data-test-selector="op-datepicker-modal--end-date-field"][data-qa-highlighted]')
end
def duration_field
@@ -128,7 +128,7 @@ module Components
end
def expect_duration_highlighted
- expect(container).to have_selector('[data-test-selector="op-datepicker-modal--duration-field"][data-qa-highlighted]')
+ expect(container).to have_css('[data-test-selector="op-datepicker-modal--duration-field"][data-qa-highlighted]')
end
def expect_scheduling_mode(manually)
diff --git a/spec/support/components/global_search.rb b/spec/support/components/global_search.rb
index 60c90993fdc..e9cefdeadb2 100644
--- a/spec/support/components/global_search.rb
+++ b/spec/support/components/global_search.rb
@@ -59,32 +59,32 @@ module Components
def expect_global_scope_marked
expect(page)
- .to have_selector('.global-search--project-scope[title="all_projects"]', wait: 10)
+ .to have_css('.global-search--project-scope[title="all_projects"]', wait: 10)
end
def expect_in_project_and_subproject_scope_marked
expect(page)
- .to have_selector('.global-search--project-scope[title="current_project_and_all_descendants"]', wait: 10)
+ .to have_css('.global-search--project-scope[title="current_project_and_all_descendants"]', wait: 10)
end
def expect_scope(text)
expect(page)
- .to have_selector('.global-search--project-scope', text:, wait: 10)
+ .to have_css('.global-search--project-scope', text:, wait: 10)
end
def expect_work_package_marked(wp)
expect(page)
- .to have_selector('.ng-option-marked', text: wp.subject.to_s, wait: 10)
+ .to have_css('.ng-option-marked', text: wp.subject.to_s, wait: 10)
end
def expect_work_package_option(wp)
expect(page)
- .to have_selector('.global-search--option', text: wp.subject.to_s, wait: 10)
+ .to have_css('.global-search--option', text: wp.subject.to_s, wait: 10)
end
def expect_no_work_package_option(wp)
expect(page)
- .not_to have_selector('.global-search--option', text: wp.subject.to_s)
+ .to have_no_css('.global-search--option', text: wp.subject.to_s)
end
def click_work_package(wp)
@@ -96,7 +96,7 @@ module Components
end
def find_option(text)
- expect(page).to have_selector('.global-search--wp-subject', text:, wait: 10)
+ expect(page).to have_css('.global-search--wp-subject', text:, wait: 10)
find('.global-search--wp-subject', text:)
end
diff --git a/spec/support/components/grids/grid_area.rb b/spec/support/components/grids/grid_area.rb
index bd0922502d0..e779d7f0c44 100644
--- a/spec/support/components/grids/grid_area.rb
+++ b/spec/support/components/grids/grid_area.rb
@@ -39,7 +39,7 @@ module Components
open_menu
within('ul.dropdown-menu') do |element|
- expect(element).to have_selector('span', text:)
+ expect(element).to have_css('span', text:)
end
end
@@ -89,7 +89,7 @@ module Components
def expect_not_resizable
within area do
expect(page)
- .not_to have_selector('.grid--area.-widgeted resizer')
+ .to have_no_css('.grid--area.-widgeted resizer')
end
end
@@ -98,14 +98,14 @@ module Components
within area do
expect(page)
- .not_to have_selector(".grid--area-drag-handle")
+ .to have_no_css(".grid--area-drag-handle")
end
end
def expect_not_renameable
within area do
expect(page)
- .to have_selector(".editable-toolbar-title--fixed")
+ .to have_css(".editable-toolbar-title--fixed")
end
end
@@ -114,7 +114,7 @@ module Components
within area do
expect(page)
- .not_to have_selector(".icon-show-more-horizontal")
+ .to have_no_css(".icon-show-more-horizontal")
end
end
@@ -150,7 +150,7 @@ module Components
page.find('.op-toast--close').click
end
- expect(page).not_to have_selector('.op-toast')
+ expect(page).to have_no_css('.op-toast')
end
end
end
diff --git a/spec/support/components/menu/dropdown.rb b/spec/support/components/menu/dropdown.rb
index 9785376212d..95f42498c74 100644
--- a/spec/support/components/menu/dropdown.rb
+++ b/spec/support/components/menu/dropdown.rb
@@ -37,11 +37,11 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector('.op-app-menu--dropdown')
+ expect(page).to have_no_css('.op-app-menu--dropdown')
end
def expect_open
- expect(page).to have_selector('.op-app-menu--dropdown')
+ expect(page).to have_css('.op-app-menu--dropdown')
end
def within_dropdown(&)
diff --git a/spec/support/components/menu/quick_add_menu.rb b/spec/support/components/menu/quick_add_menu.rb
index 9219192d30a..0524a5aee9e 100644
--- a/spec/support/components/menu/quick_add_menu.rb
+++ b/spec/support/components/menu/quick_add_menu.rb
@@ -25,7 +25,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
-require_relative './dropdown'
+require_relative 'dropdown'
module Components
class QuickAddMenu < Dropdown
@@ -57,7 +57,7 @@ module Components
def expect_no_work_package_types
within_dropdown do
- expect(page).not_to have_text 'Work packages'
+ expect(page).to have_no_text 'Work packages'
end
end
@@ -72,7 +72,7 @@ module Components
if present
expect(page).to have_link matcher
else
- expect(page).not_to have_link matcher
+ expect(page).to have_no_link matcher
end
end
end
diff --git a/spec/support/components/password_confirmation_dialog.rb b/spec/support/components/password_confirmation_dialog.rb
index b0531ac14b5..71482c8a035 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).not_to have_selector(selector)
+ expect(page).to have_no_selector(selector)
end
def submit_button
@@ -68,10 +68,10 @@ module Components
end
if should_fail
- expect(page).to have_selector('.op-toast.-error',
- text: I18n.t(:notice_password_confirmation_failed))
+ expect(page).to have_css('.op-toast.-error',
+ text: I18n.t(:notice_password_confirmation_failed))
else
- expect(page).not_to have_selector('.op-toast.-error')
+ expect(page).to have_no_css('.op-toast.-error')
end
end
end
diff --git a/spec/support/components/project_include_component.rb b/spec/support/components/project_include_component.rb
index c44f78b70ec..281f97096f0 100644
--- a/spec/support/components/project_include_component.rb
+++ b/spec/support/components/project_include_component.rb
@@ -42,11 +42,11 @@ module Components
end
def expect_open
- expect(page).to have_selector("[data-test-selector='project-include-list']")
+ expect(page).to have_css("[data-test-selector='project-include-list']")
end
def expect_count(count)
- expect(page).to have_selector("[data-test-selector='project-include-button'] .badge", text: count)
+ expect(page).to have_css("[data-test-selector='project-include-button'] .badge", text: count)
end
def toggle_include_all_subprojects
@@ -89,7 +89,7 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector("[data-test-selector='project-include-list']")
+ expect(page).to have_no_css("[data-test-selector='project-include-list']")
end
def click_button(text)
@@ -115,7 +115,7 @@ module Components
end
def no_loading_indicator
- expect(page).not_to have_selector("[data-test-selector='op-project-include--loading']")
+ expect(page).to have_no_css("[data-test-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 411c3e96879..f8cba3c4eba 100644
--- a/spec/support/components/projects/top_menu.rb
+++ b/spec/support/components/projects/top_menu.rb
@@ -59,7 +59,7 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector(autocompleter_selector)
+ expect(page).to have_no_selector(autocompleter_selector)
end
def search(query)
@@ -98,7 +98,7 @@ module Components
def expect_no_result(name)
within search_results do
- expect(page).not_to have_selector(autocompleter_item_title_selector, text: name)
+ expect(page).to have_no_selector(autocompleter_item_title_selector, text: name)
end
end
@@ -110,7 +110,7 @@ module Components
within search_results do
hierarchy_selector = hierarchy_level.times.collect { autocompleter_item_selector }.join(' ')
expect(page)
- .to have_selector("#{hierarchy_selector} #{autocompleter_item_title_selector}", text: item_name)
+ .to have_css("#{hierarchy_selector} #{autocompleter_item_title_selector}", text: item_name)
end
end
diff --git a/spec/support/components/table_pagination.rb b/spec/support/components/table_pagination.rb
index 2197fb04e12..1906d590867 100644
--- a/spec/support/components/table_pagination.rb
+++ b/spec/support/components/table_pagination.rb
@@ -35,14 +35,14 @@ module Components
def expect_range(from, to, total)
within_pagination do
expect(page)
- .to have_selector('.op-pagination--range', text: "(#{from} - #{to}/#{total})")
+ .to have_css('.op-pagination--range', text: "(#{from} - #{to}/#{total})")
end
end
def expect_no_per_page_options
within_pagination do
expect(page)
- .not_to have_selector('.op-pagination--options')
+ .to have_no_css('.op-pagination--options')
end
end
diff --git a/spec/support/components/timelines/timeline_row.rb b/spec/support/components/timelines/timeline_row.rb
index f9a76a46e3e..3aa050dd374 100644
--- a/spec/support/components/timelines/timeline_row.rb
+++ b/spec/support/components/timelines/timeline_row.rb
@@ -47,15 +47,15 @@ module Components
hover!
unless left.nil?
- expect(container).to have_selector(".labelHoverLeft.not-empty", text: left)
+ expect(container).to have_css(".labelHoverLeft.not-empty", text: left)
end
unless right.nil?
- expect(container).to have_selector(".labelHoverRight.not-empty", text: right)
+ expect(container).to have_css(".labelHoverRight.not-empty", text: right)
end
- expect(container).to have_selector(".labelLeft", visible: false)
- expect(container).to have_selector(".labelRight", visible: false)
- expect(container).to have_selector(".labelFarRight", visible: false)
+ expect(container).to have_css(".labelLeft", visible: false)
+ expect(container).to have_css(".labelRight", visible: false)
+ expect(container).to have_css(".labelFarRight", visible: false)
end
def expect_labels(left:, right:, farRight:)
@@ -65,10 +65,10 @@ module Components
labelFarRight: farRight
}.each do |className, text|
if text.nil?
- expect(container).to have_selector(".#{className}", visible: :all)
- expect(container).not_to have_selector(".#{className}.not-empty", wait: 0)
+ expect(container).to have_css(".#{className}", visible: :all)
+ expect(container).to have_no_css(".#{className}.not-empty", wait: 0)
else
- expect(container).to have_selector(".#{className}.not-empty", text:)
+ expect(container).to have_css(".#{className}.not-empty", text:)
end
end
end
@@ -87,22 +87,22 @@ module Components
def expect_hovered_bar(duration: 1)
expected_length = duration * 30
- expect(container).to have_selector('div[class^="__hl_background_"', style: { width: "#{expected_length}px" })
+ expect(container).to have_css('div[class^="__hl_background_"', style: { width: "#{expected_length}px" })
end
def expect_bar(duration: 1)
loading_indicator_saveguard
expected_length = duration * 30
- expect(container).to have_selector('.timeline-element', style: { width: "#{expected_length}px" })
+ expect(container).to have_css('.timeline-element', style: { width: "#{expected_length}px" })
end
def expect_no_hovered_bar
- expect(container).not_to have_selector('div[class^="__hl_background_"')
+ expect(container).to have_no_css('div[class^="__hl_background_"')
end
def expect_no_bar
loading_indicator_saveguard
- expect(container).not_to have_selector('.timeline-element')
+ expect(container).to have_no_css('.timeline-element')
end
def drag_and_drop(offset_days: 0, days: 1)
diff --git a/spec/support/components/users/invite_user_modal.rb b/spec/support/components/users/invite_user_modal.rb
index 902121547e6..7639a879812 100644
--- a/spec/support/components/users/invite_user_modal.rb
+++ b/spec/support/components/users/invite_user_modal.rb
@@ -178,7 +178,7 @@ module Components
def expect_error_displayed(message)
within_modal do
expect(page)
- .to have_selector('.spot-form-field--error', text: message)
+ .to have_css('.spot-form-field--error', text: message)
end
end
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 7befb7d2716..0b6bb814d27 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -47,11 +47,11 @@ module Components
end
def expect_notification_count(count)
- expect(page).to have_selector('[data-test-selector="tab-counter-Activity"] span', text: count)
+ expect(page).to have_css('[data-test-selector="tab-counter-Activity"] span', text: count)
end
def expect_no_notification_badge
- expect(page).not_to have_selector('[data-test-selector="tab-counter-Activity"] span')
+ expect(page).to have_no_css('[data-test-selector="tab-counter-Activity"] span')
end
def hover_action(journal_id, action)
diff --git a/spec/support/components/work_packages/baseline.rb b/spec/support/components/work_packages/baseline.rb
index 3d740525d83..bebb5598402 100644
--- a/spec/support/components/work_packages/baseline.rb
+++ b/spec/support/components/work_packages/baseline.rb
@@ -34,30 +34,30 @@ module Components
include RSpec::Matchers
def expect_active
- expect(page).to have_selector('.wp-table--baseline-th')
+ expect(page).to have_css('.wp-table--baseline-th')
end
def expect_legends
- expect(page).to have_selector('.op-baseline-legends')
+ expect(page).to have_css('.op-baseline-legends')
end
def expect_legend_text(text)
- expect(page).to have_selector('.op-baseline-legends--filter', text:)
+ expect(page).to have_css('.op-baseline-legends--filter', text:)
end
def expect_legend_tooltip(text)
- expect(page).to have_selector('[data-test-selector="baseline-legend-time-offset"]', visible: :all) { |node|
+ expect(page).to have_css('[data-test-selector="baseline-legend-time-offset"]', visible: :all) { |node|
node['title'] == text
}
end
def expect_no_legends
- expect(page).not_to have_selector('.op-baseline-legends')
+ expect(page).to have_no_css('.op-baseline-legends')
end
def expect_inactive
- expect(page).not_to have_selector('.wp-table--baseline-th')
- expect(page).not_to have_selector('.op-table-baseline--column-cell')
+ expect(page).to have_no_css('.wp-table--baseline-th')
+ expect(page).to have_no_css('.op-table-baseline--column-cell')
end
def expect_changed(work_package)
@@ -74,13 +74,13 @@ module Components
def expect_unchanged(work_package)
page.within(row_selector(work_package)) do
- expect(page).not_to have_selector(".op-table-baseline--column-cell *")
+ expect(page).to have_no_css(".op-table-baseline--column-cell *")
end
end
def expect_icon(work_package, icon_type)
page.within(row_selector(work_package)) do
- expect(page).to have_selector(".op-table-baseline--icon-#{icon_type}")
+ expect(page).to have_css(".op-table-baseline--icon-#{icon_type}")
end
end
@@ -88,12 +88,12 @@ module Components
page.within(row_selector(work_package)) do
changes.each do |attribute, (old_value, new_value)|
base_selector = ".op-table-baseline--container.#{attribute}"
- expect(page).to have_selector("#{base_selector} .op-table-baseline--old-field", text: old_value)
+ expect(page).to have_css("#{base_selector} .op-table-baseline--old-field", text: old_value)
if new_value == ''
- expect(page).to have_selector("#{base_selector} .op-table-baseline--new-field", text: '', visible: :all)
+ expect(page).to have_css("#{base_selector} .op-table-baseline--new-field", text: '', visible: :all)
else
- expect(page).to have_selector("#{base_selector} .op-table-baseline--new-field", text: new_value)
+ expect(page).to have_css("#{base_selector} .op-table-baseline--new-field", text: new_value)
end
end
end
@@ -102,7 +102,7 @@ module Components
def expect_unchanged_attributes(work_package, *changes)
page.within(row_selector(work_package)) do
changes.each do |attribute|
- expect(page).not_to have_selector(".#{attribute}.op-table-baseline--old-field")
+ expect(page).to have_no_css(".#{attribute}.op-table-baseline--old-field")
end
end
end
diff --git a/spec/support/components/work_packages/baseline_modal.rb b/spec/support/components/work_packages/baseline_modal.rb
index 5bd50b53e3a..441ca4f171a 100644
--- a/spec/support/components/work_packages/baseline_modal.rb
+++ b/spec/support/components/work_packages/baseline_modal.rb
@@ -38,11 +38,11 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector('op-baseline')
+ expect(page).to have_no_css('op-baseline')
end
def expect_open
- expect(page).to have_selector('op-baseline')
+ expect(page).to have_css('op-baseline')
expect(page).to have_field('op-baseline-filter')
end
@@ -55,7 +55,7 @@ module Components
end
def expect_no_time_field
- expect(page).not_to have_field('op-baseline-time')
+ expect(page).to have_no_field('op-baseline-time')
end
def select_filter(option)
@@ -64,11 +64,11 @@ module Components
end
def expect_offset(value, count: 1)
- expect(page).to have_selector('.op-baseline--time-help', text: value, count:)
+ expect(page).to have_css('.op-baseline--time-help', text: value, count:)
end
def expect_time_help_text(text)
- expect(page).to have_selector('.spot-form-field--description', text:)
+ expect(page).to have_css('.spot-form-field--description', text:)
end
def set_time(value, selector = 'op-baseline-time')
diff --git a/spec/support/components/work_packages/columns.rb b/spec/support/components/work_packages/columns.rb
index 1b4f581efa9..fd84e227bd3 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).not_to have_selector('.ng-option', text: name, visible: :all)
+ expect(page).to have_no_css('.ng-option', text: name, visible: :all)
close_autocompleter
end
@@ -66,7 +66,7 @@ module Components
modal_open? or open_modal
column_autocompleter.click
- expect(page).to have_selector('.ng-option', text: name, visible: :all)
+ expect(page).to have_css('.ng-option', text: name, visible: :all)
close_autocompleter
end
@@ -82,7 +82,7 @@ module Components
within ".work-package-table" do
# for some reason these columns (e.g. 'Overall costs') don't have a proper link
if finicky
- expect(page).to have_selector("a", text: /#{name}/i, visible: :all)
+ expect(page).to have_css("a", text: /#{name}/i, visible: :all)
else
expect(page).to have_link(name)
end
@@ -103,13 +103,13 @@ module Components
def expect_checked(name)
within_modal do
- expect(page).to have_selector('.op-draggable-autocomplete--item', text: name)
+ expect(page).to have_css('.op-draggable-autocomplete--item', text: name)
end
end
def expect_unchecked(name)
within_modal do
- expect(page).not_to have_selector('.op-draggable-autocomplete--item', text: name)
+ expect(page).to have_no_css('.op-draggable-autocomplete--item', text: name)
end
end
@@ -117,7 +117,7 @@ module Components
open_modal unless modal_open?
within_modal do
- expect(page).to have_selector('.op-draggable-autocomplete--item', minimum: 1)
+ expect(page).to have_css('.op-draggable-autocomplete--item', minimum: 1)
page.all('.op-draggable-autocomplete--remove-item').each(&:click)
end
diff --git a/spec/support/components/work_packages/context_menu.rb b/spec/support/components/work_packages/context_menu.rb
index 180be2eea1c..d2210ec7319 100644
--- a/spec/support/components/work_packages/context_menu.rb
+++ b/spec/support/components/work_packages/context_menu.rb
@@ -62,7 +62,7 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector(selector)
+ expect(page).to have_no_selector(selector)
end
def choose(target)
@@ -72,14 +72,14 @@ module Components
def expect_no_options(*options)
expect_open
options.each do |text|
- expect(page).not_to have_selector("#{selector} .menu-item", text:)
+ expect(page).to have_no_css("#{selector} .menu-item", text:)
end
end
def expect_options(options)
expect_open
options.each do |text|
- expect(page).to have_selector("#{selector} .menu-item", text:)
+ expect(page).to have_css("#{selector} .menu-item", text:)
end
end
diff --git a/spec/support/components/work_packages/destroy_modal.rb b/spec/support/components/work_packages/destroy_modal.rb
index 5df43bc3760..26849110f5c 100644
--- a/spec/support/components/work_packages/destroy_modal.rb
+++ b/spec/support/components/work_packages/destroy_modal.rb
@@ -41,12 +41,12 @@ module Components
page.within(container) do
if wps.length == 1
wp = wps.first
- expect(page).to have_selector('strong', text: "#{wp.subject} ##{wp.id}")
+ expect(page).to have_css('strong', text: "#{wp.subject} ##{wp.id}")
else
- expect(page).to have_selector('.danger-zone--warning',
- text: 'Are you sure you want to delete the following work packages?')
+ expect(page).to have_css('.danger-zone--warning',
+ text: 'Are you sure you want to delete the following work packages?')
wps.each do |wp|
- expect(page).to have_selector('li', text: "##{wp.id} #{wp.subject}")
+ expect(page).to have_css('li', text: "##{wp.id} #{wp.subject}")
end
end
end
diff --git a/spec/support/components/work_packages/display_representation.rb b/spec/support/components/work_packages/display_representation.rb
index a359ec1d3e8..ea9690a87e0 100644
--- a/spec/support/components/work_packages/display_representation.rb
+++ b/spec/support/components/work_packages/display_representation.rb
@@ -49,14 +49,14 @@ module Components
end
def expect_state(text)
- expect(page).to have_selector('#wp-view-toggle-button', text:, wait: 10)
+ expect(page).to have_css('#wp-view-toggle-button', text:, wait: 10)
end
private
def expect_button(forbidden_text)
expect(page).to have_button('wp-view-toggle-button', disabled: false)
- expect(page).not_to have_selector('#wp-view-toggle-button', text: forbidden_text)
+ expect(page).to have_no_css('#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 304f809c698..8aa278f297c 100644
--- a/spec/support/components/work_packages/filters.rb
+++ b/spec/support/components/work_packages/filters.rb
@@ -48,7 +48,7 @@ module Components
end
def expect_filter_count(num)
- expect(filter_button).to have_selector('.badge', text: num, wait: 10)
+ expect(filter_button).to have_css('.badge', text: num, wait: 10)
end
def expect_open
@@ -97,7 +97,7 @@ module Components
def expect_loaded
SeleniumHubWaiter.wait
- expect(filter_button).to have_selector('.badge', wait: 2)
+ expect(filter_button).to have_css('.badge', wait: 2)
end
def add_filter(name)
@@ -138,7 +138,7 @@ module Components
results_selector: '.ng-dropdown-panel-items')
within target_dropdown do
- expect(page).not_to have_selector('.ng-option', text: name)
+ expect(page).to have_no_css('.ng-option', text: name)
end
end
@@ -152,7 +152,7 @@ module Components
elsif value
expect_value(id, Array(value))
else
- expect(page).not_to have_selector("#values-#{id}")
+ expect(page).to have_no_css("#values-#{id}")
end
end
@@ -191,8 +191,8 @@ module Components
def expect_no_filter_by(name, selector = nil)
id = selector || name.downcase
- expect(page).not_to have_select("operators-#{id}")
- expect(page).not_to have_select("values-#{id}")
+ expect(page).to have_no_select("operators-#{id}")
+ expect(page).to have_no_select("values-#{id}")
end
def expect_filter_order(name, values, selector = nil)
@@ -298,7 +298,7 @@ module Components
def expect_value_placeholder(id)
filter_element = page.find("#filter_#{id}")
if filter_element.has_selector?(".ng-select-container", wait: false)
- expect(filter_element).to have_selector(".ng-placeholder", text: I18n.t('js.placeholders.selection'))
+ expect(filter_element).to have_css(".ng-placeholder", text: I18n.t('js.placeholders.selection'))
else
raise "Non ng-select may not have placeholders currently"
end
@@ -308,7 +308,7 @@ module Components
within_values(id) do |is_select|
if is_select
value.each do |v|
- expect(page).to have_selector("#values-#{id} .ng-value-label", text: v)
+ expect(page).to have_css("#values-#{id} .ng-value-label", text: v)
end
elsif page.has_selector?("#filter_#{id} [data-test-selector='op-basic-range-date-picker']", wait: false)
expected_value =
diff --git a/spec/support/components/work_packages/group_by.rb b/spec/support/components/work_packages/group_by.rb
index a6d1f012534..eed43445175 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).not_to have_css('[data-test-selector="op-group--value"]')
+ expect(page).to have_no_css('[data-test-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 c7b2f93a390..2dffe645368 100644
--- a/spec/support/components/work_packages/hierarchies.rb
+++ b/spec/support/components/work_packages/hierarchies.rb
@@ -62,17 +62,17 @@ module Components
end
def expect_no_hierarchies
- expect(page).not_to have_selector('.wp-table--hierarchy-span')
+ expect(page).to have_no_css('.wp-table--hierarchy-span')
end
alias_method :expect_mode_disabled, :expect_no_hierarchies
def expect_mode_enabled
- expect(page).to have_selector('.wp-table--table-header .icon-hierarchy')
+ expect(page).to have_css('.wp-table--table-header .icon-hierarchy')
end
def expect_mode_disabled
- expect(page).to have_selector('.wp-table--table-header .icon-no-hierarchy')
+ expect(page).to have_css('.wp-table--table-header .icon-no-hierarchy')
end
def expect_indent(work_package, indent: true, outdent: true)
@@ -99,7 +99,7 @@ module Components
def expect_leaf_at(*work_packages)
work_packages.each do |wp|
- expect(page).to have_selector(".wp-row-#{wp.id} .wp-table--leaf-indicator")
+ expect(page).to have_css(".wp-row-#{wp.id} .wp-table--leaf-indicator")
end
end
@@ -110,17 +110,17 @@ module Components
selector = ".wp-row-#{wp.id} .wp-table--hierarchy-indicator"
if collapsed
- expect(page).to have_selector("#{selector}#{collapsed_sel}")
+ expect(page).to have_css("#{selector}#{collapsed_sel}")
else
expect(page).to have_selector(selector)
- expect(page).not_to have_selector("#{selector}#{collapsed_sel}")
+ expect(page).to have_no_css("#{selector}#{collapsed_sel}")
end
end
end
def expect_hidden(*work_packages)
work_packages.each do |wp|
- expect(page).to have_selector(".wp-row-#{wp.id}", visible: :hidden)
+ expect(page).to have_css(".wp-row-#{wp.id}", visible: :hidden)
end
end
diff --git a/spec/support/components/work_packages/query_menu.rb b/spec/support/components/work_packages/query_menu.rb
index 97ab5801a36..6adfd25f692 100644
--- a/spec/support/components/work_packages/query_menu.rb
+++ b/spec/support/components/work_packages/query_menu.rb
@@ -63,11 +63,11 @@ module Components
end
def expect_menu_entry_not_visible(name)
- expect(page).not_to have_selector(autocompleter_item_selector, text: name)
+ expect(page).to have_no_selector(autocompleter_item_selector, text: name)
end
def expect_no_menu_entry
- expect(page).not_to have_selector(autocompleter_item_selector)
+ expect(page).to have_no_selector(autocompleter_item_selector)
end
end
end
diff --git a/spec/support/components/work_packages/query_title.rb b/spec/support/components/work_packages/query_title.rb
index 3e7d8f0325f..9b9e5ec9cd2 100644
--- a/spec/support/components/work_packages/query_title.rb
+++ b/spec/support/components/work_packages/query_title.rb
@@ -34,13 +34,13 @@ module Components
include RSpec::Matchers
def expect_changed
- expect(page).to have_selector '.editable-toolbar-title--save'
- expect(page).to have_selector '.editable-toolbar-title--input.-changed'
+ expect(page).to have_css '.editable-toolbar-title--save'
+ expect(page).to have_css '.editable-toolbar-title--input.-changed'
end
def expect_not_changed
- expect(page).not_to have_selector '.editable-toolbar-title--save'
- expect(page).not_to have_selector '.editable-toolbar-title--input.-changed'
+ expect(page).to have_no_css '.editable-toolbar-title--save'
+ expect(page).to have_no_css '.editable-toolbar-title--input.-changed'
end
def input_field
diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rb
index e27f33e0b30..b3dbb96610c 100644
--- a/spec/support/components/work_packages/relations.rb
+++ b/spec/support/components/work_packages/relations.rb
@@ -56,7 +56,7 @@ module Components
SeleniumHubWaiter.wait
row.find('.relation-row--type').click
- expect(row).to have_selector('select.inline-edit--field')
+ expect(row).to have_css('select.inline-edit--field')
row.find('.inline-edit--field option', text: to_type).select_option
end
@@ -107,13 +107,13 @@ module Components
query: to.subject,
select_text: to.subject
- expect(page).to have_selector('.relation-group--header',
- text: relation_label.upcase,
- wait: 10)
+ expect(page).to have_css('.relation-group--header',
+ text: relation_label.upcase,
+ wait: 10)
- expect(page).to have_selector("[data-test-selector='op-relation--row-type']", text: to.type.name.upcase)
+ expect(page).to have_css("[data-test-selector='op-relation--row-type']", text: to.type.name.upcase)
- expect(page).to have_selector("[data-test-selector='op-relation--row-subject']", text: to.subject)
+ expect(page).to have_css("[data-test-selector='op-relation--row-subject']", text: to.subject)
## Test if relation exist
work_package.reload
@@ -123,15 +123,15 @@ module Components
end
def expect_relation(relatable)
- expect(relations_group).to have_selector("[data-test-selector='op-relation--row-subject']", text: relatable.subject)
+ expect(relations_group).to have_css("[data-test-selector='op-relation--row-subject']", text: relatable.subject)
end
def expect_relation_by_text(text)
- expect(relations_group).to have_selector("[data-test-selector='op-relation--row-subject']", text:)
+ expect(relations_group).to have_css("[data-test-selector='op-relation--row-subject']", text:)
end
def expect_no_relation(relatable)
- expect(page).not_to have_selector("[data-test-selector='op-relation--row-subject']", text: relatable.subject)
+ expect(page).to have_no_css("[data-test-selector='op-relation--row-subject']", text: relatable.subject)
end
def add_parent(query, work_package)
@@ -149,13 +149,13 @@ module Components
end
def expect_parent(work_package)
- expect(page).to have_selector '[data-test-selector="op-wp-breadcrumb-parent"]',
- text: work_package.subject,
- wait: 10
+ expect(page).to have_css '[data-test-selector="op-wp-breadcrumb-parent"]',
+ text: work_package.subject,
+ wait: 10
end
def expect_no_parent
- expect(page).not_to have_selector '[data-test-selector="op-wp-breadcrumb-parent"]', wait: 10
+ expect(page).to have_no_css '[data-test-selector="op-wp-breadcrumb-parent"]', wait: 10
end
def remove_parent
@@ -177,7 +177,8 @@ module Components
next if page.has_selector?('.wp-relations--children .ng-input input')
SeleniumHubWaiter.wait
- find('[data-test-selector="op-wp-inline-create-reference"]', text: I18n.t('js.relation_buttons.add_existing_child')).click
+ find('[data-test-selector="op-wp-inline-create-reference"]',
+ text: I18n.t('js.relation_buttons.add_existing_child')).click
# Security check to be sure that the autocompleter has finished loading
page.find '.wp-relations--children .ng-input input'
@@ -198,7 +199,7 @@ module Components
within container do
expect(page)
- .to have_selector('.wp-table--cell-td.subject', text: work_package.subject, wait: 10)
+ .to have_css('.wp-table--cell-td.subject', text: work_package.subject, wait: 10)
end
end
@@ -206,7 +207,7 @@ module Components
page.within('wp-relations-tab .work-packages-embedded-view--container') do
row = ".wp-row-#{work_package.id}-table"
- expect(page).not_to have_selector(row)
+ expect(page).to have_no_selector(row)
end
end
diff --git a/spec/support/components/work_packages/settings_menu.rb b/spec/support/components/work_packages/settings_menu.rb
index 5fbb570c178..409201ef8da 100644
--- a/spec/support/components/work_packages/settings_menu.rb
+++ b/spec/support/components/work_packages/settings_menu.rb
@@ -67,7 +67,7 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector(selector)
+ expect(page).to have_no_selector(selector)
end
def choose(target)
@@ -77,7 +77,7 @@ module Components
def expect_options(options)
expect_open
options.each do |text|
- expect(page).to have_selector("#{selector} a", text:)
+ expect(page).to have_css("#{selector} a", text:)
end
end
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index 628331e12a7..13192b89ac4 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -69,7 +69,7 @@ module Components
def expect_not_selectable(*principals)
principals.each do |principal|
within user_row(principal) do
- expect(page).not_to have_field(principal.name)
+ expect(page).to have_no_field(principal.name)
end
end
end
@@ -112,7 +112,7 @@ module Components
def expect_select_all_not_available
expect(shares_header)
- .not_to have_field('toggle_all', wait: 0)
+ .to have_no_field('toggle_all', wait: 0)
end
def expect_select_all_toggled
@@ -136,7 +136,7 @@ module Components
def expect_bulk_actions_not_available
within shares_header do
- expect(page).not_to have_button('Remove', wait: 0)
+ expect(page).to have_no_button('Remove', wait: 0)
expect(page).not_to have_test_selector('op-share-wp-bulk-update-role', wait: 0)
end
end
@@ -311,7 +311,7 @@ module Components
within shares_list do
principals.each do |principal|
expect(page)
- .not_to have_text(principal.name)
+ .to have_no_text(principal.name)
end
end
end
@@ -388,7 +388,7 @@ module Components
def expect_no_user_limit_warning
within modal_element do
expect(page)
- .not_to have_text(I18n.t('work_package.sharing.warning_user_limit_reached'), wait: 0)
+ .to have_no_text(I18n.t('work_package.sharing.warning_user_limit_reached'), wait: 0)
end
end
@@ -403,7 +403,7 @@ module Components
within modal_element do
expect(page)
.to have_css('[data-test-selector="op-share-wp-error-message"]',
- text: text)
+ text:)
end
end
@@ -417,7 +417,7 @@ module Components
def expect_no_select_a_user_hint
within modal_element do
expect(page)
- .not_to have_text(I18n.t("work_package.sharing.warning_no_selected_user"), wait: 0)
+ .to have_no_text(I18n.t("work_package.sharing.warning_no_selected_user"), wait: 0)
end
end
end
diff --git a/spec/support/components/work_packages/sort_by.rb b/spec/support/components/work_packages/sort_by.rb
index e4082efa09d..8190221af51 100644
--- a/spec/support/components/work_packages/sort_by.rb
+++ b/spec/support/components/work_packages/sort_by.rb
@@ -70,7 +70,7 @@ module Components
.each_with_index do |entry, i|
column, direction = entry
page.within(".modal-sorting-row-#{i}") do
- expect(page).to have_selector("#modal-sorting-attribute-#{i} option", text: column)
+ expect(page).to have_css("#modal-sorting-attribute-#{i} option", text: column)
checked_radio = (descending?(direction) ? 'Descending' : 'Ascending')
expect(page.find_field(checked_radio)).to be_checked
end
diff --git a/spec/support/components/work_packages/table_configuration/filters.rb b/spec/support/components/work_packages/table_configuration/filters.rb
index d3d148e0a0a..991bb86a077 100644
--- a/spec/support/components/work_packages/table_configuration/filters.rb
+++ b/spec/support/components/work_packages/table_configuration/filters.rb
@@ -47,13 +47,13 @@ module Components
def expect_filter_count(count)
within(modal.selector) do
- expect(page).to have_selector('.advanced-filters--filter', count:)
+ expect(page).to have_css('.advanced-filters--filter', count:)
end
end
def expect_open
modal.expect_open
- expect(page).to have_selector('.op-tab-row--link_selected', text: 'FILTERS')
+ expect(page).to have_css('.op-tab-row--link_selected', text: 'FILTERS')
end
delegate :expect_closed, to: :modal
diff --git a/spec/support/components/work_packages/table_configuration_modal.rb b/spec/support/components/work_packages/table_configuration_modal.rb
index bd1910dc2c5..e371a53149c 100644
--- a/spec/support/components/work_packages/table_configuration_modal.rb
+++ b/spec/support/components/work_packages/table_configuration_modal.rb
@@ -94,11 +94,11 @@ module Components
end
def expect_closed
- expect(page).not_to have_selector(selector)
+ expect(page).to have_no_selector(selector)
end
def expect_disabled_tab(name)
- expect(page).to have_selector("#{selector} [data-qa-tab-disabled]", text: name.upcase, wait: 10)
+ expect(page).to have_css("#{selector} [data-qa-tab-disabled]", text: name.upcase, wait: 10)
end
def selected_tab(name)
diff --git a/spec/support/components/work_packages/tabs_counter.rb b/spec/support/components/work_packages/tabs_counter.rb
index b069ad4e1d6..cfd6fb1e021 100644
--- a/spec/support/components/work_packages/tabs_counter.rb
+++ b/spec/support/components/work_packages/tabs_counter.rb
@@ -13,14 +13,14 @@ module Components
# Check value of counter for the given tab
def expect_counter(tab, content)
- expect(tab).to have_selector('[data-test-selector="tab-count"]')
+ expect(tab).to have_css('[data-test-selector="tab-count"]')
- expect(tab).to have_selector('[data-test-selector="tab-count"]', text: "(#{content})")
+ expect(tab).to have_css('[data-test-selector="tab-count"]', text: "(#{content})")
end
# Counter should not be displayed, if there are no relations or watchers
def expect_no_counter(tab)
- expect(tab).not_to have_selector('[data-test-selector="tab-count"]', wait: 10)
+ expect(tab).to have_no_css('[data-test-selector="tab-count"]', wait: 10)
end
end
end
diff --git a/spec/support/components/work_packages/timer_button.rb b/spec/support/components/work_packages/timer_button.rb
index 01b76dc0b77..e01fceaf7ce 100644
--- a/spec/support/components/work_packages/timer_button.rb
+++ b/spec/support/components/work_packages/timer_button.rb
@@ -34,22 +34,22 @@ module Components
include RSpec::Matchers
def expect_active
- expect(page).to have_selector('[data-test-selector="timer-active"]', wait: 10)
+ expect(page).to have_css('[data-test-selector="timer-active"]', wait: 10)
end
def expect_inactive
- expect(page).to have_selector('[data-test-selector="timer-inactive"]', wait: 10)
+ expect(page).to have_css('[data-test-selector="timer-inactive"]', wait: 10)
end
def expect_time(text)
- expect(page).to have_selector('[data-test-selector="timer-active"]', wait: 10, text:)
+ expect(page).to have_css('[data-test-selector="timer-active"]', wait: 10, text:)
end
def expect_visible(visible: true)
if visible
- expect(page).to have_selector('op-wp-timer-button')
+ expect(page).to have_css('op-wp-timer-button')
else
- expect(page).not_to have_selector('op-wp-timer-button')
+ expect(page).to have_no_css('op-wp-timer-button')
end
end
diff --git a/spec/support/components/wysiwyg/wysiwyg_editor.rb b/spec/support/components/wysiwyg/wysiwyg_editor.rb
index 03930bc781d..74e20ec81ba 100644
--- a/spec/support/components/wysiwyg/wysiwyg_editor.rb
+++ b/spec/support/components/wysiwyg/wysiwyg_editor.rb
@@ -52,7 +52,7 @@ module Components
end
def expect_no_button(label)
- expect(container).not_to have_css('.ck-button', visible: :all, text: label)
+ expect(container).to have_no_css('.ck-button', visible: :all, text: label)
end
def expect_value(value)
@@ -61,7 +61,7 @@ module Components
def expect_supports_no_macros
expect(container)
- .not_to have_css('.ck-button', visible: :all, text: 'Macros')
+ .to have_no_css('.ck-button', visible: :all, text: 'Macros')
end
def within_enabled_preview
diff --git a/spec/support/contracts/shared.rb b/spec/support/contracts/shared.rb
index a25cea570e1..aac3dfe1341 100644
--- a/spec/support/contracts/shared.rb
+++ b/spec/support/contracts/shared.rb
@@ -7,7 +7,7 @@ RSpec.shared_context 'model contract' do
it 'explains the not writable error' do
instance.validate
expect(instance.errors.details[attribute])
- .to match_array [{ error: :error_readonly }]
+ .to contain_exactly({ error: :error_readonly })
end
end
diff --git a/spec/support/cuprite_setup.rb b/spec/support/cuprite_setup.rb
index 0f9c354ccc8..f85bfae5a1e 100644
--- a/spec/support/cuprite_setup.rb
+++ b/spec/support/cuprite_setup.rb
@@ -123,7 +123,7 @@ RSpec.configure do |config|
end
end
- config.around(:each, type: :feature, with_cuprite: true) do |example|
+ config.around(:each, :with_cuprite, type: :feature) do |example|
original_driver = Capybara.javascript_driver
begin
Capybara.javascript_driver = :better_cuprite_en
diff --git a/spec/support/edit_fields/date_edit_field.rb b/spec/support/edit_fields/date_edit_field.rb
index 1d9e61be50a..23eb391cd10 100644
--- a/spec/support/edit_fields/date_edit_field.rb
+++ b/spec/support/edit_fields/date_edit_field.rb
@@ -1,4 +1,4 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class DateEditField < EditField
attr_accessor :milestone, :is_table
@@ -115,12 +115,12 @@ class DateEditField < EditField
def expect_inactive!
expect(context).to have_selector(display_selector, wait: 10)
- expect(page).not_to have_selector("#{modal_selector} #{input_selector}")
+ expect(page).to have_no_css("#{modal_selector} #{input_selector}")
end
def expect_calendar
within_modal do
- expect(page).to have_selector(".flatpickr-calendar")
+ expect(page).to have_css(".flatpickr-calendar")
end
end
@@ -132,7 +132,7 @@ class DateEditField < EditField
set_value value
save! if save
- expect_state! open: (expect_failure || !save)
+ expect_state! open: expect_failure || !save
end
end
@@ -150,7 +150,7 @@ class DateEditField < EditField
end
def expect_value(value)
- expect(page).to have_selector(".#{property_name} .spot-input", value:)
+ expect(page).to have_css(".#{property_name} .spot-input", value:)
end
def set_active_date(value)
diff --git a/spec/support/edit_fields/edit_field.rb b/spec/support/edit_fields/edit_field.rb
index 2a5e728991e..a1195cd92c7 100644
--- a/spec/support/edit_fields/edit_field.rb
+++ b/spec/support/edit_fields/edit_field.rb
@@ -50,7 +50,7 @@ class EditField
end
def expect_read_only
- expect(context).to have_selector "#{@selector} #{display_selector}.-read-only"
+ expect(context).to have_css "#{@selector} #{display_selector}.-read-only"
end
def expect_state_text(text)
@@ -123,19 +123,19 @@ class EditField
def expect_inactive!
expect(field_container).to have_selector(display_selector, wait: 10)
- expect(field_container).not_to have_selector(field_type)
+ expect(field_container).to have_no_selector(field_type)
end
def expect_enabled!
- expect(@context).not_to have_selector "#{@selector} #{input_selector}[disabled]"
+ expect(@context).to have_no_css "#{@selector} #{input_selector}[disabled]"
end
def expect_invalid
- expect(page).to have_selector("#{@selector} #{field_type}:invalid")
+ expect(page).to have_css("#{@selector} #{field_type}:invalid")
end
def expect_error
- expect(page).to have_selector("#{@selector} .-error")
+ expect(page).to have_css("#{@selector} .-error")
end
def save!
diff --git a/spec/support/edit_fields/project_status_field.rb b/spec/support/edit_fields/project_status_field.rb
index e343e8a30be..d2aa17157b1 100644
--- a/spec/support/edit_fields/project_status_field.rb
+++ b/spec/support/edit_fields/project_status_field.rb
@@ -1,5 +1,5 @@
require 'support/components/autocompleter/ng_select_autocomplete_helpers'
-require_relative './edit_field'
+require_relative 'edit_field'
class ProjectStatusField < EditField
include ::Components::Autocompleter::NgSelectAutocompleteHelpers
diff --git a/spec/support/edit_fields/select_edit_field.rb b/spec/support/edit_fields/select_edit_field.rb
index efc00d5676f..41ec5f28e69 100644
--- a/spec/support/edit_fields/select_edit_field.rb
+++ b/spec/support/edit_fields/select_edit_field.rb
@@ -1,4 +1,4 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class SelectField < EditField
def expect_value(value)
diff --git a/spec/support/edit_fields/spent_time_edit_field.rb b/spec/support/edit_fields/spent_time_edit_field.rb
index fb0664cd283..99ad4605de7 100644
--- a/spec/support/edit_fields/spent_time_edit_field.rb
+++ b/spec/support/edit_fields/spent_time_edit_field.rb
@@ -1,11 +1,11 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class SpentTimeEditField < EditField
def time_log_icon_visible(visible)
if visible
- expect(page).to have_selector("#{@selector} #{display_selector} #{icon}")
+ expect(page).to have_css("#{@selector} #{display_selector} #{icon}")
else
- expect(page).not_to have_selector("#{@selector} #{display_selector} #{icon}")
+ expect(page).to have_no_css("#{@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 17b72b301c9..e6ded427446 100644
--- a/spec/support/edit_fields/text_area_field.rb
+++ b/spec/support/edit_fields/text_area_field.rb
@@ -1,4 +1,4 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class TextAreaField < EditField
def input_selector
@@ -7,9 +7,9 @@ class TextAreaField < EditField
def expect_save_button(enabled: true)
if enabled
- expect(field_container).not_to have_selector("#{control_link}[disabled]")
+ expect(field_container).to have_no_css("#{control_link}[disabled]")
else
- expect(field_container).to have_selector("#{control_link}[disabled]")
+ expect(field_container).to have_css("#{control_link}[disabled]")
end
end
diff --git a/spec/support/edit_fields/text_editor_field.rb b/spec/support/edit_fields/text_editor_field.rb
index 14572e03870..0917279fc40 100644
--- a/spec/support/edit_fields/text_editor_field.rb
+++ b/spec/support/edit_fields/text_editor_field.rb
@@ -1,4 +1,4 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class TextEditorField < EditField
def ckeditor
@@ -11,9 +11,9 @@ class TextEditorField < EditField
def expect_save_button(enabled: true)
if enabled
- expect(field_container).not_to have_selector("#{control_link}[disabled]")
+ expect(field_container).to have_no_css("#{control_link}[disabled]")
else
- expect(field_container).to have_selector("#{control_link}[disabled]")
+ expect(field_container).to have_css("#{control_link}[disabled]")
end
end
diff --git a/spec/support/edit_fields/work_package_status_field.rb b/spec/support/edit_fields/work_package_status_field.rb
index 1615f46725f..d22b552eaf2 100644
--- a/spec/support/edit_fields/work_package_status_field.rb
+++ b/spec/support/edit_fields/work_package_status_field.rb
@@ -1,4 +1,4 @@
-require_relative './edit_field'
+require_relative 'edit_field'
class WorkPackageStatusField < EditField
def initialize(context)
@@ -51,6 +51,6 @@ class WorkPackageStatusField < EditField
end
def expect_inactive!
- expect(page).not_to have_selector(input_selector)
+ expect(page).to have_no_selector(input_selector)
end
end
diff --git a/spec/support/form_fields/editor_form_field.rb b/spec/support/form_fields/editor_form_field.rb
index e9cf8ebedce..d34bddaa6d2 100644
--- a/spec/support/form_fields/editor_form_field.rb
+++ b/spec/support/form_fields/editor_form_field.rb
@@ -1,4 +1,4 @@
-require_relative './form_field'
+require_relative 'form_field'
module FormFields
class EditorFormField < FormField
diff --git a/spec/support/form_fields/form_field.rb b/spec/support/form_fields/form_field.rb
index a5c2d03d933..0166973fd1e 100644
--- a/spec/support/form_fields/form_field.rb
+++ b/spec/support/form_fields/form_field.rb
@@ -17,7 +17,7 @@ module FormFields
def expect_required
expect(field_container)
- .to have_selector '.spot-form-field--label-indicator', text: '*'
+ .to have_css '.spot-form-field--label-indicator', text: '*'
end
def field_container
diff --git a/spec/support/form_fields/input_form_field.rb b/spec/support/form_fields/input_form_field.rb
index 6114f950715..632df32d5cb 100644
--- a/spec/support/form_fields/input_form_field.rb
+++ b/spec/support/form_fields/input_form_field.rb
@@ -1,14 +1,14 @@
-require_relative './form_field'
+require_relative 'form_field'
module FormFields
class InputFormField < FormField
def expect_value(value)
scroll_to_element(field_container)
- expect(field_container).to have_selector('input') { |el| el.value == value }
+ expect(field_container).to have_css('input') { |el| el.value == value }
end
def expect_visible
- expect(field_container).to have_selector('input')
+ expect(field_container).to have_css('input')
end
##
@@ -28,8 +28,8 @@ module FormFields
end
end
- def send_keys(*args)
- input_element.send_keys(*args)
+ def send_keys(*)
+ input_element.send_keys(*)
end
def input_element
diff --git a/spec/support/form_fields/select_form_field.rb b/spec/support/form_fields/select_form_field.rb
index d59026770ca..030359699f8 100644
--- a/spec/support/form_fields/select_form_field.rb
+++ b/spec/support/form_fields/select_form_field.rb
@@ -1,10 +1,10 @@
-require_relative './form_field'
+require_relative 'form_field'
module FormFields
class SelectFormField < FormField
def expect_selected(*values)
values.each do |val|
- expect(field_container).to have_selector('.ng-value', text: val)
+ expect(field_container).to have_css('.ng-value', text: val)
end
end
@@ -12,11 +12,11 @@ module FormFields
field_container.find('.ng-select-container').click
expect(page)
- .not_to have_selector('.ng-option', text: option, visible: :all)
+ .to have_no_css('.ng-option', text: option, visible: :all)
end
def expect_visible
- expect(field_container).to have_selector('ng-select')
+ expect(field_container).to have_css('ng-select')
end
def select_option(*values)
diff --git a/spec/support/local_storage_cleanup.rb b/spec/support/local_storage_cleanup.rb
index 83dbb3c8fc3..25c8802585f 100644
--- a/spec/support/local_storage_cleanup.rb
+++ b/spec/support/local_storage_cleanup.rb
@@ -27,7 +27,7 @@
#++
RSpec.configure do |config|
- config.after(:each, js: true) do
+ config.after(:each, :js) do
Capybara.current_session.driver.execute_script('window.localStorage.clear()')
rescue StandardError
nil
diff --git a/spec/support/matchers/has_conditional_selector.rb b/spec/support/matchers/has_conditional_selector.rb
index eb30eeab6be..905cc1775c5 100644
--- a/spec/support/matchers/has_conditional_selector.rb
+++ b/spec/support/matchers/has_conditional_selector.rb
@@ -36,11 +36,11 @@
module Capybara
module Node
module Matchers
- def has_conditional_selector?(condition, *args, **kw_args)
+ def has_conditional_selector?(condition, *, **kw_args)
if condition
- has_selector? *args, **kw_args
+ has_selector?(*, **kw_args)
else
- has_no_selector? *args, **kw_args
+ has_no_selector?(*, **kw_args)
end
end
end
diff --git a/spec/support/onboarding_helper.rb b/spec/support/onboarding_helper.rb
index 00f73f9d1f7..335d3c3b4eb 100644
--- a/spec/support/onboarding_helper.rb
+++ b/spec/support/onboarding_helper.rb
@@ -30,7 +30,7 @@ require 'spec_helper'
module OnboardingHelper
def step_through_onboarding_wp_tour(project, wp)
- expect(page).not_to have_selector('.op-loading-indicator')
+ expect(page).to have_no_css('.op-loading-indicator')
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.wp.list')), normalize_ws: true
next_button.click
@@ -69,7 +69,7 @@ module OnboardingHelper
expect(page).to have_text sanitize_string(I18n.t('js.onboarding.steps.help_menu')), normalize_ws: true
next_button.click
- expect(page).not_to have_selector '.enjoy_hint_label'
+ expect(page).to have_no_css '.enjoy_hint_label'
end
def sanitize_string(string)
diff --git a/spec/support/pages/admin/individual_principals/edit.rb b/spec/support/pages/admin/individual_principals/edit.rb
index 074759908e0..d733655b0b1 100644
--- a/spec/support/pages/admin/individual_principals/edit.rb
+++ b/spec/support/pages/admin/individual_principals/edit.rb
@@ -81,18 +81,18 @@ module Pages
end
def expect_project(project_name)
- expect(page).to have_selector('tr', text: project_name, wait: 10)
+ expect(page).to have_css('tr', text: project_name, wait: 10)
end
def expect_no_membership(project_name)
- expect(page).not_to have_selector('tr', text: project_name)
+ expect(page).to have_no_css('tr', text: project_name)
end
def expect_roles(project_name, roles)
row = page.find('tr', text: project_name, wait: 10)
roles.each do |role|
- expect(row).to have_selector('span', text: role)
+ expect(row).to have_css('span', text: role)
end
end
diff --git a/spec/support/pages/admin/placeholder_users/index.rb b/spec/support/pages/admin/placeholder_users/index.rb
index 8f314cdc694..de7663d002a 100644
--- a/spec/support/pages/admin/placeholder_users/index.rb
+++ b/spec/support/pages/admin/placeholder_users/index.rb
@@ -53,10 +53,10 @@ module Pages
def expect_non_listed
expect(page)
- .not_to have_selector('tr.placeholder-user')
+ .to have_no_css('tr.placeholder-user')
expect(page)
- .to have_selector('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
+ .to have_css('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
end
def filter_by_name(value)
@@ -75,18 +75,18 @@ module Pages
end
def expect_no_delete_button_for_all_rows
- expect(page).to have_selector('i.icon-help2')
+ expect(page).to have_css('i.icon-help2')
end
def expect_no_delete_button(placeholder_user)
within_placeholder_user_row(placeholder_user) do
- expect(page).to have_selector('i.icon-help2')
+ expect(page).to have_css('i.icon-help2')
end
end
def expect_delete_button(placeholder_user)
within_placeholder_user_row(placeholder_user) do
- expect(page).to have_selector('i.icon-delete')
+ expect(page).to have_css('i.icon-delete')
end
end
diff --git a/spec/support/pages/admin/users/edit.rb b/spec/support/pages/admin/users/edit.rb
index f510a4d02cc..c48d97c78d6 100644
--- a/spec/support/pages/admin/users/edit.rb
+++ b/spec/support/pages/admin/users/edit.rb
@@ -77,18 +77,18 @@ module Pages
end
def expect_project(project_name)
- expect(page).to have_selector('tr', text: project_name, wait: 10)
+ expect(page).to have_css('tr', text: project_name, wait: 10)
end
def expect_no_membership(project_name)
- expect(page).not_to have_selector('tr', text: project_name)
+ expect(page).to have_no_css('tr', text: project_name)
end
def expect_roles(project_name, roles)
row = page.find('tr', text: project_name, wait: 10)
roles.each do |role|
- expect(row).to have_selector('span', text: role)
+ expect(row).to have_css('span', text: role)
end
end
diff --git a/spec/support/pages/admin/users/index.rb b/spec/support/pages/admin/users/index.rb
index 79928704241..10837724eaf 100644
--- a/spec/support/pages/admin/users/index.rb
+++ b/spec/support/pages/admin/users/index.rb
@@ -48,15 +48,15 @@ module Pages
def expect_non_listed
expect(page)
- .not_to have_selector('tr.user')
+ .to have_no_css('tr.user')
expect(page)
- .to have_selector('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
+ .to have_css('tr.generic-table--empty-row', text: 'There is currently nothing to display.')
end
def expect_user_locked(user)
expect(page)
- .to have_selector('tr.user.locked td.username', text: user.login)
+ .to have_css('tr.user.locked td.username', text: user.login)
end
def filter_by_status(value)
diff --git a/spec/support/pages/members.rb b/spec/support/pages/members.rb
index 17b186b195b..227aee8d712 100644
--- a/spec/support/pages/members.rb
+++ b/spec/support/pages/members.rb
@@ -41,7 +41,7 @@ module Pages
def visit!
super
- expect(page).to have_selector('h2', text: I18n.t(:label_member_plural))
+ expect(page).to have_css('h2', text: I18n.t(:label_member_plural))
self
end
@@ -219,9 +219,9 @@ module Pages
def expect_sorted_by(column, desc: false)
page.within('.generic-table--sort-header', text: column.upcase) do
if desc
- expect(page).to have_selector('.sort.desc')
+ expect(page).to have_css('.sort.desc')
else
- expect(page).to have_selector('.sort.asc')
+ expect(page).to have_css('.sort.asc')
end
end
end
diff --git a/spec/support/pages/messages/index.rb b/spec/support/pages/messages/index.rb
index 18edf08b9e4..5b6c16d42d5 100644
--- a/spec/support/pages/messages/index.rb
+++ b/spec/support/pages/messages/index.rb
@@ -52,13 +52,13 @@ module Pages::Messages
row = subject.find(:xpath, '..')
within(row) do
- expect(page).to have_selector('td.replies', text: replies) if replies
- expect(page).to have_selector('td.last_message', text: last_message) if last_message
+ expect(page).to have_css('td.replies', text: replies) if replies
+ expect(page).to have_css('td.last_message', text: last_message) if last_message
end
end
def expect_num_replies(amount)
- expect(page).to have_selector('td.replies', text: amount)
+ expect(page).to have_css('td.replies', text: amount)
end
end
end
diff --git a/spec/support/pages/messages/show.rb b/spec/support/pages/messages/show.rb
index 1eee294ddf7..708680bbbc7 100644
--- a/spec/support/pages/messages/show.rb
+++ b/spec/support/pages/messages/show.rb
@@ -37,11 +37,11 @@ module Pages::Messages
end
def expect_subject(subject)
- expect(page).to have_selector('.title-container', text: subject)
+ expect(page).to have_css('.title-container', text: subject)
end
def expect_content(content)
- expect(page).to have_selector('.forum-message .wiki', text: content)
+ expect(page).to have_css('.forum-message .wiki', text: content)
end
def expect_no_replies
@@ -57,7 +57,7 @@ module Pages::Messages
click_button 'Submit'
- expect(page).to have_selector('.forum-message--comments', text:)
+ expect(page).to have_css('.forum-message--comments', text:)
Message.last
end
@@ -88,7 +88,7 @@ module Pages::Messages
subject_field.native.send_keys(:return)
text = (quoted_message || Message.first).content
- expect(page).to have_selector('.forum-message--comments blockquote', text:)
+ expect(page).to have_css('.forum-message--comments blockquote', text:)
Message.last
end
diff --git a/spec/support/pages/my/password_page.rb b/spec/support/pages/my/password_page.rb
index 1ebf28d02f2..0b5a010414f 100644
--- a/spec/support/pages/my/password_page.rb
+++ b/spec/support/pages/my/password_page.rb
@@ -56,7 +56,7 @@ module Pages
def expect_password_updated_message
expect(page)
- .to have_selector('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
+ .to have_css('.op-toast.-info', text: I18n.t(:notice_account_password_updated))
end
private
diff --git a/spec/support/pages/notifications/center.rb b/spec/support/pages/notifications/center.rb
index 47c64518ac7..6c0c0d7ac80 100644
--- a/spec/support/pages/notifications/center.rb
+++ b/spec/support/pages/notifications/center.rb
@@ -81,23 +81,23 @@ module Pages
def expect_no_item(*notifications)
notifications.each do |notification|
expect(page)
- .not_to have_selector("[data-test-selector='op-ian-notification-item-#{notification.id}']")
+ .to have_no_css("[data-test-selector='op-ian-notification-item-#{notification.id}']")
end
end
def expect_read_item(notification)
expect(page)
- .to have_selector("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")
+ .to have_css("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")
end
def expect_item_not_read(notification)
expect(page)
- .not_to have_selector("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")
+ .to have_no_css("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-read]")
end
def expect_item_selected(notification)
expect(page)
- .to have_selector("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-selected]")
+ .to have_css("[data-test-selector='op-ian-notification-item-#{notification.id}'][data-qa-ian-selected]")
end
def expect_work_package_item(*notifications)
@@ -111,11 +111,11 @@ module Pages
end
def expect_closed
- expect(page).not_to have_selector('op-in-app-notification-center')
+ expect(page).to have_no_css('op-in-app-notification-center')
end
def expect_open
- expect(page).to have_selector('op-in-app-notification-center')
+ expect(page).to have_css('op-in-app-notification-center')
end
def expect_empty
@@ -124,17 +124,17 @@ module Pages
def expect_number_of_notifications(count)
if count == 0
- expect(page).not_to have_selector('[data-test-selector^="op-ian-notification-item-"]')
+ expect(page).to have_no_css('[data-test-selector^="op-ian-notification-item-"]')
else
- expect(page).to have_selector('[data-test-selector^="op-ian-notification-item-"]', count:, wait: 10)
+ expect(page).to have_css('[data-test-selector^="op-ian-notification-item-"]', count:, wait: 10)
end
end
def expect_bell_count(count)
if count == 0
- expect(page).not_to have_selector('[data-test-selector="op-ian-notifications-count"]')
+ expect(page).to have_no_css('[data-test-selector="op-ian-notifications-count"]')
else
- expect(page).to have_selector('[data-test-selector="op-ian-notifications-count"]', text: count, wait: 10)
+ expect(page).to have_css('[data-test-selector="op-ian-notifications-count"]', text: count, wait: 10)
end
end
@@ -143,11 +143,11 @@ module Pages
end
def expect_no_toaster
- expect(page).not_to have_selector('.op-toast.-info', wait: 10)
+ expect(page).to have_no_css('.op-toast.-info', wait: 10)
end
def expect_toast
- expect(page).to have_selector('.op-toast.-info', wait: 10)
+ expect(page).to have_css('.op-toast.-info', wait: 10)
end
def update_via_toaster
diff --git a/spec/support/pages/notifications/settings.rb b/spec/support/pages/notifications/settings.rb
index 9db9c84eb95..3cbecb3f8c9 100644
--- a/spec/support/pages/notifications/settings.rb
+++ b/spec/support/pages/notifications/settings.rb
@@ -61,14 +61,14 @@ module Pages
work_package_prioritized
work_package_scheduled
].each do |type|
- expect(page).to have_selector("input[type='checkbox'][data-qa-global-notification-type='#{type}']") { |checkbox|
+ expect(page).to have_css("input[type='checkbox'][data-qa-global-notification-type='#{type}']") { |checkbox|
checkbox.checked? == setting[type]
}
end
end
def expect_project(project)
- expect(page).to have_selector('th', text: project.name)
+ expect(page).to have_css('th', text: project.name)
end
def add_project(project)
@@ -99,7 +99,7 @@ module Pages
end
def expect_no_date_alert_setting(label)
- expect(page).not_to have_selector(
+ expect(page).to have_no_css(
"select[data-qa-global-notification-type='op-reminder-settings-#{label}-alerts']"
)
end
@@ -121,7 +121,7 @@ module Pages
end
def expect_no_project_date_alert_setting(label, project)
- expect(page).not_to have_selector(
+ expect(page).to have_no_css(
"select[data-qa-project='#{project}'][data-qa-project-notification-type='op-reminder-settings-#{label}-alerts']"
)
end
diff --git a/spec/support/pages/notifications/split_screen.rb b/spec/support/pages/notifications/split_screen.rb
index f4a691024fd..ff1690bf236 100644
--- a/spec/support/pages/notifications/split_screen.rb
+++ b/spec/support/pages/notifications/split_screen.rb
@@ -35,7 +35,7 @@ module Pages
include ::Components::Autocompleter::NgSelectAutocompleteHelpers
def initialize(work_package, project = nil)
- super work_package, project
+ super(work_package, project)
@selector = '.work-packages--details'
end
end
diff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rb
index 8c5c6c9962b..05f974a9b1f 100644
--- a/spec/support/pages/projects/index.rb
+++ b/spec/support/pages/projects/index.rb
@@ -59,9 +59,9 @@ module Pages
projects.each do |project|
case project
when Project
- expect(page).not_to have_text(project.name)
+ expect(page).to have_no_text(project.name)
when String
- expect(page).not_to have_text(project)
+ expect(page).to have_no_text(project)
else
raise ArgumentError, "#{project.inspect} is not a Project or a String"
end
@@ -89,7 +89,7 @@ module Pages
end
def expect_no_project_create_button
- expect(page).not_to have_css('[data-test-selector="project-new-button"]')
+ expect(page).to have_no_css('[data-test-selector="project-new-button"]')
end
def expect_gantt_button(disabled: false)
diff --git a/spec/support/pages/projects/settings.rb b/spec/support/pages/projects/settings.rb
index ee5927f5893..8ddf6e7aac1 100644
--- a/spec/support/pages/projects/settings.rb
+++ b/spec/support/pages/projects/settings.rb
@@ -45,7 +45,7 @@ module Pages
# only notice is used as opposed to op-toast
def expect_toast(message:, type: :success)
- expect(page).to have_selector(".op-toast.-#{type}", text: message, wait: 10)
+ expect(page).to have_css(".op-toast.-#{type}", text: message, wait: 10)
end
def expect_type_active(type)
diff --git a/spec/support/pages/reminders/settings.rb b/spec/support/pages/reminders/settings.rb
index dca2ff7f375..3e2ff886009 100644
--- a/spec/support/pages/reminders/settings.rb
+++ b/spec/support/pages/reminders/settings.rb
@@ -70,9 +70,9 @@ module Pages
def expect_immediate_reminder(name, enabled)
if enabled
- expect(page).to have_selector("input[data-qa-immediate-reminder='#{name}']:checked")
+ expect(page).to have_css("input[data-qa-immediate-reminder='#{name}']:checked")
else
- expect(page).to have_selector("input[data-qa-immediate-reminder='#{name}']:not(:checked)")
+ expect(page).to have_css("input[data-qa-immediate-reminder='#{name}']:not(:checked)")
end
end
@@ -112,12 +112,12 @@ module Pages
if paused
expect(page).to have_checked_field 'Temporarily pause daily email reminders'
else
- expect(page).not_to have_checked_field 'Temporarily pause daily email reminders'
+ expect(page).to have_no_checked_field 'Temporarily pause daily email reminders'
end
if first && last
- expect(page).to have_selector('[data-test-selector="op-basic-range-date-picker"]',
- value: "#{first.iso8601} - #{last.iso8601}")
+ expect(page).to have_css('[data-test-selector="op-basic-range-date-picker"]',
+ value: "#{first.iso8601} - #{last.iso8601}")
end
end
diff --git a/spec/support/pages/versions/roadmap.rb b/spec/support/pages/versions/roadmap.rb
index fbb1ba2ee6d..3739523dea8 100644
--- a/spec/support/pages/versions/roadmap.rb
+++ b/spec/support/pages/versions/roadmap.rb
@@ -63,7 +63,7 @@ module Pages
def expect_filter_not_set(filter_name)
within '#menu-sidebar' do
- expect(page).not_to have_checked_field(filter_name)
+ expect(page).to have_no_checked_field(filter_name)
end
end
@@ -78,7 +78,7 @@ module Pages
def expect_versions_not_listed(*versions)
within '#roadmap' do
versions.each do |version|
- expect(page).not_to have_content version.name
+ expect(page).to have_no_content version.name
end
end
end
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index fe84b3779c3..43a18656f29 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -81,7 +81,7 @@ module Pages
def expect_hidden_field(attribute)
page.within(container) do
- expect(page).not_to have_selector(".inline-edit--display-field.#{attribute}")
+ expect(page).to have_no_css(".inline-edit--display-field.#{attribute}")
end
end
@@ -117,7 +117,7 @@ module Pages
end
def expect_no_group(name)
- expect(page).not_to have_css('.attributes-group--header-text', text: name.upcase)
+ expect(page).to have_no_css('.attributes-group--header-text', text: name.upcase)
end
def expect_attributes(attribute_expectations)
@@ -126,13 +126,13 @@ module Pages
if label == 'status'
expect(page).to have_css("[data-test-selector='op-wp-status-button'] .button", text: value)
else
- expect(page).to have_selector(".inline-edit--container.#{label.camelize(:lower)}", text: value)
+ expect(page).to have_css(".inline-edit--container.#{label.camelize(:lower)}", text: value)
end
end
end
def expect_no_attribute(label)
- expect(page).not_to have_selector(".inline-edit--container.#{label.downcase}")
+ expect(page).to have_no_css(".inline-edit--container.#{label.downcase}")
end
alias :expect_attribute_hidden :expect_no_attribute
@@ -140,7 +140,7 @@ module Pages
container = '#work-package-activites-container'
container += " #activity-#{number}" if number
- expect(page).to have_selector("#{container} .op-user-activity--user-line", text: user.name)
+ expect(page).to have_css("#{container} .op-user-activity--user-line", text: user.name)
end
def expect_activity_message(message)
@@ -151,7 +151,7 @@ module Pages
def expect_no_parent
visit_tab!('relations')
- expect(page).not_to have_css('[data-test-selector="op-wp-breadcrumb-parent"]')
+ expect(page).to have_no_css('[data-test-selector="op-wp-breadcrumb-parent"]')
end
def expect_zen_mode
@@ -161,7 +161,7 @@ module Pages
end
def expect_no_zen_mode
- expect(page).not_to have_css('.zen-mode')
+ expect(page).to have_no_css('.zen-mode')
expect(page).to have_css('#main-menu')
expect(page).to have_css('.op-app-header')
end
@@ -178,7 +178,7 @@ module Pages
def expect_no_custom_action(name)
expect(page)
- .not_to have_css('.custom-action', text: name)
+ .to have_no_css('.custom-action', text: name)
end
def expect_custom_action_order(*names)
diff --git a/spec/support/pages/work_packages/abstract_work_package_create.rb b/spec/support/pages/work_packages/abstract_work_package_create.rb
index 74ac5a029b0..d96bbf22595 100644
--- a/spec/support/pages/work_packages/abstract_work_package_create.rb
+++ b/spec/support/pages/work_packages/abstract_work_package_create.rb
@@ -59,7 +59,7 @@ module Pages
def expect_fully_loaded
expect_angular_frontend_initialized
- expect(page).to have_selector '#wp-new-inline-edit--field-subject', wait: 20
+ expect(page).to have_css '#wp-new-inline-edit--field-subject', wait: 20
end
def save!
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 3709f881862..b615acf41db 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
@@ -44,26 +44,26 @@ module Pages
def expect_wp_create_button
expect(page)
- .to have_selector('.add-work-package:not([disabled])', text: 'Create')
+ .to have_css('.add-work-package:not([disabled])', text: 'Create')
end
def expect_wp_create_button_disabled
expect(page)
- .to have_selector('.add-work-package[disabled]', text: 'Create')
+ .to have_css('.add-work-package[disabled]', text: 'Create')
end
def expect_type_available_for_create(type)
click_wp_create_button
expect(page)
- .to have_selector('#types-context-menu .menu-item', text: type.name.upcase)
+ .to have_css('#types-context-menu .menu-item', text: type.name.upcase)
end
def expect_type_not_available_for_create(type)
click_wp_create_button
expect(page)
- .not_to have_selector('#types-context-menu .menu-item', text: type.name.upcase)
+ .to have_no_css('#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 6065c1704b7..b26b4e8d8a9 100644
--- a/spec/support/pages/work_packages/split_work_package.rb
+++ b/spec/support/pages/work_packages/split_work_package.rb
@@ -34,7 +34,7 @@ module Pages
attr_reader :selector
def initialize(work_package, project = nil)
- super work_package, project
+ super(work_package, project)
@selector = '.work-packages--details'
end
@@ -44,7 +44,7 @@ module Pages
end
def expect_closed
- expect(page).not_to have_selector(@selector)
+ expect(page).to have_no_selector(@selector)
end
def expect_open
diff --git a/spec/support/pages/work_packages/work_package_card.rb b/spec/support/pages/work_packages/work_package_card.rb
index 54611c7bb6b..326ca58fff8 100644
--- a/spec/support/pages/work_packages/work_package_card.rb
+++ b/spec/support/pages/work_packages/work_package_card.rb
@@ -51,13 +51,13 @@ module Pages
def expect_type(name)
page.within(card_element) do
- expect(page).to have_selector('[data-test-selector="op-wp-single-card--content-type"]', text: name.upcase)
+ expect(page).to have_css('[data-test-selector="op-wp-single-card--content-type"]', text: name.upcase)
end
end
def expect_subject(subject)
page.within(card_element) do
- expect(page).to have_selector('[data-test-selector="op-wp-single-card--content-subject"]', text: subject)
+ expect(page).to have_css('[data-test-selector="op-wp-single-card--content-subject"]', text: subject)
end
end
diff --git a/spec/support/pages/work_packages/work_package_cards.rb b/spec/support/pages/work_packages/work_package_cards.rb
index ab25e5692e6..298993fd047 100644
--- a/spec/support/pages/work_packages/work_package_cards.rb
+++ b/spec/support/pages/work_packages/work_package_cards.rb
@@ -37,18 +37,18 @@ module Pages
end
def expect_work_package_count(count)
- expect(page).to have_selector('wp-single-card', count:, wait: 20)
+ expect(page).to have_css('wp-single-card', count:, wait: 20)
end
def expect_work_package_listed(*work_packages)
work_packages.each do |wp|
- expect(page).to have_selector("wp-single-card[data-work-package-id='#{wp.id}']", wait: 10)
+ expect(page).to have_css("wp-single-card[data-work-package-id='#{wp.id}']", wait: 10)
end
end
def expect_work_package_not_listed(*work_packages)
work_packages.each do |wp|
- expect(page).not_to have_selector("wp-single-card[data-work-package-id='#{wp.id}']")
+ expect(page).to have_no_css("wp-single-card[data-work-package-id='#{wp.id}']")
end
end
@@ -122,12 +122,12 @@ module Pages
def select_all_work_packages
find('body').send_keys [:control, 'a']
- expect(page).not_to have_selector '#work-package-context-menu'
+ expect(page).to have_no_css '#work-package-context-menu'
end
def deselect_all_work_packages
find('body').send_keys [:control, 'd']
- expect(page).not_to have_selector '#work-package-context-menu'
+ expect(page).to have_no_css '#work-package-context-menu'
end
def card(work_package)
diff --git a/spec/support/pages/work_packages/work_packages_table.rb b/spec/support/pages/work_packages/work_packages_table.rb
index fc68a9d418f..7106f4b40cb 100644
--- a/spec/support/pages/work_packages/work_packages_table.rb
+++ b/spec/support/pages/work_packages/work_packages_table.rb
@@ -51,9 +51,9 @@ module Pages
def expect_work_package_listed(*work_packages)
within(table_container) do
work_packages.each do |wp|
- expect(page).to have_selector(".wp-row-#{wp.id} td.subject",
- text: wp.subject,
- wait: 20)
+ expect(page).to have_css(".wp-row-#{wp.id} td.subject",
+ text: wp.subject,
+ wait: 20)
end
end
end
@@ -61,7 +61,7 @@ module Pages
def expect_work_package_with_attributes(work_package, attr_value_hash)
within(table_container) do
attr_value_hash.each do |column, value|
- expect(page).to have_selector(
+ expect(page).to have_css(
".wp-row-#{work_package.id} td.#{column}", text: value.to_s, wait: 20
)
end
@@ -71,7 +71,7 @@ module Pages
def expect_sums_row_with_attributes(attr_value_hash)
within(table_container) do
attr_value_hash.each do |column, value|
- expect(page).to have_selector(
+ expect(page).to have_css(
".wp-table--sums-row div.#{column}", text: value.to_s, wait: 10
)
end
@@ -80,15 +80,15 @@ module Pages
def expect_work_package_subject(subject)
within(table_container) do
- expect(page).to have_selector("td.subject",
- text: subject,
- wait: 20)
+ expect(page).to have_css("td.subject",
+ text: subject,
+ wait: 20)
end
end
def expect_work_package_count(count)
within(table_container) do
- expect(page).to have_selector(".wp--row", count:, wait: 20)
+ expect(page).to have_css(".wp--row", count:, wait: 20)
end
end
@@ -107,7 +107,7 @@ module Pages
retry_block(args: { tries: 3, base_interval: 5 }) do
within(table_container) do
work_packages.each do |wp|
- expect(page).not_to have_selector(".wp-row-#{wp.id} td.subject", text: wp.subject)
+ expect(page).to have_no_css(".wp-row-#{wp.id} td.subject", text: wp.subject)
end
end
end
@@ -134,7 +134,7 @@ module Pages
expect(page).to have_field('editable-toolbar-title', with: name, wait: 10)
else
expect(page)
- .to have_selector('.toolbar-container', text: name, wait: 10)
+ .to have_css('.toolbar-container', text: name, wait: 10)
end
end
@@ -142,7 +142,7 @@ module Pages
page.find('.title-container').click
page.within('#viewSelect') do
- expect(page).to have_selector('.op-sidemenu--item-action', text: name)
+ expect(page).to have_css('.op-sidemenu--item-action', text: name)
end
end
@@ -153,7 +153,7 @@ module Pages
sleep 3
container.find('[data-test-selector="op-wp-inline-create"]').click
- expect(container).to have_selector('.wp-inline-create-row', wait: 10)
+ expect(container).to have_css('.wp-inline-create-row', wait: 10)
end
def open_split_view(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 b5012fc2ae3..ef851ea56a7 100644
--- a/spec/support/pages/work_packages/work_packages_timeline.rb
+++ b/spec/support/pages/work_packages/work_packages_timeline.rb
@@ -45,7 +45,7 @@ module Pages
def expect_row_count(num)
within(timeline_container) do
- expect(page).to have_selector('.wp-timeline-cell', count: num)
+ expect(page).to have_css('.wp-timeline-cell', count: num)
end
end
@@ -55,7 +55,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_selector(".wp-row-#{wp.id}-timeline", visible: true)
+ expect(page).to have_css(".wp-row-#{wp.id}-timeline", visible: true)
end
end
end
@@ -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).not_to have_selector(".wp-row-#{wp.id}-timeline", visible: true)
+ expect(page).to have_no_css(".wp-row-#{wp.id}-timeline", visible: true)
end
end
end
@@ -85,11 +85,11 @@ module Pages
def expect_timeline!(open: true)
if open
- expect(page).to have_selector('#wp-view-toggle-button', text: 'Gantt')
- expect(page).to have_selector('.wp-table-timeline--container .wp-timeline-cell')
+ expect(page).to have_css('#wp-view-toggle-button', text: 'Gantt')
+ expect(page).to have_css('.wp-table-timeline--container .wp-timeline-cell')
else
- 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)
+ expect(page).to have_no_css('#wp-view-toggle-button', text: 'Gantt')
+ expect(page).to have_no_css('.wp-table-timeline--container .wp-timeline-cell', visible: true)
end
end
@@ -122,34 +122,34 @@ module Pages
raise ArgumentError, "Invalid value"
end
- expect(page).to have_selector(".wp-table-timeline--header-inner[data-current-zoom-level='#{value}']")
+ expect(page).to have_css(".wp-table-timeline--header-inner[data-current-zoom-level='#{value}']")
end
def expect_timeline_element(work_package)
type = work_package.milestone? ? :milestone : :bar
- expect(page).to have_selector(".wp-row-#{work_package.id}-timeline .timeline-element.#{type}")
+ expect(page).to have_css(".wp-row-#{work_package.id}-timeline .timeline-element.#{type}")
end
def expect_timeline_relation(from, to)
within(timeline_container) do
- expect(page).to have_selector(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}", minimum: 1)
+ expect(page).to have_css(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}", minimum: 1)
end
end
def expect_no_timeline_relation(from, to)
within(timeline_container) do
- expect(page).not_to have_selector(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}")
+ expect(page).to have_no_css(".relation-line.__tl-relation-#{from.id}.__tl-relation-#{to.id}")
end
end
def expect_no_relations
within(timeline_container) do
- expect(page).not_to have_selector(".relation-line")
+ expect(page).to have_no_css(".relation-line")
end
end
def expect_hidden_row(work_package)
- expect(page).to have_selector(".wp-row-#{work_package.id}-timeline", visible: :hidden)
+ expect(page).to have_css(".wp-row-#{work_package.id}-timeline", visible: :hidden)
end
end
end
diff --git a/spec/support/puffing_billy_proxy.rb b/spec/support/puffing_billy_proxy.rb
index 9450b14aa22..ccee3840aea 100644
--- a/spec/support/puffing_billy_proxy.rb
+++ b/spec/support/puffing_billy_proxy.rb
@@ -45,7 +45,7 @@ require 'table_print' # Add this dependency to your gemfile
# https://github.com/oesmith/puffing-billy/issues/253
module BillyProxyPatch
def stop
- return unless EM.reactor_running?
+ nil unless EM.reactor_running?
rescue Errno::ECONNRESET => e
warn "Got error while shutting down Billy proxy"
end
diff --git a/spec/support/queries/filters/shared_filter_examples.rb b/spec/support/queries/filters/shared_filter_examples.rb
index f4e96083526..660bd975475 100644
--- a/spec/support/queries/filters/shared_filter_examples.rb
+++ b/spec/support/queries/filters/shared_filter_examples.rb
@@ -391,8 +391,8 @@ RSpec.shared_examples_for 'boolean query filter' do |scope: true|
describe '#allowed_values' do
it 'is list for a bool' do
expect(instance.allowed_values)
- .to match_array [[I18n.t(:general_text_yes), OpenProject::Database::DB_VALUE_TRUE],
- [I18n.t(:general_text_no), OpenProject::Database::DB_VALUE_FALSE]]
+ .to contain_exactly([I18n.t(:general_text_yes), OpenProject::Database::DB_VALUE_TRUE],
+ [I18n.t(:general_text_no), OpenProject::Database::DB_VALUE_FALSE])
end
end
@@ -554,7 +554,7 @@ RSpec.shared_examples_for 'filter by work package id' do
.and_return([visible_wp])
expect(instance.value_objects)
- .to match_array [visible_wp]
+ .to contain_exactly(visible_wp)
end
end
@@ -583,7 +583,7 @@ RSpec.shared_examples_for 'filter by work package id' do
instance.valid_values!
expect(instance.values)
- .to match_array [visible_wp.id.to_s]
+ .to contain_exactly(visible_wp.id.to_s)
end
end
@@ -603,7 +603,7 @@ RSpec.shared_examples_for 'filter by work package id' do
instance.valid_values!
expect(instance.values)
- .to match_array [visible_wp.id.to_s]
+ .to contain_exactly(visible_wp.id.to_s)
end
end
end
@@ -683,7 +683,7 @@ RSpec.shared_examples_for 'operators for relation filters' do
it 'returns the related work packages' do
expect(WorkPackage.where(instance.where))
- .to match_array [related_wp]
+ .to contain_exactly(related_wp)
end
end
@@ -694,7 +694,7 @@ RSpec.shared_examples_for 'operators for relation filters' do
it 'returns the unrelated work packages' do
expect(WorkPackage.where(instance.where))
- .to match_array [filter_value_wp, unrelated_wp]
+ .to contain_exactly(filter_value_wp, unrelated_wp)
end
end
end
diff --git a/spec/support/repository_helpers.rb b/spec/support/repository_helpers.rb
index fc245f5a694..de2c6f12f9b 100644
--- a/spec/support/repository_helpers.rb
+++ b/spec/support/repository_helpers.rb
@@ -33,7 +33,7 @@
# due to performance.
# As we do not write to the repository, we don't need this kind
# of isolation.
-def with_filesystem_repository(vendor, command = nil, &block)
+def with_filesystem_repository(vendor, command = nil)
repo_dir = Dir.mktmpdir("#{vendor}_repository")
fixture = Rails.root.join("spec/fixtures/repositories/#{vendor}_repository.tar.gz")
@@ -47,7 +47,7 @@ def with_filesystem_repository(vendor, command = nil, &block)
skip_if_command_unavailable('tar')
system "tar -xzf #{fixture} -C #{repo_dir}"
- block.call(repo_dir)
+ yield(repo_dir)
end
def with_subversion_repository(&)
@@ -64,12 +64,12 @@ end
# no actual filesystem access occurred.
# Instead, we wrap these repository specs in a virtual
# subversion repository which does not exist on disk.
-def with_virtual_subversion_repository(&block)
+def with_virtual_subversion_repository
let(:repository) { create(:repository_subversion) }
before do
allow(Setting).to receive(:enabled_scm).and_return(['subversion'])
end
- block.call
+ yield
end
diff --git a/spec/support/rspec_retry.rb b/spec/support/rspec_retry.rb
index 51ade929fa8..bca85359e63 100644
--- a/spec/support/rspec_retry.rb
+++ b/spec/support/rspec_retry.rb
@@ -37,7 +37,7 @@ end
# failures
def retry_block(args: {}, screenshot: false, &block)
if ENV["RSPEC_RETRY_RETRY_COUNT"] == "0"
- block.call
+ yield
return
end
diff --git a/spec/support/scm/countable_repository.rb b/spec/support/scm/countable_repository.rb
index 596d594b19f..e7e42d2f6ad 100644
--- a/spec/support/scm/countable_repository.rb
+++ b/spec/support/scm/countable_repository.rb
@@ -19,17 +19,17 @@ RSpec.shared_examples_for 'is a countable repository' do
end
it 'has has not been counted initially' do
- expect(repository.required_storage_bytes).to be == 0
+ expect(repository.required_storage_bytes).to eq 0
expect(repository.storage_updated_at).to be_nil
end
it 'counts the repository storage automatically' do
- expect(repository.required_storage_bytes).to be == 0
+ expect(repository.required_storage_bytes).to eq 0
expect(repository.update_required_storage).to be true
perform_enqueued_jobs
- expect(repository.required_storage_bytes).to be == count
+ expect(repository.required_storage_bytes).to eq count
expect(repository.update_required_storage).to be false
expect(repository.storage_updated_at).to be >= 1.minute.ago
end
@@ -40,19 +40,19 @@ RSpec.shared_examples_for 'is a countable repository' do
end
it 'sucessfuly updates the count to what the adapter returns' do
- expect(repository.required_storage_bytes).to be == 0
+ expect(repository.required_storage_bytes).to eq 0
expect(repository.update_required_storage).to be true
perform_enqueued_jobs
- expect(repository.required_storage_bytes).to be == count
+ expect(repository.required_storage_bytes).to eq count
end
end
end
context 'with real counter' do
it 'counts the repository storage automatically' do
- expect(repository.required_storage_bytes).to be == 0
+ expect(repository.required_storage_bytes).to eq 0
expect(repository.update_required_storage).to be true
perform_enqueued_jobs
diff --git a/spec/support/scm/relocate_repository.rb b/spec/support/scm/relocate_repository.rb
index eb16bf42f4d..998047269b1 100644
--- a/spec/support/scm/relocate_repository.rb
+++ b/spec/support/scm/relocate_repository.rb
@@ -4,7 +4,7 @@ RSpec.shared_examples_for 'repository can be relocated' do |vendor|
end
let(:project) { build(:project) }
let(:repository) do
- repo = build("repository_#{vendor}".to_sym,
+ repo = build(:"repository_#{vendor}",
project:,
scm_type: :managed)
@@ -45,7 +45,7 @@ RSpec.shared_examples_for 'repository can be relocated' do |vendor|
end
end
- context 'with managed remote config', webmock: true do
+ context 'with managed remote config', :webmock do
let(:url) { 'http://myreposerver.example.com/api/' }
let(:config) { { manages: url } }
@@ -53,7 +53,7 @@ RSpec.shared_examples_for 'repository can be relocated' do |vendor|
stub_request(:post, url)
.to_return(status: 200,
body: { success: true, url: 'file:///foo/bar', path: '/tmp/foo/bar' }.to_json)
- create("repository_#{vendor}".to_sym,
+ create(:"repository_#{vendor}",
project:,
scm_type: :managed)
end
diff --git a/spec/support/shared/expect_page_reload.rb b/spec/support/shared/expect_page_reload.rb
index 5b7b5a140ff..e4f2c68ff0c 100644
--- a/spec/support/shared/expect_page_reload.rb
+++ b/spec/support/shared/expect_page_reload.rb
@@ -34,7 +34,7 @@ def expect_page_reload
yield
- expect(page).to have_selector('body') { |body|
+ expect(page).to have_css('body') { |body|
Time.parse(body['data-rendered-at']) > current_render
}
end
diff --git a/spec/support/shared/forms_html.rb b/spec/support/shared/forms_html.rb
index 460e9224c8c..99c199f7a4e 100644
--- a/spec/support/shared/forms_html.rb
+++ b/spec/support/shared/forms_html.rb
@@ -28,13 +28,13 @@
RSpec.shared_examples_for 'labelled' do
it 'has a label with title' do
- expect(subject).to have_selector 'label.form--label[title]'
+ expect(subject).to have_css 'label.form--label[title]'
end
end
RSpec.shared_examples_for 'not labelled' do
it 'does not have a label with title' do
- expect(subject).not_to have_selector 'label.form--label[title]'
+ expect(subject).to have_no_css 'label.form--label[title]'
end
end
@@ -51,7 +51,7 @@ RSpec.shared_examples_for 'labelled by default' do
end
RSpec.shared_examples_for 'wrapped in container' do |container = 'field-container'|
- it { is_expected.to have_selector "span.form--#{container}", count: 1 }
+ it { is_expected.to have_css "span.form--#{container}", count: 1 }
context 'with additional class provided' do
let(:css_class) { 'my-additional-class' }
@@ -62,13 +62,13 @@ RSpec.shared_examples_for 'wrapped in container' do |container = 'field-containe
end
it 'has the class' do
- expect(subject).to have_selector "span.#{css_class}", count: expected_container_count
+ expect(subject).to have_css "span.#{css_class}", count: expected_container_count
end
end
end
RSpec.shared_examples_for 'not wrapped in container' do |container = 'field-container'|
- it { is_expected.not_to have_selector "span.form--#{container}" }
+ it { is_expected.to have_no_css "span.form--#{container}" }
end
RSpec.shared_examples_for 'wrapped in field-container by default' do
diff --git a/spec/support/shared/loading_indicator_saveguard.rb b/spec/support/shared/loading_indicator_saveguard.rb
index 37d58898fc4..83543680500 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).not_to have_selector('.op-loading-indicator')
+ expect(page).to have_no_css('.op-loading-indicator')
end
diff --git a/spec/support/shared/with_config.rb b/spec/support/shared/with_config.rb
index 7e75024a698..19a8669bed9 100644
--- a/spec/support/shared/with_config.rb
+++ b/spec/support/shared/with_config.rb
@@ -35,9 +35,9 @@ class WithConfig
##
# We need this so calls to rspec mocks (allow, expect etc.) will work here as expected.
- def method_missing(method, *args, &)
+ def method_missing(method, *, &)
if context.respond_to?(method)
- context.send(method, *args, &)
+ context.send(method, *, &)
else
super
end
diff --git a/spec/support/shared/with_direct_uploads.rb b/spec/support/shared/with_direct_uploads.rb
index 070fc36d882..ba2da109028 100644
--- a/spec/support/shared/with_direct_uploads.rb
+++ b/spec/support/shared/with_direct_uploads.rb
@@ -35,9 +35,9 @@ class WithDirectUploads
##
# We need this so calls to rspec mocks (allow, expect etc.) will work here as expected.
- def method_missing(method, *args, &)
+ def method_missing(method, *, &)
if context.respond_to?(method)
- context.send(method, *args, &)
+ context.send(method, *, &)
else
super
end
diff --git a/spec/support/toasts/expectations.rb b/spec/support/toasts/expectations.rb
index 9eae3a9a901..ecadb2d9bf4 100644
--- a/spec/support/toasts/expectations.rb
+++ b/spec/support/toasts/expectations.rb
@@ -2,11 +2,11 @@ module Toasts
module Expectations
def expect_toast(message:, type: :success)
if toast_type == :angular
- expect(page).to have_selector(".op-toast.-#{type}", text: message, wait: 20)
+ expect(page).to have_css(".op-toast.-#{type}", text: message, wait: 20)
elsif type == :error
- expect(page).to have_selector(".errorExplanation", text: message)
+ expect(page).to have_css(".errorExplanation", text: message)
elsif type == :success
- expect(page).to have_selector(".op-toast.-success", text: message)
+ expect(page).to have_css(".op-toast.-success", text: message)
else
raise NotImplementedError
end
@@ -24,9 +24,9 @@ module Toasts
def expect_no_toaster(type: :success, message: nil)
if type.nil?
- expect(page).not_to have_selector(".op-toast")
+ expect(page).to have_no_css(".op-toast")
else
- expect(page).not_to have_selector(".op-toast.-#{type}", text: message)
+ expect(page).to have_no_css(".op-toast.-#{type}", text: message)
end
end
diff --git a/spec/support/wait/target.rb b/spec/support/wait/target.rb
index 3c034d568d3..fe44e962961 100644
--- a/spec/support/wait/target.rb
+++ b/spec/support/wait/target.rb
@@ -14,17 +14,17 @@ module RSpec
end
# From: https://github.com/rspec/rspec-expectations/blob/v3.12.3/lib/rspec/expectations/expectation_target.rb#L36-L47
- def self.for(value, block, **options)
+ def self.for(value, block, **)
if UndefinedValue.equal?(value)
unless block
raise ArgumentError, "You must pass either an argument or a block to `wait_for`."
end
- new(block, **options)
+ new(block, **)
elsif block
raise ArgumentError, "You cannot pass both an argument and a block to `wait_for`."
else
- new(value, **options)
+ new(value, **)
end
end
diff --git a/spec/support/webmock.rb b/spec/support/webmock.rb
index d0b04383160..f9f8dad897c 100644
--- a/spec/support/webmock.rb
+++ b/spec/support/webmock.rb
@@ -35,7 +35,7 @@ RSpec.configure do |config|
WebMock.disable!
end
- config.around(:example, webmock: true) do |example|
+ config.around(:example, :webmock) do |example|
# When we enable webmock, no connections other than stubbed ones are allowed.
# We will exempt:
# * local connections, since selenium etc. uses localhost to communicate with the browser.
diff --git a/spec/views/admin/settings/authentication/show.html.erb_spec.rb b/spec/views/admin/settings/authentication/show.html.erb_spec.rb
index e61555eeb75..5df4b871fd1 100644
--- a/spec/views/admin/settings/authentication/show.html.erb_spec.rb
+++ b/spec/views/admin/settings/authentication/show.html.erb_spec.rb
@@ -51,11 +51,11 @@ RSpec.describe 'admin/settings/authentication_settings/show' do
end
it 'does not show password settings' do
- expect(rendered).not_to have_text I18n.t('label_password_lost')
+ expect(rendered).to have_no_text I18n.t('label_password_lost')
end
it 'does not show automated user blocking options' do
- expect(rendered).not_to have_text I18n.t('settings.brute_force_prevention')
+ expect(rendered).to have_no_text I18n.t('settings.brute_force_prevention')
end
end
end
diff --git a/spec/views/layouts/admin.html.erb_spec.rb b/spec/views/layouts/admin.html.erb_spec.rb
index 01ef6c2b981..3253d581f8e 100644
--- a/spec/views/layouts/admin.html.erb_spec.rb
+++ b/spec/views/layouts/admin.html.erb_spec.rb
@@ -59,7 +59,7 @@ RSpec.describe 'layouts/admin' do
end
it 'is shown' do
- expect(rendered).to have_selector('a', text: I18n.t(:label_ldap_auth_source_plural))
+ expect(rendered).to have_css('a', text: I18n.t(:label_ldap_auth_source_plural))
end
end
@@ -70,7 +70,7 @@ RSpec.describe 'layouts/admin' do
end
it 'is hidden' do
- expect(rendered).not_to have_selector('a', text: I18n.t(:label_ldap_auth_source_plural))
+ expect(rendered).to have_no_css('a', text: I18n.t(:label_ldap_auth_source_plural))
end
end
end
diff --git a/spec/views/layouts/base.html.erb_spec.rb b/spec/views/layouts/base.html.erb_spec.rb
index b13be5ee0ad..179de56fabe 100644
--- a/spec/views/layouts/base.html.erb_spec.rb
+++ b/spec/views/layouts/base.html.erb_spec.rb
@@ -60,15 +60,15 @@ RSpec.describe 'layouts/base' do
context 'with omni_auth_direct_login disabled' do
it 'shows the login drop down menu' do
- expect(rendered).to have_selector('div#nav-login-content', visible: false)
+ expect(rendered).to have_css('div#nav-login-content', visible: false)
end
end
context 'with omni_auth_direct_login enabled',
with_config: { omniauth_direct_login_provider: 'some_provider' } do
it 'shows just a sign-in link, no menu' do
- expect(rendered).to have_selector "a[href='/login']"
- expect(rendered).not_to have_selector 'div#nav-login-content'
+ expect(rendered).to have_css "a[href='/login']"
+ expect(rendered).to have_no_css 'div#nav-login-content'
end
end
end
@@ -108,14 +108,14 @@ RSpec.describe 'layouts/base' do
end
it 'renders main favicon' do
- expect(rendered).to have_selector(
+ expect(rendered).to have_css(
"link[type='image/x-icon'][href*='#{OpenProject::CustomStyles::Design.favicon_asset_path}']",
visible: false
)
end
it 'renders apple icons' do
- expect(rendered).to have_selector(
+ expect(rendered).to have_css(
"link[type='image/png'][href*='/assets/apple-touch-icon-120x120.png']",
visible: false
)
@@ -146,7 +146,7 @@ RSpec.describe 'layouts/base' do
render
end
- it "will be referenced without the asset host" do
+ it "is referenced without the asset host" do
expect(rendered).to include('href="http://foo.bar.com/assets/')
expect(rendered).to include('href="/highlighting/styles/')
end
@@ -229,7 +229,7 @@ RSpec.describe 'layouts/base' do
let(:current_user) { user }
it 'has a current_user metatag' do
- expect(rendered).to have_selector("meta[name=current_user]", visible: false)
+ expect(rendered).to have_css("meta[name=current_user]", visible: false)
end
end
@@ -237,7 +237,7 @@ RSpec.describe 'layouts/base' do
let(:current_user) { anonymous }
it 'has no current_user metatag' do
- expect(rendered).not_to have_selector('meta[name=current_user]', visible: false)
+ expect(rendered).to have_no_css('meta[name=current_user]', visible: false)
end
end
end
diff --git a/spec/views/projects/settings/general/show.html.erb_spec.rb b/spec/views/projects/settings/general/show.html.erb_spec.rb
index b127afdd8f0..0d87d8d033b 100644
--- a/spec/views/projects/settings/general/show.html.erb_spec.rb
+++ b/spec/views/projects/settings/general/show.html.erb_spec.rb
@@ -44,7 +44,7 @@ RSpec.describe 'projects/settings/general/show' do
end
it 'the copy link should be visible' do
- expect(rendered).to have_selector 'a.copy'
+ expect(rendered).to have_css 'a.copy'
end
end
@@ -55,7 +55,7 @@ RSpec.describe 'projects/settings/general/show' do
end
it 'the copy link should not be visible' do
- expect(rendered).not_to have_selector 'a.copy'
+ expect(rendered).to have_no_css 'a.copy'
end
end
end
@@ -72,8 +72,8 @@ RSpec.describe 'projects/settings/general/show' do
end
it 'show delete and archive buttons' do
- expect(rendered).to have_selector('li.toolbar-item span.button--text', text: 'Archive')
- expect(rendered).to have_selector('li.toolbar-item span.button--text', text: 'Delete')
+ expect(rendered).to have_css('li.toolbar-item span.button--text', text: 'Archive')
+ expect(rendered).to have_css('li.toolbar-item span.button--text', text: 'Delete')
end
end
@@ -89,8 +89,8 @@ RSpec.describe 'projects/settings/general/show' do
end
it 'hide delete and archive buttons' do
- expect(rendered).not_to have_selector('li.toolbar-item span.button--text', text: 'Archive project')
- expect(rendered).not_to have_selector('li.toolbar-item span.button--text', text: 'Delete project')
+ expect(rendered).to have_no_css('li.toolbar-item span.button--text', text: 'Archive project')
+ expect(rendered).to have_no_css('li.toolbar-item span.button--text', text: 'Delete project')
end
end
end
diff --git a/spec/views/users/edit.html.erb_spec.rb b/spec/views/users/edit.html.erb_spec.rb
index 387a49634ce..9f24b17fd55 100644
--- a/spec/views/users/edit.html.erb_spec.rb
+++ b/spec/views/users/edit.html.erb_spec.rb
@@ -145,7 +145,7 @@ RSpec.describe 'users/edit' do
it 'does not show the auth source selection' do
render
- expect(rendered).not_to have_selector('#user_auth_source_id')
+ expect(rendered).to have_no_css('#user_auth_source_id')
end
end
end
@@ -171,7 +171,7 @@ RSpec.describe 'users/edit' do
it 'shows the auth source selection' do
render
- expect(rendered).to have_selector('#user_ldap_auth_source_id')
+ expect(rendered).to have_css('#user_ldap_auth_source_id')
end
end
@@ -201,8 +201,8 @@ RSpec.describe 'users/edit' do
render
within '#password_fields' do
- expect(rendered).not_to have_text('Password')
- expect(rendered).not_to have_text('Password confirmation')
+ expect(rendered).to have_no_text('Password')
+ expect(rendered).to have_no_text('Password confirmation')
end
end
end
diff --git a/spec/views/users/index.html.erb_spec.rb b/spec/views/users/index.html.erb_spec.rb
index 03535b80a4c..44216c12419 100644
--- a/spec/views/users/index.html.erb_spec.rb
+++ b/spec/views/users/index.html.erb_spec.rb
@@ -70,7 +70,7 @@ RSpec.describe 'users/index' do
it "does not show the current number of active and allowed users" do
render
- expect(subject).not_to have_text("booked active users")
+ expect(subject).to have_no_text("booked active users")
end
end
end
diff --git a/spec/views/users/show.html.erb_spec.rb b/spec/views/users/show.html.erb_spec.rb
index 99945fce2bd..b61a124c7c9 100644
--- a/spec/views/users/show.html.erb_spec.rb
+++ b/spec/views/users/show.html.erb_spec.rb
@@ -51,6 +51,6 @@ RSpec.describe 'users/show' do
it 'renders the visible custom values' do
render
- expect(rendered).to have_selector('li', text: 'TextUserCustomField')
+ expect(rendered).to have_css('li', text: 'TextUserCustomField')
end
end
diff --git a/spec/views/work_package/auto_complete/index_spec.rb b/spec/views/work_package/auto_complete/index_spec.rb
index 2d4e55aeb7b..aac2862f87e 100644
--- a/spec/views/work_package/auto_complete/index_spec.rb
+++ b/spec/views/work_package/auto_complete/index_spec.rb
@@ -38,9 +38,9 @@ RSpec.describe 'work_packages/auto_completes/index.html.erb' do
assign :work_packages, [work_package]
render
# there are items
- expect(rendered).to have_selector 'li'
+ expect(rendered).to have_css 'li'
# but there is not script tag
- expect(rendered).not_to have_selector 'script'
+ expect(rendered).to have_no_css 'script'
# normal text should be included
expect(rendered).to include 'do not alert this'
end
diff --git a/spec/workers/attachments/cleanup_uncontainered_job_integration_spec.rb b/spec/workers/attachments/cleanup_uncontainered_job_integration_spec.rb
index 8c3fb7a04e2..bc94bf8a6e4 100644
--- a/spec/workers/attachments/cleanup_uncontainered_job_integration_spec.rb
+++ b/spec/workers/attachments/cleanup_uncontainered_job_integration_spec.rb
@@ -61,6 +61,6 @@ RSpec.describe Attachments::CleanupUncontaineredJob, type: :job do
job.perform
expect(Attachment.all)
- .to match_array([containered_attachment, new_uncontainered_attachment, finished_upload, new_pending_upload])
+ .to contain_exactly(containered_attachment, new_uncontainered_attachment, finished_upload, new_pending_upload)
end
end
diff --git a/spec/workers/mails/shared/member_job.rb b/spec/workers/mails/shared/member_job.rb
index e32c1b8a9a8..fabc031015a 100644
--- a/spec/workers/mails/shared/member_job.rb
+++ b/spec/workers/mails/shared/member_job.rb
@@ -97,7 +97,7 @@ RSpec.shared_examples 'member job' do
%i[added_project updated_global updated_project].each do |mails|
allow(MemberMailer)
.to receive(mails)
- .and_return(double('mail', deliver_now: nil)) # rubocop:disable RSpec/VerifiedDoubles
+ .and_return(double('mail', deliver_now: nil)) # rubocop:disable RSpec/VerifiedDoubles
end
end
diff --git a/spec/workers/notifications/schedule_reminder_mails_job_spec.rb b/spec/workers/notifications/schedule_reminder_mails_job_spec.rb
index 957cfb36946..99538d4f7b8 100644
--- a/spec/workers/notifications/schedule_reminder_mails_job_spec.rb
+++ b/spec/workers/notifications/schedule_reminder_mails_job_spec.rb
@@ -73,10 +73,10 @@ RSpec.describe Notifications::ScheduleReminderMailsJob, type: :job do
reminder_jobs = jobs.select { |job| job.job_data['job_class'] == "Mails::ReminderJob" }
expect(reminder_jobs[0].job_data['arguments'])
- .to match_array([23])
+ .to contain_exactly(23)
expect(reminder_jobs[1].job_data['arguments'])
- .to match_array([42])
+ .to contain_exactly(42)
end
it 'queries with the intended job execution time (which might have been missed due to high load)' do