diff options
author | Go MAEDA <maeda@farend.jp> | 2024-08-21 00:46:15 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2024-08-21 00:46:15 +0000 |
commit | 93645a279e68b5f23d13c340d96ede3f65aff635 (patch) | |
tree | 99c47c51197d9b285fe4b05d073fd55208df54e5 /test | |
parent | c069ea3a2440f4cb0641abd4e3ddb6be5bd6bdb2 (diff) | |
download | redmine-93645a279e68b5f23d13c340d96ede3f65aff635.tar.gz redmine-93645a279e68b5f23d13c340d96ede3f65aff635.zip |
Use anonymous block forwarding introduced in Ruby 3.1 (#38585).
git-svn-id: https://svn.redmine.org/redmine/trunk@22973 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/repositories_git_controller_test.rb | 2 | ||||
-rw-r--r-- | test/object_helpers.rb | 12 | ||||
-rw-r--r-- | test/test_helper.rb | 12 | ||||
-rw-r--r-- | test/unit/issue_nested_set_concurrency_test.rb | 2 | ||||
-rw-r--r-- | test/unit/lib/redmine/views/builders/json_test.rb | 2 | ||||
-rw-r--r-- | test/unit/lib/redmine/views/builders/xml_test.rb | 2 | ||||
-rw-r--r-- | test/unit/mailer_localisation_test.rb | 2 |
7 files changed, 17 insertions, 17 deletions
diff --git a/test/functional/repositories_git_controller_test.rb b/test/functional/repositories_git_controller_test.rb index 7ac853594..9fecaf8a0 100644 --- a/test/functional/repositories_git_controller_test.rb +++ b/test/functional/repositories_git_controller_test.rb @@ -822,7 +822,7 @@ class RepositoriesGitControllerTest < Redmine::RepositoryControllerTest private - def with_cache(&block) + def with_cache(&) before = ActionController::Base.perform_caching ActionController::Base.perform_caching = true yield diff --git a/test/object_helpers.rb b/test/object_helpers.rb index 49596fec6..b334f77a2 100644 --- a/test/object_helpers.rb +++ b/test/object_helpers.rb @@ -72,8 +72,8 @@ module ObjectHelpers tracker end - def Tracker.generate!(attributes={}, &block) - tracker = Tracker.generate(attributes, &block) + def Tracker.generate!(attributes={}, &) + tracker = Tracker.generate(attributes, &) tracker.save! tracker end @@ -102,8 +102,8 @@ module ObjectHelpers # Generates a saved Issue # Doesn't send notifications by default, use :notify => true to send them - def Issue.generate!(attributes={}, &block) - issue = Issue.generate(attributes, &block) + def Issue.generate!(attributes={}, &) + issue = Issue.generate(attributes, &) issue.save! issue.reload end @@ -155,8 +155,8 @@ module ObjectHelpers entry end - def TimeEntry.generate!(attributes={}, &block) - entry = TimeEntry.generate(attributes, &block) + def TimeEntry.generate!(attributes={}, &) + entry = TimeEntry.generate(attributes, &) entry.save! entry end diff --git a/test/test_helper.rb b/test/test_helper.rb index 975b5f883..ca4b3fe47 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -87,7 +87,7 @@ class ActiveSupport::TestCase Attachment.storage_path = "#{Rails.root}/test/fixtures/files" end - def with_settings(options, &block) + def with_settings(options, &) saved_settings = options.keys.inject({}) do |h, k| h[k] = case Setting[k] @@ -105,7 +105,7 @@ class ActiveSupport::TestCase end # Yields the block with user as the current user - def with_current_user(user, &block) + def with_current_user(user, &) saved_user = User.current User.current = user yield @@ -113,7 +113,7 @@ class ActiveSupport::TestCase User.current = saved_user end - def with_locale(locale, &block) + def with_locale(locale, &) saved_localed = ::I18n.locale ::I18n.locale = locale yield @@ -219,13 +219,13 @@ class ActiveSupport::TestCase # Asserts that a new record for the given class is created # and returns it - def new_record(klass, &block) - new_records(klass, 1, &block).first + def new_record(klass, &) + new_records(klass, 1, &).first end # Asserts that count new records for the given class are created # and returns them as an array order by object id - def new_records(klass, count, &block) + def new_records(klass, count, &) assert_difference "#{klass}.count", count do yield end diff --git a/test/unit/issue_nested_set_concurrency_test.rb b/test/unit/issue_nested_set_concurrency_test.rb index 3d5bde047..87443c548 100644 --- a/test/unit/issue_nested_set_concurrency_test.rb +++ b/test/unit/issue_nested_set_concurrency_test.rb @@ -124,7 +124,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase private - def threaded(count, &block) + def threaded(count, &) with_settings :notified_events => [] do threads = [] count.times do |i| diff --git a/test/unit/lib/redmine/views/builders/json_test.rb b/test/unit/lib/redmine/views/builders/json_test.rb index 7622a4c19..afd772782 100644 --- a/test/unit/lib/redmine/views/builders/json_test.rb +++ b/test/unit/lib/redmine/views/builders/json_test.rb @@ -124,7 +124,7 @@ class Redmine::Views::Builders::JsonTest < ActiveSupport::TestCase end end - def assert_json_output(expected, &block) + def assert_json_output(expected, &) builder = Redmine::Views::Builders::Json.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create) yield(builder) assert_equal(expected, ActiveSupport::JSON.decode(builder.output)) diff --git a/test/unit/lib/redmine/views/builders/xml_test.rb b/test/unit/lib/redmine/views/builders/xml_test.rb index 42ff882d7..22aee3635 100644 --- a/test/unit/lib/redmine/views/builders/xml_test.rb +++ b/test/unit/lib/redmine/views/builders/xml_test.rb @@ -60,7 +60,7 @@ class Redmine::Views::Builders::XmlTest < ActiveSupport::TestCase end end - def assert_xml_output(expected, &block) + def assert_xml_output(expected, &) builder = Redmine::Views::Builders::Xml.new(ActionDispatch::TestRequest.create, ActionDispatch::TestResponse.create) yield(builder) assert_equal('<?xml version="1.0" encoding="UTF-8"?>' + expected, builder.output) diff --git a/test/unit/mailer_localisation_test.rb b/test/unit/mailer_localisation_test.rb index c125e515d..a19644a15 100644 --- a/test/unit/mailer_localisation_test.rb +++ b/test/unit/mailer_localisation_test.rb @@ -131,7 +131,7 @@ class MailerLocalisationTest < ActiveSupport::TestCase private - def with_each_user_language(&block) + def with_each_user_language(&) user = User.find(2) valid_languages.each do |lang| user.update_attribute :language, lang |