Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
6751d9c6de
!20 Upgrade to version 7.0.7
From: @wu-leilei 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2023-08-18 08:59:09 +00:00
wu-leilei
3db0d154a7 code 2023-08-18 11:46:49 +08:00
openeuler-ci-bot
0957f95ae9
!19 upgrade to version 7.0.4
From: @yanxiaobing2020 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2023-01-20 02:59:25 +00:00
yanxiaobing2020
0383b0c07e upgrade to version 7.0.4 2023-01-19 16:20:52 +08:00
openeuler-ci-bot
fc7f29f375
!15 【轻量级 PR】:fix bogus date
From: @zhangshaoning_uniontech 
Reviewed-by: @shinwell_hu 
Signed-off-by: @shinwell_hu
2022-06-20 01:55:11 +00:00
zhangshaoning
695ffe2474
fix bogus date 2022-06-17 06:19:45 +00:00
openeuler-ci-bot
9ff90547bc
!13 update changelog date
From: @tanyulong2021 
Reviewed-by: @jxy_git 
Signed-off-by: @jxy_git
2022-06-08 08:36:44 +00:00
tanyulong2021
744699b707 update changelog date 2022-06-08 14:36:23 +08:00
openeuler-ci-bot
c40925a5e9
!12 [sync] PR-10: Upgrade to 6.1.4.1
From: @openeuler-sync-bot 
Reviewed-by: @small_leek 
Signed-off-by: @small_leek
2022-03-31 01:31:23 +00:00
wangkerong
76a5b8b515 Upgrade to 6.1.4.1
(cherry picked from commit 0969189a63b90c74e360ddb7e6306aadbdac7f78)
2022-03-04 18:17:24 +08:00
10 changed files with 385 additions and 56 deletions

View File

@ -0,0 +1,40 @@
From 770060d93a897cb5fb5108bb828b927fe6bb5353 Mon Sep 17 00:00:00 2001
From: Jean Boussier <jean.boussier@gmail.com>
Date: Mon, 14 Aug 2023 11:20:43 +0200
Subject: [PATCH] Handle non-string partial body in
ActionView::CollectionCaching
Followup: https://github.com/rails/rails/pull/48645
Some template engines such as `jbuilder` use these Action View primitives
with types other than strings, which breaks a bunch of assumptions.
I wish I could add a test for this, but this is deep in private methods
I don't see a way to cover this.
---
.../renderer/partial_renderer/collection_caching.rb | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
index d65d4c0cafaba..6ee720aa4896b 100644
--- a/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
+++ b/actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
@@ -96,9 +96,16 @@ def fetch_or_cache_partial(cached_partials, template, order_by:)
build_rendered_template(content, template)
else
rendered_partial = yield
- if fragment = rendered_partial.body&.to_str
- entries_to_write[cache_key] = fragment
+ body = rendered_partial.body
+
+ # We want to cache buffers as raw strings. This both improve performance and
+ # avoid creating forward compatibility issues with the internal representation
+ # of these two types.
+ if body.is_a?(ActionView::OutputBuffer) || body.is_a?(ActiveSupport::SafeBuffer)
+ body = body.to_str
end
+
+ entries_to_write[cache_key] = body
rendered_partial
end
end

Binary file not shown.

BIN
actionview-7.0.7-tests.txz Normal file

Binary file not shown.

BIN
actionview-7.0.7.gem Normal file

Binary file not shown.

BIN
rails-7.0.7-tools.txz Normal file

Binary file not shown.

View File

@ -1,23 +0,0 @@
From 5bbce6fccc541b9941628cda4eda1f84c5a909ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Thu, 27 Apr 2017 15:18:56 +0200
Subject: [PATCH] Prevent negative IDs in output of #inspect.
https://bugs.ruby-lang.org/issues/13397
---
actionview/lib/action_view/template/resolver.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/actionview/lib/action_view/template/resolver.rb b/actionview/lib/action_view/template/resolver.rb
index d3905b5f23d5..7fdf04009a27 100644
--- a/actionview/lib/action_view/template/resolver.rb
+++ b/actionview/lib/action_view/template/resolver.rb
@@ -56,7 +56,7 @@ def initialize
end
def inspect
- "#<#{self.class.name}:0x#{(object_id << 1).to_s(16)} keys=#{@data.size} queries=#{@query_cache.size}>"
+ "#{to_s[0..-2]} keys=#{@data.size} queries=#{@query_cache.size}>"
end
# Cache the templates returned by the block

View 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")

View File

@ -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

View File

@ -1,55 +1,88 @@
%global gem_name actionview %global gem_name actionview
%{?_with_bootstrap: %global bootstrap 1} %bcond_with bootstrap
%global bootstrap 1
Name: rubygem-%{gem_name} Name: rubygem-%{gem_name}
Version: 5.2.4.4 Version: 7.0.7
Release: 2 Release: 1
Summary: Rendering framework putting the V in MVC (part of Rails) Summary: Rendering framework putting the V in MVC (part of Rails)
License: MIT License: MIT
URL: http://rubyonrails.org URL: http://rubyonrails.org
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
Source1: https://github.com/rails/rails/archive/v5.2.4.4.tar.gz # The gem doesn't ship with the test suite.
Patch0: rubygem-actionview-5.1.2-Prevent-negative-IDs-in-output-of-inspect.patch # You may check it out like so
BuildRequires: ruby(release) rubygems-devel # git clone http://github.com/rails/rails.git
%if ! 0%{?bootstrap} # cd rails/actionview && git archive -v -o actionview-7.0.7-tests.txz v7.0.7 test/
BuildRequires: rubygem(activesupport) = %{version} rubygem(activerecord) = %{version} Source1: %{gem_name}-%{version}-tests.txz
BuildRequires: rubygem(actionpack) = %{version} rubygem(railties) = %{version} # 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.7-tools.txz v7.0.7 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
# https://github.com/rails/rails/commit/770060d93a897cb5fb5108bb828b927fe6bb5353
Patch2: Handle-non-string-partial-body-in-ActionView-Collect.patch
BuildRequires: ruby(release)
BuildRequires: rubygems-devel rubygem(did_you_mean)
%if %{without bootstrap}
BuildRequires: rubygem(activesupport) = %{version}
BuildRequires: rubygem(activerecord) = %{version}
BuildRequires: rubygem(actionpack) = %{version}
BuildRequires: rubygem(railties) = %{version}
BuildRequires: rubygem(sqlite3) BuildRequires: rubygem(sqlite3)
%endif %endif
BuildArch: noarch BuildArch: noarch
%description %description
Simple, battle-tested conventions and helpers for building web pages. Simple, battle-tested conventions and helpers for building web pages.
%package doc %package doc
Summary: Documentation for %{name} Summary: Documentation for %{name}
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
BuildArch: noarch BuildArch: noarch
%description doc %description doc
Documentation for %{name}. Documentation for %{name}.
%prep %prep
%setup -q -c -T %setup -q -n %{gem_name}-%{version} -b1 -b2
%gem_install -n %{SOURCE0} %patch2 -p2
pushd .%{gem_instdir}
pushd %{_builddir}
%patch0 -p2 %patch0 -p2
%patch1 -p2
popd popd
%build %build
gem build ../%{gem_name}-%{version}.gemspec
%gem_install
%install %install
mkdir -p %{buildroot}%{gem_dir} mkdir -p %{buildroot}%{gem_dir}
cp -pa .%{gem_dir}/* \ cp -pa .%{gem_dir}/* \
%{buildroot}%{gem_dir}/ %{buildroot}%{gem_dir}/
%if ! 0%{?bootstrap}
%if %{without bootstrap}
%check %check
ln -s %{gem_dir}/gems/activerecord-%{version}/ .%{gem_dir}/gems/activerecord ln -s %{gem_dir}/gems/activerecord-%{version}/ .%{gem_dir}/gems/activerecord
pushd .%{gem_instdir} pushd .%{gem_instdir}
tar xzvf %{SOURCE1} -C . ln -s %{_builddir}/tools ..
cd rails-%{version}/%{gem_name} mv %{_builddir}/test .
for t in {actionpack,activerecord,template}; do
ruby -Ilib:test -e "Dir.glob('./test/$t/**/*_test.rb').each {|t| require t}" # Test failure
done # 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 | \
xargs -0 -n1 -i sh -c "echo '* Test file: {}'; ruby -Itest -- '{}' || exit 255"
popd popd
%endif %endif
@ -66,6 +99,15 @@ popd
%doc %{gem_instdir}/CHANGELOG.md %doc %{gem_instdir}/CHANGELOG.md
%changelog %changelog
* Thu Aug 17 2023 wulei <wu_lei@hoperun.com> - 7.0.7-1
- Upgrade to version 7.0.7
* 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
* Wed Aug 04 2021 wangyue <wangyue92@huawei.com> - 5.2.4.4-2 * Wed Aug 04 2021 wangyue <wangyue92@huawei.com> - 5.2.4.4-2
- revert to 5.2.4.4 - revert to 5.2.4.4

Binary file not shown.