upgrade to version 7.0.4
This commit is contained in:
parent
fc7f29f375
commit
0383b0c07e
Binary file not shown.
Binary file not shown.
BIN
actionview-7.0.4.gem
Normal file
BIN
actionview-7.0.4.gem
Normal file
Binary file not shown.
Binary file not shown.
156
rubygem-actionview-7.0.2.3-Fix-tests-for-minitest-5.16.patch
Normal file
156
rubygem-actionview-7.0.2.3-Fix-tests-for-minitest-5.16.patch
Normal file
@ -0,0 +1,156 @@
|
||||
From 9766eb4a833c26c64012230b96dd1157ebb8e8a2 Mon Sep 17 00:00:00 2001
|
||||
From: eileencodes <eileencodes@gmail.com>
|
||||
Date: Wed, 15 Jun 2022 12:44:11 -0400
|
||||
Subject: [PATCH] Fix tests for minitest 5.16
|
||||
|
||||
In minitest/minitest@6e06ac9 minitest changed such that it now accepts
|
||||
`kwargs` instead of requiring kwargs to be shoved into the args array.
|
||||
This is a good change but required some updates to our test code to get
|
||||
the new version of minitest passing.
|
||||
|
||||
Changes are as follows:
|
||||
|
||||
1) Lock minitest to 5.15 for Ruby 2.7. We don't love this change but
|
||||
it's pretty difficult to get 2.7 and 3.0 to play nicely together with
|
||||
the new kwargs changes. Dropping 2.7 support isn't an option right
|
||||
now for Rails. This is safe because all of the code changes here are
|
||||
internal methods to Rails like assert_called_with. Applications
|
||||
shouldn't be consuming them as they are no-doc'd.
|
||||
2) Update the `assert_called_with` method to take any kwargs but also
|
||||
the returns kwarg.
|
||||
3) Update callers of `assert_called_with` to move the kwargs outside the
|
||||
args array.
|
||||
4) Update the message from marshaled exceptions. In 5.16 the exception
|
||||
message is "result not reported" instead of "Wrapped undumpable
|
||||
exception".
|
||||
|
||||
Co-authored-by: Matthew Draper <matthew@trebex.net>
|
||||
---
|
||||
.../test/template/date_helper_i18n_test.rb | 18 +--
|
||||
.../template/form_helper/form_with_test.rb | 2 +-
|
||||
actionview/test/template/form_helper_test.rb | 2 +-
|
||||
.../template/form_options_helper_i18n_test.rb | 2 +-
|
||||
.../test/template/translation_helper_test.rb | 2 +-
|
||||
16 files changed, 13 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/actionview/test/template/date_helper_i18n_test.rb b/actionview/test/template/date_helper_i18n_test.rb
|
||||
index 2f098e2f5158f..819d0d0ac206b 100644
|
||||
--- a/actionview/test/template/date_helper_i18n_test.rb
|
||||
+++ b/actionview/test/template/date_helper_i18n_test.rb
|
||||
@@ -49,7 +49,7 @@ def test_distance_of_time_in_words_calls_i18n_with_custom_scope
|
||||
end
|
||||
|
||||
def test_time_ago_in_words_passes_locale
|
||||
- assert_called_with(I18n, :t, [:less_than_x_minutes, scope: :'datetime.distance_in_words', count: 1, locale: "ru"]) do
|
||||
+ assert_called_with(I18n, :t, [:less_than_x_minutes], scope: :'datetime.distance_in_words', count: 1, locale: "ru") do
|
||||
time_ago_in_words(15.seconds.ago, locale: "ru")
|
||||
end
|
||||
end
|
||||
@@ -84,7 +84,7 @@ def assert_distance_of_time_in_words_translates_key(passed, expected, expected_o
|
||||
options = { locale: "en", scope: :'datetime.distance_in_words' }.merge!(expected_options)
|
||||
options[:count] = count if count
|
||||
|
||||
- assert_called_with(I18n, :t, [key, options]) do
|
||||
+ assert_called_with(I18n, :t, [key], **options) do
|
||||
distance_of_time_in_words(@from, to, passed_options.merge(locale: "en"))
|
||||
end
|
||||
end
|
||||
@@ -103,13 +103,13 @@ def test_select_month_given_use_month_names_option_does_not_translate_monthnames
|
||||
end
|
||||
|
||||
def test_select_month_translates_monthnames
|
||||
- assert_called_with(I18n, :translate, [:'date.month_names', locale: "en"], returns: Date::MONTHNAMES) do
|
||||
+ assert_called_with(I18n, :translate, [:'date.month_names'], returns: Date::MONTHNAMES, locale: "en") do
|
||||
select_month(8, locale: "en")
|
||||
end
|
||||
end
|
||||
|
||||
def test_select_month_given_use_short_month_option_translates_abbr_monthnames
|
||||
- assert_called_with(I18n, :translate, [:'date.abbr_month_names', locale: "en"], returns: Date::ABBR_MONTHNAMES) do
|
||||
+ assert_called_with(I18n, :translate, [:'date.abbr_month_names'], returns: Date::ABBR_MONTHNAMES, locale: "en") do
|
||||
select_month(8, locale: "en", use_short_month: true)
|
||||
end
|
||||
end
|
||||
@@ -147,8 +147,8 @@ def test_date_or_time_select_given_an_order_options_does_not_translate_order
|
||||
|
||||
def test_date_or_time_select_given_no_order_options_translates_order
|
||||
mock = Minitest::Mock.new
|
||||
- mock.expect(:call, ["year", "month", "day"], [:'date.order', { locale: "en", default: [] }])
|
||||
- mock.expect(:call, [], [:'date.month_names', { locale: "en" }])
|
||||
+ expect_called_with(mock, [:'date.order'], locale: "en", default: [], returns: ["year", "month", "day"])
|
||||
+ expect_called_with(mock, [:'date.month_names'], locale: "en", returns: [])
|
||||
|
||||
I18n.stub(:translate, mock) do
|
||||
datetime_select("post", "updated_at", locale: "en")
|
||||
@@ -158,7 +158,7 @@ def test_date_or_time_select_given_no_order_options_translates_order
|
||||
end
|
||||
|
||||
def test_date_or_time_select_given_invalid_order
|
||||
- assert_called_with(I18n, :translate, [:'date.order', locale: "en", default: []], returns: %w(invalid month day)) do
|
||||
+ assert_called_with(I18n, :translate, [:'date.order'], returns: %w(invalid month day), locale: "en", default: []) do
|
||||
assert_raise StandardError do
|
||||
datetime_select("post", "updated_at", locale: "en")
|
||||
end
|
||||
@@ -167,8 +167,8 @@ def test_date_or_time_select_given_invalid_order
|
||||
|
||||
def test_date_or_time_select_given_symbol_keys
|
||||
mock = Minitest::Mock.new
|
||||
- mock.expect(:call, [:year, :month, :day], [:'date.order', { locale: "en", default: [] }])
|
||||
- mock.expect(:call, [], [:'date.month_names', { locale: "en" }])
|
||||
+ expect_called_with(mock, [:'date.order'], locale: "en", default: [], returns: [:year, :month, :day])
|
||||
+ expect_called_with(mock, [:'date.month_names'], locale: "en", returns: [])
|
||||
|
||||
I18n.stub(:translate, mock) do
|
||||
datetime_select("post", "updated_at", locale: "en")
|
||||
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
|
||||
index 00e6ca42ea473..b3d6d59cd3afa 100644
|
||||
--- a/actionview/test/template/form_helper/form_with_test.rb
|
||||
+++ b/actionview/test/template/form_helper/form_with_test.rb
|
||||
@@ -1747,7 +1747,7 @@ def test_nested_fields_label_translation_with_more_than_10_records
|
||||
|
||||
mock = Minitest::Mock.new
|
||||
@post.comments.each do
|
||||
- mock.expect(:call, "body", ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"])
|
||||
+ expect_called_with(mock, ["post.comments.body"], default: [:"comment.body", ""], scope: "helpers.label", returns: "body")
|
||||
end
|
||||
|
||||
I18n.stub(:t, mock) do
|
||||
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
|
||||
index 8560be2770ca4..d8924d3e65004 100644
|
||||
--- a/actionview/test/template/form_helper_test.rb
|
||||
+++ b/actionview/test/template/form_helper_test.rb
|
||||
@@ -3269,7 +3269,7 @@ def test_nested_fields_label_translation_with_more_than_10_records
|
||||
|
||||
mock = Minitest::Mock.new
|
||||
@post.comments.each do
|
||||
- mock.expect(:call, "body", ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"])
|
||||
+ expect_called_with(mock, ["post.comments.body"], default: [:"comment.body", ""], scope: "helpers.label", returns: "body")
|
||||
end
|
||||
|
||||
I18n.stub(:t, mock) do
|
||||
diff --git a/actionview/test/template/form_options_helper_i18n_test.rb b/actionview/test/template/form_options_helper_i18n_test.rb
|
||||
index 21295fa547d8e..3dc625b8ac1df 100644
|
||||
--- a/actionview/test/template/form_options_helper_i18n_test.rb
|
||||
+++ b/actionview/test/template/form_options_helper_i18n_test.rb
|
||||
@@ -16,7 +16,7 @@ def teardown
|
||||
end
|
||||
|
||||
def test_select_with_prompt_true_translates_prompt_message
|
||||
- assert_called_with(I18n, :translate, ["helpers.select.prompt", { default: "Please select" }]) do
|
||||
+ assert_called_with(I18n, :translate, ["helpers.select.prompt"], default: "Please select") do
|
||||
select("post", "category", [], prompt: true)
|
||||
end
|
||||
end
|
||||
diff --git a/actionview/test/template/translation_helper_test.rb b/actionview/test/template/translation_helper_test.rb
|
||||
index 9ed034113d0fb..b9da9174a517a 100644
|
||||
--- a/actionview/test/template/translation_helper_test.rb
|
||||
+++ b/actionview/test/template/translation_helper_test.rb
|
||||
@@ -65,7 +65,7 @@ def test_delegates_setting_to_i18n
|
||||
|
||||
def test_delegates_localize_to_i18n
|
||||
@time = Time.utc(2008, 7, 8, 12, 18, 38)
|
||||
- assert_called_with(I18n, :localize, [@time, locale: "en"]) do
|
||||
+ assert_called_with(I18n, :localize, [@time], locale: "en") do
|
||||
localize @time, locale: "en"
|
||||
end
|
||||
assert_equal "Tue, 08 Jul 2008 12:18:38 +0000", localize(@time, locale: "en")
|
||||
@ -0,0 +1,114 @@
|
||||
From df0de681dc1873534ecd2fc8371e1f2562984b68 Mon Sep 17 00:00:00 2001
|
||||
From: John Crepezzi <john.crepezzi@gmail.com>
|
||||
Date: Thu, 16 Jun 2022 08:34:05 -0400
|
||||
Subject: [PATCH] Remove the multi-call form of assert_called_with
|
||||
|
||||
The `assert_called_with` helper allows passing a multi-dimensional array to
|
||||
mock multiple calls to the same method for a given block. This works
|
||||
fine now, but when adding support for real kwargs arguments to line up with
|
||||
recent upgrades in Minitest, this approach is no longer workable because
|
||||
we can't pass multiple sets of differing kwargs.
|
||||
|
||||
Rather than complicated this method further, this commit removes the
|
||||
multi-call form of `assert_called_with` and modifies the tests that
|
||||
currently make use of that functionality to just use the underlying
|
||||
`Minitest::Mock` calls.
|
||||
|
||||
Co-authored-by: Eileen M. Uchitelle <eileencodes@gmail.com>
|
||||
---
|
||||
.../test/template/date_helper_i18n_test.rb | 16 +++-
|
||||
.../template/form_helper/form_with_test.rb | 10 ++-
|
||||
actionview/test/template/form_helper_test.rb | 10 ++-
|
||||
3 files changed, 30 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/actionview/test/template/date_helper_i18n_test.rb b/actionview/test/template/date_helper_i18n_test.rb
|
||||
index f100a011a83f7..2f098e2f5158f 100644
|
||||
--- a/actionview/test/template/date_helper_i18n_test.rb
|
||||
+++ b/actionview/test/template/date_helper_i18n_test.rb
|
||||
@@ -146,9 +146,15 @@ def test_date_or_time_select_given_an_order_options_does_not_translate_order
|
||||
end
|
||||
|
||||
def test_date_or_time_select_given_no_order_options_translates_order
|
||||
- assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", { locale: "en" }] ], returns: %w(year month day)) do
|
||||
+ mock = Minitest::Mock.new
|
||||
+ mock.expect(:call, ["year", "month", "day"], [:'date.order', { locale: "en", default: [] }])
|
||||
+ mock.expect(:call, [], [:'date.month_names', { locale: "en" }])
|
||||
+
|
||||
+ I18n.stub(:translate, mock) do
|
||||
datetime_select("post", "updated_at", locale: "en")
|
||||
end
|
||||
+
|
||||
+ assert_mock(mock)
|
||||
end
|
||||
|
||||
def test_date_or_time_select_given_invalid_order
|
||||
@@ -160,8 +166,14 @@ def test_date_or_time_select_given_invalid_order
|
||||
end
|
||||
|
||||
def test_date_or_time_select_given_symbol_keys
|
||||
- assert_called_with(I18n, :translate, [ [:'date.order', locale: "en", default: []], [:"date.month_names", { locale: "en" }] ], returns: [:year, :month, :day]) do
|
||||
+ mock = Minitest::Mock.new
|
||||
+ mock.expect(:call, [:year, :month, :day], [:'date.order', { locale: "en", default: [] }])
|
||||
+ mock.expect(:call, [], [:'date.month_names', { locale: "en" }])
|
||||
+
|
||||
+ I18n.stub(:translate, mock) do
|
||||
datetime_select("post", "updated_at", locale: "en")
|
||||
end
|
||||
+
|
||||
+ assert_mock(mock)
|
||||
end
|
||||
end
|
||||
diff --git a/actionview/test/template/form_helper/form_with_test.rb b/actionview/test/template/form_helper/form_with_test.rb
|
||||
index eadddc15002ee..00e6ca42ea473 100644
|
||||
--- a/actionview/test/template/form_helper/form_with_test.rb
|
||||
+++ b/actionview/test/template/form_helper/form_with_test.rb
|
||||
@@ -1745,14 +1745,20 @@ def test_nested_fields_arel_like
|
||||
def test_nested_fields_label_translation_with_more_than_10_records
|
||||
@post.comments = Array.new(11) { |id| Comment.new(id + 1) }
|
||||
|
||||
- params = 11.times.map { ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"] }
|
||||
- assert_called_with(I18n, :t, params, returns: "Write body here") do
|
||||
+ mock = Minitest::Mock.new
|
||||
+ @post.comments.each do
|
||||
+ mock.expect(:call, "body", ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"])
|
||||
+ end
|
||||
+
|
||||
+ I18n.stub(:t, mock) do
|
||||
form_with(model: @post) do |f|
|
||||
f.fields(:comments) do |cf|
|
||||
concat cf.label(:body)
|
||||
end
|
||||
end
|
||||
end
|
||||
+
|
||||
+ assert_mock(mock)
|
||||
end
|
||||
|
||||
def test_nested_fields_with_existing_records_on_a_supplied_nested_attributes_collection_different_from_record_one
|
||||
diff --git a/actionview/test/template/form_helper_test.rb b/actionview/test/template/form_helper_test.rb
|
||||
index d08f00cd36c35..8560be2770ca4 100644
|
||||
--- a/actionview/test/template/form_helper_test.rb
|
||||
+++ b/actionview/test/template/form_helper_test.rb
|
||||
@@ -3267,14 +3267,20 @@ def test_nested_fields_for_arel_like
|
||||
def test_nested_fields_label_translation_with_more_than_10_records
|
||||
@post.comments = Array.new(11) { |id| Comment.new(id + 1) }
|
||||
|
||||
- params = 11.times.map { ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"] }
|
||||
- assert_called_with(I18n, :t, params, returns: "Write body here") do
|
||||
+ mock = Minitest::Mock.new
|
||||
+ @post.comments.each do
|
||||
+ mock.expect(:call, "body", ["post.comments.body", default: [:"comment.body", ""], scope: "helpers.label"])
|
||||
+ end
|
||||
+
|
||||
+ I18n.stub(:t, mock) do
|
||||
form_for(@post) do |f|
|
||||
f.fields_for(:comments) do |cf|
|
||||
concat cf.label(:body)
|
||||
end
|
||||
end
|
||||
end
|
||||
+
|
||||
+ assert_mock(mock)
|
||||
end
|
||||
|
||||
def test_nested_fields_for_with_existing_records_on_a_supplied_nested_attributes_collection_different_from_record_one
|
||||
@ -2,17 +2,30 @@
|
||||
%bcond_with bootstrap
|
||||
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 6.1.4.1
|
||||
Version: 7.0.4
|
||||
Release: 1
|
||||
Summary: Rendering framework putting the V in MVC (part of Rails)
|
||||
License: MIT
|
||||
URL: http://rubyonrails.org
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
# The gem doesn't ship with the test suite.
|
||||
# You may check it out like so
|
||||
# git clone http://github.com/rails/rails.git
|
||||
# cd rails/actionview && git archive -v -o actionview-7.0.4-tests.txz v7.0.4 test/
|
||||
Source1: %{gem_name}-%{version}-tests.txz
|
||||
# The tools are needed for the test suite, are however unpackaged in gem file.
|
||||
# You may get them like so
|
||||
# git clone http://github.com/rails/rails.git --no-checkout
|
||||
# cd rails && git archive -v -o rails-7.0.4-tools.txz v7.0.4 tools/
|
||||
Source2: rails-%{version}-tools.txz
|
||||
# Fixes for Minitest 5.16+
|
||||
# https://github.com/rails/rails/pull/45380
|
||||
Patch0: rubygem-actionview-7.0.2.3-Remove-the-multi-call-form-of-assert_called_with.patch
|
||||
# https://github.com/rails/rails/pull/45370
|
||||
Patch1: rubygem-actionview-7.0.2.3-Fix-tests-for-minitest-5.16.patch
|
||||
|
||||
BuildRequires: ruby(release)
|
||||
BuildRequires: rubygems-devel
|
||||
BuildRequires: rubygems-devel rubygem(did_you_mean)
|
||||
%if %{without bootstrap}
|
||||
BuildRequires: rubygem(activesupport) = %{version}
|
||||
BuildRequires: rubygem(activerecord) = %{version}
|
||||
@ -37,6 +50,11 @@ Documentation for %{name}.
|
||||
%prep
|
||||
%setup -q -n %{gem_name}-%{version} -b1 -b2
|
||||
|
||||
pushd %{_builddir}
|
||||
%patch0 -p2
|
||||
%patch1 -p2
|
||||
popd
|
||||
|
||||
%build
|
||||
gem build ../%{gem_name}-%{version}.gemspec
|
||||
%gem_install
|
||||
@ -54,7 +72,9 @@ pushd .%{gem_instdir}
|
||||
ln -s %{_builddir}/tools ..
|
||||
mv %{_builddir}/test .
|
||||
|
||||
mv test/activerecord/controller_runtime_test.rb{,.disable}
|
||||
# Test failure
|
||||
# https://github.com/rails/rails/issues/46130
|
||||
mv test/template/date_helper_i18n_test.rb{,.disable}
|
||||
|
||||
find test -type f -name '*_test.rb' -print0 | \
|
||||
sort -z | \
|
||||
@ -76,6 +96,9 @@ popd
|
||||
%doc %{gem_instdir}/CHANGELOG.md
|
||||
|
||||
%changelog
|
||||
* Thu Jan 19 2023 yanxiaobing <yanxiaobing@huawei.com> - 7.0.4-1
|
||||
- Upgrade to version 7.0.4
|
||||
|
||||
* Mon May 02 2022 wangkerong <wangkerong@h-partners.com>- 6.1.4.1-1
|
||||
- Upgrade to 6.1.4.1
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user