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

explicit kwargs in spec helpers

ulferts37a49106fe1f
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 01e5336b1cb..62dd2525c6d 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
@@ -34,7 +34,7 @@ describe 'custom field inplace editor', js: true do
wp_field.set_value value
wp_field.submit_by_enter if wp_field.field_type == 'input'
- wp_page.expect_toast(update_args)
+ wp_page.expect_toast(**update_args)
wp_page.dismiss_toaster!
end
diff --git a/spec/support/components/admin/type_configuration_form.rb b/spec/support/components/admin/type_configuration_form.rb
index 5dcfad166ab..b31a58b332a 100644
--- a/spec/support/components/admin/type_configuration_form.rb
+++ b/spec/support/components/admin/type_configuration_form.rb
@@ -219,7 +219,7 @@ module Components
within find_group(translation) do
attributes.each do |attribute|
- expect_attribute(attribute)
+ expect_attribute(**attribute)
end
end
end
diff --git a/spec/support/matchers/has_conditional_selector.rb b/spec/support/matchers/has_conditional_selector.rb
index 0f7550a4bb4..b5f487d48b9 100644
--- a/spec/support/matchers/has_conditional_selector.rb
+++ b/spec/support/matchers/has_conditional_selector.rb
@@ -33,11 +33,11 @@
module Capybara
class Session
- def has_conditional_selector?(condition, *args)
+ def has_conditional_selector?(condition, *args, **kw_args)
if condition
- has_selector? *args
+ has_selector? *args, **kw_args
else
- has_no_selector? *args
+ has_no_selector? *args, **kw_args
end
end
end
diff --git a/spec/support/matchers/raise_if_found.rb b/spec/support/matchers/raise_if_found.rb
index cc6a4e8fb4f..80f4a0912bd 100644
--- a/spec/support/matchers/raise_if_found.rb
+++ b/spec/support/matchers/raise_if_found.rb
@@ -32,20 +32,20 @@
module Capybara
class Session
- def raise_if_found(condition, *args)
- raise_if_has_selector?(:has_selector?, condition, *args)
+ def raise_if_found(condition, *args, **kw_args)
+ raise_if_has_selector?(:has_selector?, condition, *args, **kw_args)
end
- def raise_if_found_field(condition, *args)
- raise_if_has_selector?(:has_field?, condition, *args)
+ def raise_if_found_field(condition, *args, **kw_args)
+ raise_if_has_selector?(:has_field?, condition, *args, **kw_args)
end
- def raise_if_found_select(condition, *args)
- raise_if_has_selector?(:has_select?, condition, *args)
+ def raise_if_found_select(condition, *args, **kw_args)
+ raise_if_has_selector?(:has_select?, condition, *args, **kw_args)
end
- def raise_if_has_selector?(method, condition, *args)
- found = public_send(method, condition, *args)
+ def raise_if_has_selector?(method, condition, *args, **kw_args)
+ found = public_send(method, condition, *args, **kw_args)
raise "Expected not to find field #{condition}" if found
end
end
diff --git a/spec/support/pages/notifications/settings.rb b/spec/support/pages/notifications/settings.rb
index 68c31c328f5..93331667a76 100644
--- a/spec/support/pages/notifications/settings.rb
+++ b/spec/support/pages/notifications/settings.rb
@@ -77,8 +77,8 @@ module Pages
expect_project project
end
- def configure_global(**types)
- types.each(&method(:set_global_option))
+ def configure_global(notification_types)
+ notification_types.each { |type, checked| set_global_option(type, checked) }
end
def set_global_option(type, checked)
diff --git a/spec/support/pages/work_packages/abstract_work_package.rb b/spec/support/pages/work_packages/abstract_work_package.rb
index 80a1fb3e16d..c27d1c50fc8 100644
--- a/spec/support/pages/work_packages/abstract_work_package.rb
+++ b/spec/support/pages/work_packages/abstract_work_package.rb
@@ -174,7 +174,7 @@ module Pages
end
end
- def update_attributes(key_value_map, save: true)
+ def update_attributes(save: true, **key_value_map)
set_attributes(key_value_map, save: save)
end
diff --git a/spec/support/pages/work_packages/full_work_package.rb b/spec/support/pages/work_packages/full_work_package.rb
index 6575746956d..45176d6e734 100644
--- a/spec/support/pages/work_packages/full_work_package.rb
+++ b/spec/support/pages/work_packages/full_work_package.rb
@@ -45,7 +45,7 @@ module Pages
end
def create_page(args)
- Pages::FullWorkPackageCreate.new(args)
+ Pages::FullWorkPackageCreate.new(**args)
end
end
end
diff --git a/spec/support/pages/work_packages/split_work_package.rb b/spec/support/pages/work_packages/split_work_package.rb
index 6daa491747e..65c3258f5ba 100644
--- a/spec/support/pages/work_packages/split_work_package.rb
+++ b/spec/support/pages/work_packages/split_work_package.rb
@@ -74,7 +74,7 @@ module Pages
def create_page(args)
args.merge!(project: project || work_package.project)
- SplitWorkPackageCreate.new(args)
+ SplitWorkPackageCreate.new(**args)
end
end
end
diff --git a/spec/support/shared/with_config.rb b/spec/support/shared/with_config.rb
index 7b7fbbdf2b0..45408c51725 100644
--- a/spec/support/shared/with_config.rb
+++ b/spec/support/shared/with_config.rb
@@ -54,7 +54,7 @@ class WithConfig
aggregate_mocked_configuration(example, config)
.with_indifferent_access
- .each(&method(:stub_key))
+ .each { |k, v| stub_key(k, v) }
end
def stub_key(key, value)