From 92fc8ec663f7dbb554c42dd41a86a7efe63dc725 Mon Sep 17 00:00:00 2001 From: Kevin McPhillips Date: Mon, 6 Mar 2017 16:14:05 -0500 Subject: Handle #to_time and memoization taking into account memoization, frozen state, and preserve_timezone flag. --- .../core_ext/date_and_time_compatibility_test.rb | 166 +++++++++++++++++++-- activesupport/test/core_ext/time_with_zone_test.rb | 29 +++- 2 files changed, 180 insertions(+), 15 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/date_and_time_compatibility_test.rb b/activesupport/test/core_ext/date_and_time_compatibility_test.rb index 4c90460032..6c6205a4d2 100644 --- a/activesupport/test/core_ext/date_and_time_compatibility_test.rb +++ b/activesupport/test/core_ext/date_and_time_compatibility_test.rb @@ -16,11 +16,13 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_time_to_time_preserves_timezone with_preserve_timezone(true) do with_env_tz "US/Eastern" do - time = Time.new(2016, 4, 23, 15, 11, 12, 3600).to_time + source = Time.new(2016, 4, 23, 15, 11, 12, 3600) + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc assert_equal @utc_offset, time.utc_offset + assert_equal source.object_id, time.object_id end end end @@ -28,11 +30,43 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_time_to_time_does_not_preserve_time_zone with_preserve_timezone(false) do with_env_tz "US/Eastern" do - time = Time.new(2016, 4, 23, 15, 11, 12, 3600).to_time + source = Time.new(2016, 4, 23, 15, 11, 12, 3600) + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc assert_equal @system_offset, time.utc_offset + assert_not_equal source.object_id, time.object_id + end + end + end + + def test_time_to_time_frozen_preserves_timezone + with_preserve_timezone(true) do + with_env_tz "US/Eastern" do + source = Time.new(2016, 4, 23, 15, 11, 12, 3600).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @utc_offset, time.utc_offset + assert_equal source.object_id, time.object_id + assert_predicate time, :frozen? + end + end + end + + def test_time_to_time_frozen_does_not_preserve_time_zone + with_preserve_timezone(false) do + with_env_tz "US/Eastern" do + source = Time.new(2016, 4, 23, 15, 11, 12, 3600).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @system_offset, time.utc_offset + assert_not_equal source.object_id, time.object_id + assert_not_predicate time, :frozen? end end end @@ -40,7 +74,8 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_datetime_to_time_preserves_timezone with_preserve_timezone(true) do with_env_tz "US/Eastern" do - time = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)).to_time + source = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)) + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc @@ -52,7 +87,8 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_datetime_to_time_does_not_preserve_time_zone with_preserve_timezone(false) do with_env_tz "US/Eastern" do - time = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)).to_time + source = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)) + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc @@ -61,17 +97,47 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase end end + def test_datetime_to_time_frozen_preserves_timezone + with_preserve_timezone(true) do + with_env_tz "US/Eastern" do + source = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @utc_offset, time.utc_offset + assert_not_predicate time, :frozen? + end + end + end + + def test_datetime_to_time_frozen_does_not_preserve_time_zone + with_preserve_timezone(false) do + with_env_tz "US/Eastern" do + source = DateTime.new(2016, 4, 23, 15, 11, 12, Rational(1, 24)).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @system_offset, time.utc_offset + assert_not_predicate time, :frozen? + end + end + end + def test_twz_to_time_preserves_timezone with_preserve_timezone(true) do with_env_tz "US/Eastern" do - time = ActiveSupport::TimeWithZone.new(@utc_time, @zone).to_time + source = ActiveSupport::TimeWithZone.new(@utc_time, @zone) + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc assert_instance_of Time, time.getutc assert_equal @utc_offset, time.utc_offset - time = ActiveSupport::TimeWithZone.new(@date_time, @zone).to_time + source = ActiveSupport::TimeWithZone.new(@date_time, @zone) + time = source.to_time assert_instance_of Time, time assert_equal @date_time, time.getutc @@ -84,19 +150,69 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_twz_to_time_does_not_preserve_time_zone with_preserve_timezone(false) do with_env_tz "US/Eastern" do - time = ActiveSupport::TimeWithZone.new(@utc_time, @zone).to_time + source = ActiveSupport::TimeWithZone.new(@utc_time, @zone) + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_instance_of Time, time.getutc + assert_equal @system_offset, time.utc_offset + + source = ActiveSupport::TimeWithZone.new(@date_time, @zone) + time = source.to_time + + assert_instance_of Time, time + assert_equal @date_time, time.getutc + assert_instance_of Time, time.getutc + assert_equal @system_offset, time.utc_offset + end + end + end + + def test_twz_to_time_frozen_preserves_timezone + with_preserve_timezone(true) do + with_env_tz "US/Eastern" do + source = ActiveSupport::TimeWithZone.new(@utc_time, @zone).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_instance_of Time, time.getutc + assert_equal @utc_offset, time.utc_offset + assert_not_predicate time, :frozen? + + source = ActiveSupport::TimeWithZone.new(@date_time, @zone).freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @date_time, time.getutc + assert_instance_of Time, time.getutc + assert_equal @utc_offset, time.utc_offset + assert_not_predicate time, :frozen? + end + end + end + + def test_twz_to_time_frozen_does_not_preserve_time_zone + with_preserve_timezone(false) do + with_env_tz "US/Eastern" do + source = ActiveSupport::TimeWithZone.new(@utc_time, @zone).freeze + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc assert_instance_of Time, time.getutc assert_equal @system_offset, time.utc_offset + assert_not_predicate time, :frozen? - time = ActiveSupport::TimeWithZone.new(@date_time, @zone).to_time + source = ActiveSupport::TimeWithZone.new(@date_time, @zone).freeze + time = source.to_time assert_instance_of Time, time assert_equal @date_time, time.getutc assert_instance_of Time, time.getutc assert_equal @system_offset, time.utc_offset + assert_not_predicate time, :frozen? end end end @@ -104,7 +220,8 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_string_to_time_preserves_timezone with_preserve_timezone(true) do with_env_tz "US/Eastern" do - time = "2016-04-23T15:11:12+01:00".to_time + source = "2016-04-23T15:11:12+01:00" + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc @@ -116,11 +233,40 @@ class DateAndTimeCompatibilityTest < ActiveSupport::TestCase def test_string_to_time_does_not_preserve_time_zone with_preserve_timezone(false) do with_env_tz "US/Eastern" do - time = "2016-04-23T15:11:12+01:00".to_time + source = "2016-04-23T15:11:12+01:00" + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @system_offset, time.utc_offset + end + end + end + + def test_string_to_time_frozen_preserves_timezone + with_preserve_timezone(true) do + with_env_tz "US/Eastern" do + source = "2016-04-23T15:11:12+01:00".freeze + time = source.to_time + + assert_instance_of Time, time + assert_equal @utc_time, time.getutc + assert_equal @utc_offset, time.utc_offset + assert_not_predicate time, :frozen? + end + end + end + + def test_string_to_time_frozen_does_not_preserve_time_zone + with_preserve_timezone(false) do + with_env_tz "US/Eastern" do + source = "2016-04-23T15:11:12+01:00".freeze + time = source.to_time assert_instance_of Time, time assert_equal @utc_time, time.getutc assert_equal @system_offset, time.utc_offset + assert_not_predicate time, :frozen? end end end diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 1534daacb9..ba15ea6b32 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -421,11 +421,29 @@ class TimeWithZoneTest < ActiveSupport::TestCase assert_equal time, Time.at(time) end - def test_to_time - with_env_tz "US/Eastern" do - assert_equal Time, @twz.to_time.class - assert_equal Time.local(1999, 12, 31, 19), @twz.to_time - assert_equal Time.local(1999, 12, 31, 19).utc_offset, @twz.to_time.utc_offset + def test_to_time_with_preserve_timezone + with_preserve_timezone(true) do + with_env_tz "US/Eastern" do + time = @twz.to_time + + assert_equal Time, time.class + assert_equal time.object_id, @twz.to_time.object_id + assert_equal Time.local(1999, 12, 31, 19), time + assert_equal Time.local(1999, 12, 31, 19).utc_offset, time.utc_offset + end + end + end + + def test_to_time_without_preserve_timezone + with_preserve_timezone(false) do + with_env_tz "US/Eastern" do + time = @twz.to_time + + assert_equal Time, time.class + assert_equal time.object_id, @twz.to_time.object_id + assert_equal Time.local(1999, 12, 31, 19), time + assert_equal Time.local(1999, 12, 31, 19).utc_offset, time.utc_offset + end end end @@ -508,6 +526,7 @@ class TimeWithZoneTest < ActiveSupport::TestCase @twz.period @twz.time @twz.to_datetime + @twz.to_time end end -- cgit v1.2.3 From a91ea1d51048342d13fc73f9b09ce4cfd086bb34 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Wed, 15 Mar 2017 14:38:21 +0000 Subject: Remove implicit coercion deprecation of durations In #28204 we deprecated implicit conversion of durations to a numeric which represented the number of seconds in the duration because of unwanted side effects with calculations on durations and dates. This unfortunately had the side effect of forcing a explicit cast when configuring third-party libraries like expiration in Redis, e.g: redis.expire("foo", 5.minutes) To work around this we've removed the deprecation and added a private class that wraps the numeric and can perform calculation involving durations and ensure that they remain a duration irrespective of the order of operations. --- activesupport/test/core_ext/duration_test.rb | 142 ++++++++++++++++++++++----- 1 file changed, 117 insertions(+), 25 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 2b1a715b7a..52fdbe677d 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -96,24 +96,20 @@ class DurationTest < ActiveSupport::TestCase assert_instance_of ActiveSupport::Duration, 2.seconds - 1.second assert_equal 1.second, 2.seconds - 1 assert_instance_of ActiveSupport::Duration, 2.seconds - 1 + assert_equal 1.second, 2 - 1.second + assert_instance_of ActiveSupport::Duration, 2.seconds - 1 end def test_multiply assert_equal 7.days, 1.day * 7 assert_instance_of ActiveSupport::Duration, 1.day * 7 - - assert_deprecated do - assert_equal 86400, 1.day * 1.second - end + assert_equal 86400, 1.day * 1.second end def test_divide assert_equal 1.day, 7.days / 7 assert_instance_of ActiveSupport::Duration, 7.days / 7 - - assert_deprecated do - assert_equal 1, 1.day / 1.day - end + assert_equal 1, 1.day / 1.day end def test_date_added_with_multiplied_duration @@ -121,9 +117,7 @@ class DurationTest < ActiveSupport::TestCase end def test_plus_with_time - assert_deprecated do - assert_equal 1 + 1.second, 1.second + 1, "Duration + Numeric should == Numeric + Duration" - end + assert_equal 1 + 1.second, 1.second + 1, "Duration + Numeric should == Numeric + Duration" end def test_time_plus_duration_returns_same_time_datatype @@ -142,13 +136,6 @@ class DurationTest < ActiveSupport::TestCase assert_equal 'expected a time or date, got ""', e.message, "ensure ArgumentError is not being raised by dependencies.rb" end - def test_implicit_coercion_is_deprecated - assert_deprecated { 1 + 1.second } - assert_deprecated { 1 - 1.second } - assert_deprecated { 1 * 1.second } - assert_deprecated { 1 / 1.second } - end - def test_fractional_weeks assert_equal((86400 * 7) * 1.5, 1.5.weeks) assert_equal((86400 * 7) * 1.7, 1.7.weeks) @@ -286,20 +273,125 @@ class DurationTest < ActiveSupport::TestCase def test_comparable assert_equal(-1, (0.seconds <=> 1.second)) assert_equal(-1, (1.second <=> 1.minute)) - - assert_deprecated do - assert_equal(-1, (1 <=> 1.minute)) - end - + assert_equal(-1, (1 <=> 1.minute)) assert_equal(0, (0.seconds <=> 0.seconds)) assert_equal(0, (0.seconds <=> 0.minutes)) assert_equal(0, (1.second <=> 1.second)) assert_equal(1, (1.second <=> 0.second)) assert_equal(1, (1.minute <=> 1.second)) + assert_equal(1, (61 <=> 1.minute)) + end - assert_deprecated do - assert_equal(1, (61 <=> 1.minute)) + def test_implicit_coercion + assert_equal 2.days, 2 * 1.day + assert_instance_of ActiveSupport::Duration, 2 * 1.day + assert_equal Time.utc(2017, 1, 3), Time.utc(2017, 1, 1) + 2 * 1.day + assert_equal Date.civil(2017, 1, 3), Date.civil(2017, 1, 1) + 2 * 1.day + end + + def test_scalar_coerce + scalar = ActiveSupport::Duration::Scalar.new(10) + assert_instance_of ActiveSupport::Duration::Scalar, 10 + scalar + assert_instance_of ActiveSupport::Duration, 10.seconds + scalar + end + + def test_scalar_delegations + scalar = ActiveSupport::Duration::Scalar.new(10) + assert_kind_of Float, scalar.to_f + assert_kind_of Integer, scalar.to_i + assert_kind_of String, scalar.to_s + end + + def test_scalar_unary_minus + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal -10, -scalar + assert_instance_of ActiveSupport::Duration::Scalar, -scalar + end + + def test_scalar_compare + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal 1, scalar <=> 5 + assert_equal 0, scalar <=> 10 + assert_equal -1, scalar <=> 15 + assert_equal nil, scalar <=> "foo" + end + + def test_scalar_plus + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal 20, 10 + scalar + assert_instance_of ActiveSupport::Duration::Scalar, 10 + scalar + assert_equal 20, scalar + 10 + assert_instance_of ActiveSupport::Duration::Scalar, scalar + 10 + assert_equal 20, 10.seconds + scalar + assert_instance_of ActiveSupport::Duration, 10.seconds + scalar + assert_equal 20, scalar + 10.seconds + assert_instance_of ActiveSupport::Duration, scalar + 10.seconds + + exception = assert_raises(TypeError) do + scalar + "foo" + end + + assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message + end + + def test_scalar_minus + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal 10, 20 - scalar + assert_instance_of ActiveSupport::Duration::Scalar, 20 - scalar + assert_equal 5, scalar - 5 + assert_instance_of ActiveSupport::Duration::Scalar, scalar - 5 + assert_equal 10, 20.seconds - scalar + assert_instance_of ActiveSupport::Duration, 20.seconds - scalar + assert_equal 5, scalar - 5.seconds + assert_instance_of ActiveSupport::Duration, scalar - 5.seconds + + exception = assert_raises(TypeError) do + scalar - "foo" + end + + assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message + end + + def test_scalar_multiply + scalar = ActiveSupport::Duration::Scalar.new(5) + + assert_equal 10, 2 * scalar + assert_instance_of ActiveSupport::Duration::Scalar, 2 * scalar + assert_equal 10, scalar * 2 + assert_instance_of ActiveSupport::Duration::Scalar, scalar * 2 + assert_equal 10, 2.seconds * scalar + assert_instance_of ActiveSupport::Duration, 2.seconds * scalar + assert_equal 10, scalar * 2.seconds + assert_instance_of ActiveSupport::Duration, scalar * 2.seconds + + exception = assert_raises(TypeError) do + scalar * "foo" end + + assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message + end + + def test_scalar_divide + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal 10, 100 / scalar + assert_instance_of ActiveSupport::Duration::Scalar, 100 / scalar + assert_equal 5, scalar / 2 + assert_instance_of ActiveSupport::Duration::Scalar, scalar / 2 + assert_equal 10, 100.seconds / scalar + assert_instance_of ActiveSupport::Duration, 2.seconds * scalar + assert_equal 5, scalar / 2.seconds + assert_instance_of ActiveSupport::Duration, scalar / 2.seconds + + exception = assert_raises(TypeError) do + scalar / "foo" + end + + assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message end def test_twelve_months_equals_one_year -- cgit v1.2.3 From b9c399de22aa84c94bb6b2edf6f8e88b88ac5f4a Mon Sep 17 00:00:00 2001 From: Andrew White Date: Thu, 16 Mar 2017 09:16:20 +0000 Subject: Fix test warnings --- activesupport/test/core_ext/duration_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 52fdbe677d..1648a9b270 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -305,17 +305,17 @@ class DurationTest < ActiveSupport::TestCase def test_scalar_unary_minus scalar = ActiveSupport::Duration::Scalar.new(10) - assert_equal -10, -scalar + assert_equal(-10, -scalar) assert_instance_of ActiveSupport::Duration::Scalar, -scalar end def test_scalar_compare scalar = ActiveSupport::Duration::Scalar.new(10) - assert_equal 1, scalar <=> 5 - assert_equal 0, scalar <=> 10 - assert_equal -1, scalar <=> 15 - assert_equal nil, scalar <=> "foo" + assert_equal(1, scalar <=> 5) + assert_equal(0, scalar <=> 10) + assert_equal(-1, scalar <=> 15) + assert_equal(nil, scalar <=> "foo") end def test_scalar_plus -- cgit v1.2.3 From f0c8f1b0856592541f248a081cabcbd9aa890c28 Mon Sep 17 00:00:00 2001 From: Mubashir Hanif Date: Sun, 7 Aug 2016 17:27:47 +0500 Subject: Added options hash to titleize method and keep_id_suffix option to humanize some documentation remove extra whitespace. Added id in the middle test case and corrected some testcases. Some Coding standard guidelines corrections as suggested by codeclimate. Some more corrections suggested by codeclimate. --- activesupport/test/core_ext/string_ext_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 98bcdda45b..b0ebe0af8e 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -77,6 +77,12 @@ class StringInflectionsTest < ActiveSupport::TestCase end end + def test_titleize_with_keep_id_suffix + MixtureToTitleCaseWithKeepIdSuffix.each do |before, titleized| + assert_equal(titleized, before.titleize(keep_id_suffix: true)) + end + end + def test_upcase_first assert_equal "What a Lovely Day", "what a Lovely Day".upcase_first end @@ -198,6 +204,12 @@ class StringInflectionsTest < ActiveSupport::TestCase end end + def test_humanize_with_keep_id_suffix + UnderscoreToHumanWithKeepIdSuffix.each do |underscore, human| + assert_equal(human, underscore.humanize(keep_id_suffix: true)) + end + end + def test_humanize_with_html_escape assert_equal "Hello", ERB::Util.html_escape("hello").humanize end -- cgit v1.2.3 From 7045e03dee2cda9af65bc8e51bddab79599f44cd Mon Sep 17 00:00:00 2001 From: Vipul A M Date: Thu, 23 Mar 2017 17:34:30 +0530 Subject: Fix duplicable? for Ratiional and Complex on ruby master, since they are now duplicable --- activesupport/test/core_ext/object/duplicable_test.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index e6f3c8aef2..68b0129980 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -4,7 +4,10 @@ require "active_support/core_ext/object/duplicable" require "active_support/core_ext/numeric/time" class DuplicableTest < ActiveSupport::TestCase - if RUBY_VERSION >= "2.4.1" + if RUBY_VERSION >= "2.5.0" + RAISE_DUP = [method(:puts)] + ALLOW_DUP = ["1", "symbol_from_string".to_sym, Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, 1, 2.3, Complex(1), Rational(1)] + elsif RUBY_VERSION >= "2.4.1" RAISE_DUP = [method(:puts), Complex(1), Rational(1)] ALLOW_DUP = ["1", "symbol_from_string".to_sym, Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, 1, 2.3] elsif RUBY_VERSION >= "2.4.0" # Due to 2.4.0 bug. This elsif cannot be removed unless we drop 2.4.0 support... -- cgit v1.2.3 From 0117810cdab34d168b0579a6736c5d58c5ab84c7 Mon Sep 17 00:00:00 2001 From: Matt Casper Date: Wed, 29 Mar 2017 09:56:27 -0500 Subject: Add aliases for reverse_merge to with_defaults In the context of controller parameters, reverse_merge is commonly used to provide defaults for user input. Having an alias to reverse_merge called with_defaults feels more idiomatic for Rails. --- activesupport/test/core_ext/hash_ext_test.rb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 525ea08abd..cb6babfe49 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -535,6 +535,16 @@ class HashExtTest < ActiveSupport::TestCase assert_equal "clobber", hash[:another] end + def test_indifferent_with_defaults_aliases_reverse_merge + hash = HashWithIndifferentAccess.new key: :old_value + actual = hash.with_defaults key: :new_value + assert_equal :old_value, actual[:key] + + hash = HashWithIndifferentAccess.new key: :old_value + hash.with_defaults! key: :new_value + assert_equal :old_value, hash[:key] + end + def test_indifferent_deleting get_hash = proc { { a: "foo" }.with_indifferent_access } hash = get_hash.call @@ -848,6 +858,21 @@ class HashExtTest < ActiveSupport::TestCase assert_equal expected, merged end + def test_with_defaults_aliases_reverse_merge + defaults = { a: "x", b: "y", c: 10 }.freeze + options = { a: 1, b: 2 } + expected = { a: 1, b: 2, c: 10 } + + # Should be an alias for reverse_merge + assert_equal expected, options.with_defaults(defaults) + assert_not_equal expected, options + + # Should be an alias for reverse_merge! + merged = options.dup + assert_equal expected, merged.with_defaults!(defaults) + assert_equal expected, merged + end + def test_slice original = { a: "x", b: "y", c: 10 } expected = { a: "x", b: "y" } -- cgit v1.2.3 From ec9fffd3e045d9da83ac790e5511cd3d75bd2343 Mon Sep 17 00:00:00 2001 From: Michael Stock Date: Wed, 29 Mar 2017 18:15:40 -0500 Subject: Move HashWithIndifferentAccess tests to separate file --- activesupport/test/core_ext/hash_ext_test.rb | 712 --------------------------- 1 file changed, 712 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index cb6babfe49..18da5fcf5f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -8,33 +8,6 @@ require "active_support/core_ext/object/deep_dup" require "active_support/inflections" class HashExtTest < ActiveSupport::TestCase - HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess - - class IndifferentHash < ActiveSupport::HashWithIndifferentAccess - end - - class SubclassingArray < Array - end - - class SubclassingHash < Hash - end - - class NonIndifferentHash < Hash - def nested_under_indifferent_access - self - end - end - - class HashByConversion - def initialize(hash) - @hash = hash - end - - def to_hash - @hash - end - end - def setup @strings = { "a" => 1, "b" => 2 } @nested_strings = { "a" => { "b" => { "c" => 3 } } } @@ -264,481 +237,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal({ "a" => { b: { "c" => 3 } } }, @nested_mixed) end - def test_symbolize_keys_for_hash_with_indifferent_access - assert_instance_of Hash, @symbols.with_indifferent_access.symbolize_keys - assert_equal @symbols, @symbols.with_indifferent_access.symbolize_keys - assert_equal @symbols, @strings.with_indifferent_access.symbolize_keys - assert_equal @symbols, @mixed.with_indifferent_access.symbolize_keys - end - - def test_deep_symbolize_keys_for_hash_with_indifferent_access - assert_instance_of Hash, @nested_symbols.with_indifferent_access.deep_symbolize_keys - assert_equal @nested_symbols, @nested_symbols.with_indifferent_access.deep_symbolize_keys - assert_equal @nested_symbols, @nested_strings.with_indifferent_access.deep_symbolize_keys - assert_equal @nested_symbols, @nested_mixed.with_indifferent_access.deep_symbolize_keys - end - - def test_symbolize_keys_bang_for_hash_with_indifferent_access - assert_raise(NoMethodError) { @symbols.with_indifferent_access.dup.symbolize_keys! } - assert_raise(NoMethodError) { @strings.with_indifferent_access.dup.symbolize_keys! } - assert_raise(NoMethodError) { @mixed.with_indifferent_access.dup.symbolize_keys! } - end - - def test_deep_symbolize_keys_bang_for_hash_with_indifferent_access - assert_raise(NoMethodError) { @nested_symbols.with_indifferent_access.deep_dup.deep_symbolize_keys! } - assert_raise(NoMethodError) { @nested_strings.with_indifferent_access.deep_dup.deep_symbolize_keys! } - assert_raise(NoMethodError) { @nested_mixed.with_indifferent_access.deep_dup.deep_symbolize_keys! } - end - - def test_symbolize_keys_preserves_keys_that_cant_be_symbolized_for_hash_with_indifferent_access - assert_equal @illegal_symbols, @illegal_symbols.with_indifferent_access.symbolize_keys - assert_raise(NoMethodError) { @illegal_symbols.with_indifferent_access.dup.symbolize_keys! } - end - - def test_deep_symbolize_keys_preserves_keys_that_cant_be_symbolized_for_hash_with_indifferent_access - assert_equal @nested_illegal_symbols, @nested_illegal_symbols.with_indifferent_access.deep_symbolize_keys - assert_raise(NoMethodError) { @nested_illegal_symbols.with_indifferent_access.deep_dup.deep_symbolize_keys! } - end - - def test_symbolize_keys_preserves_integer_keys_for_hash_with_indifferent_access - assert_equal @integers, @integers.with_indifferent_access.symbolize_keys - assert_raise(NoMethodError) { @integers.with_indifferent_access.dup.symbolize_keys! } - end - - def test_deep_symbolize_keys_preserves_integer_keys_for_hash_with_indifferent_access - assert_equal @nested_integers, @nested_integers.with_indifferent_access.deep_symbolize_keys - assert_raise(NoMethodError) { @nested_integers.with_indifferent_access.deep_dup.deep_symbolize_keys! } - end - - def test_stringify_keys_for_hash_with_indifferent_access - assert_instance_of ActiveSupport::HashWithIndifferentAccess, @symbols.with_indifferent_access.stringify_keys - assert_equal @strings, @symbols.with_indifferent_access.stringify_keys - assert_equal @strings, @strings.with_indifferent_access.stringify_keys - assert_equal @strings, @mixed.with_indifferent_access.stringify_keys - end - - def test_deep_stringify_keys_for_hash_with_indifferent_access - assert_instance_of ActiveSupport::HashWithIndifferentAccess, @nested_symbols.with_indifferent_access.deep_stringify_keys - assert_equal @nested_strings, @nested_symbols.with_indifferent_access.deep_stringify_keys - assert_equal @nested_strings, @nested_strings.with_indifferent_access.deep_stringify_keys - assert_equal @nested_strings, @nested_mixed.with_indifferent_access.deep_stringify_keys - end - - def test_stringify_keys_bang_for_hash_with_indifferent_access - assert_instance_of ActiveSupport::HashWithIndifferentAccess, @symbols.with_indifferent_access.dup.stringify_keys! - assert_equal @strings, @symbols.with_indifferent_access.dup.stringify_keys! - assert_equal @strings, @strings.with_indifferent_access.dup.stringify_keys! - assert_equal @strings, @mixed.with_indifferent_access.dup.stringify_keys! - end - - def test_deep_stringify_keys_bang_for_hash_with_indifferent_access - assert_instance_of ActiveSupport::HashWithIndifferentAccess, @nested_symbols.with_indifferent_access.dup.deep_stringify_keys! - assert_equal @nested_strings, @nested_symbols.with_indifferent_access.deep_dup.deep_stringify_keys! - assert_equal @nested_strings, @nested_strings.with_indifferent_access.deep_dup.deep_stringify_keys! - assert_equal @nested_strings, @nested_mixed.with_indifferent_access.deep_dup.deep_stringify_keys! - end - - def test_nested_under_indifferent_access - foo = { "foo" => SubclassingHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access - assert_kind_of ActiveSupport::HashWithIndifferentAccess, foo["foo"] - - foo = { "foo" => NonIndifferentHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access - assert_kind_of NonIndifferentHash, foo["foo"] - - foo = { "foo" => IndifferentHash.new.tap { |h| h["bar"] = "baz" } }.with_indifferent_access - assert_kind_of IndifferentHash, foo["foo"] - end - - def test_indifferent_assorted - @strings = @strings.with_indifferent_access - @symbols = @symbols.with_indifferent_access - @mixed = @mixed.with_indifferent_access - - assert_equal "a", @strings.__send__(:convert_key, :a) - - assert_equal 1, @strings.fetch("a") - assert_equal 1, @strings.fetch(:a.to_s) - assert_equal 1, @strings.fetch(:a) - - hashes = { :@strings => @strings, :@symbols => @symbols, :@mixed => @mixed } - method_map = { '[]': 1, fetch: 1, values_at: [1], - has_key?: true, include?: true, key?: true, - member?: true } - - hashes.each do |name, hash| - method_map.sort_by(&:to_s).each do |meth, expected| - assert_equal(expected, hash.__send__(meth, "a"), - "Calling #{name}.#{meth} 'a'") - assert_equal(expected, hash.__send__(meth, :a), - "Calling #{name}.#{meth} :a") - end - end - - assert_equal [1, 2], @strings.values_at("a", "b") - assert_equal [1, 2], @strings.values_at(:a, :b) - assert_equal [1, 2], @symbols.values_at("a", "b") - assert_equal [1, 2], @symbols.values_at(:a, :b) - assert_equal [1, 2], @mixed.values_at("a", "b") - assert_equal [1, 2], @mixed.values_at(:a, :b) - end - - def test_indifferent_reading - hash = HashWithIndifferentAccess.new - hash["a"] = 1 - hash["b"] = true - hash["c"] = false - hash["d"] = nil - - assert_equal 1, hash[:a] - assert_equal true, hash[:b] - assert_equal false, hash[:c] - assert_nil hash[:d] - assert_nil hash[:e] - end - - def test_indifferent_reading_with_nonnil_default - hash = HashWithIndifferentAccess.new(1) - hash["a"] = 1 - hash["b"] = true - hash["c"] = false - hash["d"] = nil - - assert_equal 1, hash[:a] - assert_equal true, hash[:b] - assert_equal false, hash[:c] - assert_nil hash[:d] - assert_equal 1, hash[:e] - end - - def test_indifferent_writing - hash = HashWithIndifferentAccess.new - hash[:a] = 1 - hash["b"] = 2 - hash[3] = 3 - - assert_equal 1, hash["a"] - assert_equal 2, hash["b"] - assert_equal 1, hash[:a] - assert_equal 2, hash[:b] - assert_equal 3, hash[3] - end - - def test_indifferent_update - hash = HashWithIndifferentAccess.new - hash[:a] = "a" - hash["b"] = "b" - - updated_with_strings = hash.update(@strings) - updated_with_symbols = hash.update(@symbols) - updated_with_mixed = hash.update(@mixed) - - assert_equal 1, updated_with_strings[:a] - assert_equal 1, updated_with_strings["a"] - assert_equal 2, updated_with_strings["b"] - - assert_equal 1, updated_with_symbols[:a] - assert_equal 2, updated_with_symbols["b"] - assert_equal 2, updated_with_symbols[:b] - - assert_equal 1, updated_with_mixed[:a] - assert_equal 2, updated_with_mixed["b"] - - assert [updated_with_strings, updated_with_symbols, updated_with_mixed].all? { |h| h.keys.size == 2 } - end - - def test_update_with_to_hash_conversion - hash = HashWithIndifferentAccess.new - hash.update HashByConversion.new(a: 1) - assert_equal 1, hash["a"] - end - - def test_indifferent_merging - hash = HashWithIndifferentAccess.new - hash[:a] = "failure" - hash["b"] = "failure" - - other = { "a" => 1, :b => 2 } - - merged = hash.merge(other) - - assert_equal HashWithIndifferentAccess, merged.class - assert_equal 1, merged[:a] - assert_equal 2, merged["b"] - - hash.update(other) - - assert_equal 1, hash[:a] - assert_equal 2, hash["b"] - end - - def test_merge_with_to_hash_conversion - hash = HashWithIndifferentAccess.new - merged = hash.merge HashByConversion.new(a: 1) - assert_equal 1, merged["a"] - end - - def test_indifferent_replace - hash = HashWithIndifferentAccess.new - hash[:a] = 42 - - replaced = hash.replace(b: 12) - - assert hash.key?("b") - assert !hash.key?(:a) - assert_equal 12, hash[:b] - assert_same hash, replaced - end - - def test_replace_with_to_hash_conversion - hash = HashWithIndifferentAccess.new - hash[:a] = 42 - - replaced = hash.replace(HashByConversion.new(b: 12)) - - assert hash.key?("b") - assert !hash.key?(:a) - assert_equal 12, hash[:b] - assert_same hash, replaced - end - - def test_indifferent_merging_with_block - hash = HashWithIndifferentAccess.new - hash[:a] = 1 - hash["b"] = 3 - - other = { "a" => 4, :b => 2, "c" => 10 } - - merged = hash.merge(other) { |key, old, new| old > new ? old : new } - - assert_equal HashWithIndifferentAccess, merged.class - assert_equal 4, merged[:a] - assert_equal 3, merged["b"] - assert_equal 10, merged[:c] - - other_indifferent = HashWithIndifferentAccess.new("a" => 9, :b => 2) - - merged = hash.merge(other_indifferent) { |key, old, new| old + new } - - assert_equal HashWithIndifferentAccess, merged.class - assert_equal 10, merged[:a] - assert_equal 5, merged[:b] - end - - def test_indifferent_reverse_merging - hash = HashWithIndifferentAccess.new key: :old_value - hash.reverse_merge! key: :new_value - assert_equal :old_value, hash[:key] - - hash = HashWithIndifferentAccess.new("some" => "value", "other" => "value") - hash.reverse_merge!(some: "noclobber", another: "clobber") - assert_equal "value", hash[:some] - assert_equal "clobber", hash[:another] - end - - def test_indifferent_with_defaults_aliases_reverse_merge - hash = HashWithIndifferentAccess.new key: :old_value - actual = hash.with_defaults key: :new_value - assert_equal :old_value, actual[:key] - - hash = HashWithIndifferentAccess.new key: :old_value - hash.with_defaults! key: :new_value - assert_equal :old_value, hash[:key] - end - - def test_indifferent_deleting - get_hash = proc { { a: "foo" }.with_indifferent_access } - hash = get_hash.call - assert_equal "foo", hash.delete(:a) - assert_nil hash.delete(:a) - hash = get_hash.call - assert_equal "foo", hash.delete("a") - assert_nil hash.delete("a") - end - - def test_indifferent_select - hash = ActiveSupport::HashWithIndifferentAccess.new(@strings).select { |k, v| v == 1 } - - assert_equal({ "a" => 1 }, hash) - assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash - end - - def test_indifferent_select_returns_enumerator - enum = ActiveSupport::HashWithIndifferentAccess.new(@strings).select - assert_instance_of Enumerator, enum - end - - def test_indifferent_select_returns_a_hash_when_unchanged - hash = ActiveSupport::HashWithIndifferentAccess.new(@strings).select { |k, v| true } - - assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash - end - - def test_indifferent_select_bang - indifferent_strings = ActiveSupport::HashWithIndifferentAccess.new(@strings) - indifferent_strings.select! { |k, v| v == 1 } - - assert_equal({ "a" => 1 }, indifferent_strings) - assert_instance_of ActiveSupport::HashWithIndifferentAccess, indifferent_strings - end - - def test_indifferent_reject - hash = ActiveSupport::HashWithIndifferentAccess.new(@strings).reject { |k, v| v != 1 } - - assert_equal({ "a" => 1 }, hash) - assert_instance_of ActiveSupport::HashWithIndifferentAccess, hash - end - - def test_indifferent_reject_returns_enumerator - enum = ActiveSupport::HashWithIndifferentAccess.new(@strings).reject - assert_instance_of Enumerator, enum - end - - def test_indifferent_reject_bang - indifferent_strings = ActiveSupport::HashWithIndifferentAccess.new(@strings) - indifferent_strings.reject! { |k, v| v != 1 } - - assert_equal({ "a" => 1 }, indifferent_strings) - assert_instance_of ActiveSupport::HashWithIndifferentAccess, indifferent_strings - end - - def test_indifferent_compact - hash_contain_nil_value = @strings.merge("z" => nil) - hash = ActiveSupport::HashWithIndifferentAccess.new(hash_contain_nil_value) - compacted_hash = hash.compact - - assert_equal(@strings, compacted_hash) - assert_equal(hash_contain_nil_value, hash) - assert_instance_of ActiveSupport::HashWithIndifferentAccess, compacted_hash - - empty_hash = ActiveSupport::HashWithIndifferentAccess.new - compacted_hash = empty_hash.compact - - assert_equal compacted_hash, empty_hash - - non_empty_hash = ActiveSupport::HashWithIndifferentAccess.new(foo: :bar) - compacted_hash = non_empty_hash.compact - - assert_equal compacted_hash, non_empty_hash - end - - def test_indifferent_to_hash - # Should convert to a Hash with String keys. - assert_equal @strings, @mixed.with_indifferent_access.to_hash - - # Should preserve the default value. - mixed_with_default = @mixed.dup - mixed_with_default.default = "1234" - roundtrip = mixed_with_default.with_indifferent_access.to_hash - assert_equal @strings, roundtrip - assert_equal "1234", roundtrip.default - - # Ensure nested hashes are not HashWithIndiffereneAccess - new_to_hash = @nested_mixed.with_indifferent_access.to_hash - assert_not new_to_hash.instance_of?(HashWithIndifferentAccess) - assert_not new_to_hash["a"].instance_of?(HashWithIndifferentAccess) - assert_not new_to_hash["a"]["b"].instance_of?(HashWithIndifferentAccess) - end - - def test_lookup_returns_the_same_object_that_is_stored_in_hash_indifferent_access - hash = HashWithIndifferentAccess.new { |h, k| h[k] = [] } - hash[:a] << 1 - - assert_equal [1], hash[:a] - end - - def test_with_indifferent_access_has_no_side_effects_on_existing_hash - hash = { content: [{ :foo => :bar, "bar" => "baz" }] } - hash.with_indifferent_access - - assert_equal [:foo, "bar"], hash[:content].first.keys - end - - def test_indifferent_hash_with_array_of_hashes - hash = { "urls" => { "url" => [ { "address" => "1" }, { "address" => "2" } ] } }.with_indifferent_access - assert_equal "1", hash[:urls][:url].first[:address] - - hash = hash.to_hash - assert_not hash.instance_of?(HashWithIndifferentAccess) - assert_not hash["urls"].instance_of?(HashWithIndifferentAccess) - assert_not hash["urls"]["url"].first.instance_of?(HashWithIndifferentAccess) - end - - def test_should_preserve_array_subclass_when_value_is_array - array = SubclassingArray.new - array << { "address" => "1" } - hash = { "urls" => { "url" => array } }.with_indifferent_access - assert_equal SubclassingArray, hash[:urls][:url].class - end - - def test_should_preserve_array_class_when_hash_value_is_frozen_array - array = SubclassingArray.new - array << { "address" => "1" } - hash = { "urls" => { "url" => array.freeze } }.with_indifferent_access - assert_equal SubclassingArray, hash[:urls][:url].class - end - - def test_stringify_and_symbolize_keys_on_indifferent_preserves_hash - h = HashWithIndifferentAccess.new - h[:first] = 1 - h = h.stringify_keys - assert_equal 1, h["first"] - h = HashWithIndifferentAccess.new - h["first"] = 1 - h = h.symbolize_keys - assert_equal 1, h[:first] - end - - def test_deep_stringify_and_deep_symbolize_keys_on_indifferent_preserves_hash - h = HashWithIndifferentAccess.new - h[:first] = 1 - h = h.deep_stringify_keys - assert_equal 1, h["first"] - h = HashWithIndifferentAccess.new - h["first"] = 1 - h = h.deep_symbolize_keys - assert_equal 1, h[:first] - end - - def test_to_options_on_indifferent_preserves_hash - h = HashWithIndifferentAccess.new - h["first"] = 1 - h.to_options! - assert_equal 1, h["first"] - end - - def test_to_options_on_indifferent_preserves_works_as_hash_with_dup - h = HashWithIndifferentAccess.new(a: { b: "b" }) - dup = h.dup - - dup[:a][:c] = "c" - assert_equal "c", h[:a][:c] - end - - def test_indifferent_sub_hashes - h = { "user" => { "id" => 5 } }.with_indifferent_access - ["user", :user].each { |user| [:id, "id"].each { |id| assert_equal 5, h[user][id], "h[#{user.inspect}][#{id.inspect}] should be 5" } } - - h = { user: { id: 5 } }.with_indifferent_access - ["user", :user].each { |user| [:id, "id"].each { |id| assert_equal 5, h[user][id], "h[#{user.inspect}][#{id.inspect}] should be 5" } } - end - - def test_indifferent_duplication - # Should preserve default value - h = HashWithIndifferentAccess.new - h.default = "1234" - assert_equal h.default, h.dup.default - - # Should preserve class for subclasses - h = IndifferentHash.new - assert_equal h.class, h.dup.class - end - - def test_nested_dig_indifferent_access - skip if RUBY_VERSION < "2.3.0" - data = { "this" => { "views" => 1234 } }.with_indifferent_access - assert_equal 1234, data.dig(:this, :views) - end - def test_assert_valid_keys assert_nothing_raised do { failure: "stuff", funny: "business" }.assert_valid_keys([ :failure, :funny ]) @@ -771,12 +269,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal "Unknown key: :failore. Valid keys are: :failure", exception.message end - def test_assorted_keys_not_stringified - original = { Object.new => 2, 1 => 2, [] => true } - indiff = original.with_indifferent_access - assert(!indiff.keys.any? { |k| k.kind_of? String }, "A key was converted to a string!") - end - def test_deep_merge hash_1 = { a: "a", b: "b", c: { c1: "c1", c2: "c2", c3: { d1: "d1" } } } hash_2 = { a: 1, c: { c1: 2, c3: { d2: "d2" } } } @@ -807,37 +299,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal expected, hash_1 end - def test_deep_merge_on_indifferent_access - hash_1 = HashWithIndifferentAccess.new(a: "a", b: "b", c: { c1: "c1", c2: "c2", c3: { d1: "d1" } }) - hash_2 = HashWithIndifferentAccess.new(a: 1, c: { c1: 2, c3: { d2: "d2" } }) - hash_3 = { a: 1, c: { c1: 2, c3: { d2: "d2" } } } - expected = { "a" => 1, "b" => "b", "c" => { "c1" => 2, "c2" => "c2", "c3" => { "d1" => "d1", "d2" => "d2" } } } - assert_equal expected, hash_1.deep_merge(hash_2) - assert_equal expected, hash_1.deep_merge(hash_3) - - hash_1.deep_merge!(hash_2) - assert_equal expected, hash_1 - end - - def test_store_on_indifferent_access - hash = HashWithIndifferentAccess.new - hash.store(:test1, 1) - hash.store("test1", 11) - hash[:test2] = 2 - hash["test2"] = 22 - expected = { "test1" => 11, "test2" => 22 } - assert_equal expected, hash - end - - def test_constructor_on_indifferent_access - hash = HashWithIndifferentAccess[:foo, 1] - assert_equal 1, hash[:foo] - assert_equal 1, hash["foo"] - hash[:foo] = 3 - assert_equal 3, hash[:foo] - assert_equal 3, hash["foo"] - end - def test_reverse_merge defaults = { a: "x", b: "y", c: 10 }.freeze options = { a: 1, b: 2 } @@ -915,38 +376,6 @@ class HashExtTest < ActiveSupport::TestCase assert_equal expected, original.slice(*[:a, :b]) end - def test_indifferent_slice - original = { a: "x", b: "y", c: 10 }.with_indifferent_access - expected = { a: "x", b: "y" }.with_indifferent_access - - [["a", "b"], [:a, :b]].each do |keys| - # Should return a new hash with only the given keys. - assert_equal expected, original.slice(*keys), keys.inspect - assert_not_equal expected, original - end - end - - def test_indifferent_slice_inplace - original = { a: "x", b: "y", c: 10 }.with_indifferent_access - expected = { c: 10 }.with_indifferent_access - - [["a", "b"], [:a, :b]].each do |keys| - # Should replace the hash with only the given keys. - copy = original.dup - assert_equal expected, copy.slice!(*keys) - end - end - - def test_indifferent_slice_access_with_symbols - original = { "login" => "bender", "password" => "shiny", "stuff" => "foo" } - original = original.with_indifferent_access - - slice = original.slice(:login, :password) - - assert_equal "bender", slice[:login] - assert_equal "bender", slice["login"] - end - def test_slice_bang_does_not_override_default hash = Hash.new(0) hash.update(a: 1, b: 2) @@ -984,18 +413,6 @@ class HashExtTest < ActiveSupport::TestCase assert_nil extracted[:x] end - def test_indifferent_extract - original = { :a => 1, "b" => 2, :c => 3, "d" => 4 }.with_indifferent_access - expected = { a: 1, b: 2 }.with_indifferent_access - remaining = { c: 3, d: 4 }.with_indifferent_access - - [["a", "b"], [:a, :b]].each do |keys| - copy = original.dup - assert_equal expected, copy.extract!(*keys) - assert_equal remaining, copy - end - end - def test_except original = { a: "x", b: "y", c: 10 } expected = { a: "x", b: "y" } @@ -1067,78 +484,6 @@ class HashExtTest < ActiveSupport::TestCase assert_nil(h.compact!) assert_equal(@symbols, h) end - - def test_new_with_to_hash_conversion - hash = HashWithIndifferentAccess.new(HashByConversion.new(a: 1)) - assert hash.key?("a") - assert_equal 1, hash[:a] - end - - def test_dup_with_default_proc - hash = HashWithIndifferentAccess.new - hash.default_proc = proc { |h, v| raise "walrus" } - assert_nothing_raised { hash.dup } - end - - def test_dup_with_default_proc_sets_proc - hash = HashWithIndifferentAccess.new - hash.default_proc = proc { |h, k| k + 1 } - new_hash = hash.dup - - assert_equal 3, new_hash[2] - - new_hash.default = 2 - assert_equal 2, new_hash[:non_existent] - end - - def test_to_hash_with_raising_default_proc - hash = HashWithIndifferentAccess.new - hash.default_proc = proc { |h, k| raise "walrus" } - - assert_nothing_raised { hash.to_hash } - end - - def test_new_with_to_hash_conversion_copies_default - normal_hash = Hash.new(3) - normal_hash[:a] = 1 - - hash = HashWithIndifferentAccess.new(HashByConversion.new(normal_hash)) - assert_equal 1, hash[:a] - assert_equal 3, hash[:b] - end - - def test_new_with_to_hash_conversion_copies_default_proc - normal_hash = Hash.new { 1 + 2 } - normal_hash[:a] = 1 - - hash = HashWithIndifferentAccess.new(HashByConversion.new(normal_hash)) - assert_equal 1, hash[:a] - assert_equal 3, hash[:b] - end - - def test_inheriting_from_top_level_hash_with_indifferent_access_preserves_ancestors_chain - klass = Class.new(::HashWithIndifferentAccess) - assert_equal ActiveSupport::HashWithIndifferentAccess, klass.ancestors[1] - end - - def test_inheriting_from_hash_with_indifferent_access_properly_dumps_ivars - klass = Class.new(::HashWithIndifferentAccess) do - def initialize(*) - @foo = "bar" - super - end - end - - yaml_output = klass.new.to_yaml - - # `hash-with-ivars` was introduced in 2.0.9 (https://git.io/vyUQW) - if Gem::Version.new(Psych::VERSION) >= Gem::Version.new("2.0.9") - assert_includes yaml_output, "hash-with-ivars" - assert_includes yaml_output, "@foo: bar" - else - assert_includes yaml_output, "hash" - end - end end class IWriteMyOwnXML @@ -1184,8 +529,6 @@ class HashExtToParamTests < ActiveSupport::TestCase end class HashToXmlTest < ActiveSupport::TestCase - HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess - def setup @xml_options = { root: :person, skip_instruct: true, indent: 0 } end @@ -1661,61 +1004,6 @@ class HashToXmlTest < ActiveSupport::TestCase assert_equal expected, Hash.from_trusted_xml(':value') end - def test_should_use_default_proc_for_unknown_key - hash_wia = HashWithIndifferentAccess.new { 1 + 2 } - assert_equal 3, hash_wia[:new_key] - end - - def test_should_return_nil_if_no_key_is_supplied - hash_wia = HashWithIndifferentAccess.new { 1 + 2 } - assert_nil hash_wia.default - end - - def test_should_use_default_value_for_unknown_key - hash_wia = HashWithIndifferentAccess.new(3) - assert_equal 3, hash_wia[:new_key] - end - - def test_should_use_default_value_if_no_key_is_supplied - hash_wia = HashWithIndifferentAccess.new(3) - assert_equal 3, hash_wia.default - end - - def test_should_nil_if_no_default_value_is_supplied - hash_wia = HashWithIndifferentAccess.new - assert_nil hash_wia.default - end - - def test_should_return_dup_for_with_indifferent_access - hash_wia = HashWithIndifferentAccess.new - assert_equal hash_wia, hash_wia.with_indifferent_access - assert_not_same hash_wia, hash_wia.with_indifferent_access - end - - def test_allows_setting_frozen_array_values_with_indifferent_access - value = [1, 2, 3].freeze - hash = HashWithIndifferentAccess.new - hash[:key] = value - assert_equal hash[:key], value - end - - def test_should_copy_the_default_value_when_converting_to_hash_with_indifferent_access - hash = Hash.new(3) - hash_wia = hash.with_indifferent_access - assert_equal 3, hash_wia.default - end - - def test_should_copy_the_default_proc_when_converting_to_hash_with_indifferent_access - hash = Hash.new do - 2 + 1 - end - assert_equal 3, hash[:foo] - - hash_wia = hash.with_indifferent_access - assert_equal 3, hash_wia[:foo] - assert_equal 3, hash_wia[:bar] - end - # The XML builder seems to fail miserably when trying to tag something # with the same name as a Kernel method (throw, test, loop, select ...) def test_kernel_method_names_to_xml -- cgit v1.2.3 From 071882e8ef6835cec7eb4e6ff965b99f4563b7aa Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 9 Apr 2017 19:53:31 +0930 Subject: delegate_to_missing doesn't delegate private methods So we shouldn't claim they're there, even when asked explicitly. --- activesupport/test/core_ext/module_test.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index a17438bf4d..6d649f747c 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -356,6 +356,16 @@ class ModuleTest < ActiveSupport::TestCase assert_match(/undefined method `my_fake_method' for/, e.message) end + def test_delegate_to_missing_affects_respond_to + assert DecoratedTester.new(@david).respond_to?(:name) + assert_not DecoratedTester.new(@david).respond_to?(:private_name) + assert_not DecoratedTester.new(@david).respond_to?(:my_fake_method) + + assert DecoratedTester.new(@david).respond_to?(:name, true) + assert_not DecoratedTester.new(@david).respond_to?(:private_name, true) + assert_not DecoratedTester.new(@david).respond_to?(:my_fake_method, true) + end + def test_delegate_with_case event = Event.new(Tester.new) assert_equal 1, event.foo -- cgit v1.2.3 From d928126725c5bc0019f0777e725e6c36f28dcb3e Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 9 Apr 2017 20:07:12 +0930 Subject: delegate_missing_to should fall back to super --- activesupport/test/core_ext/module_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 6d649f747c..085fd6592d 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -70,7 +70,23 @@ Product = Struct.new(:name) do end end +module ExtraMissing + def method_missing(sym, *args) + if sym == :extra_missing + 42 + else + super + end + end + + def respond_to_missing?(sym, priv = false) + sym == :extra_missing || super + end +end + DecoratedTester = Struct.new(:client) do + include ExtraMissing + delegate_missing_to :client end @@ -366,6 +382,12 @@ class ModuleTest < ActiveSupport::TestCase assert_not DecoratedTester.new(@david).respond_to?(:my_fake_method, true) end + def test_delegate_to_missing_respects_superclass_missing + assert_equal 42, DecoratedTester.new(@david).extra_missing + + assert_respond_to DecoratedTester.new(@david), :extra_missing + end + def test_delegate_with_case event = Event.new(Tester.new) assert_equal 1, event.foo -- cgit v1.2.3 From 851b7f866e13518d900407c78dcd6eb477afad06 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Fri, 14 Apr 2017 18:04:13 +0100 Subject: Add additional options to time `change` methods Support `:offset` in `Time#change` and `:zone` or `:offset` in `ActiveSupport::TimeWithZone#change`. Fixes #28723. --- activesupport/test/core_ext/date_time_ext_test.rb | 3 +++ activesupport/test/core_ext/time_ext_test.rb | 7 +++++++ activesupport/test/core_ext/time_with_zone_test.rb | 6 ++++++ 3 files changed, 16 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index 36f0ee22b8..be7c14e9b4 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -166,6 +166,9 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase assert_equal DateTime.civil(2005, 2, 22, 16, 45), DateTime.civil(2005, 2, 22, 15, 15, 10).change(hour: 16, min: 45) assert_equal DateTime.civil(2005, 2, 22, 15, 45), DateTime.civil(2005, 2, 22, 15, 15, 10).change(min: 45) + # datetime with non-zero offset + assert_equal DateTime.civil(2005, 2, 22, 15, 15, 10, Rational(-5, 24)), DateTime.civil(2005, 2, 22, 15, 15, 10, 0).change(offset: Rational(-5, 24)) + # datetime with fractions of a second assert_equal DateTime.civil(2005, 2, 1, 15, 15, 10.7), DateTime.civil(2005, 2, 22, 15, 15, 10.7).change(day: 1) assert_equal DateTime.civil(2005, 1, 2, 11, 22, Rational(33000008, 1000000)), DateTime.civil(2005, 1, 2, 11, 22, 33).change(usec: 8) diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index bd644c8457..625a5bffb8 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -433,6 +433,13 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase assert_raise(ArgumentError) { Time.new(2005, 2, 22, 15, 15, 45, "-08:00").change(nsec: 1000000000) } end + def test_change_offset + assert_equal Time.new(2006, 2, 22, 15, 15, 10, "-08:00"), Time.new(2006, 2, 22, 15, 15, 10, "+01:00").change(offset: "-08:00") + assert_equal Time.new(2006, 2, 22, 15, 15, 10, -28800), Time.new(2006, 2, 22, 15, 15, 10, 3600).change(offset: -28800) + assert_raise(ArgumentError) { Time.new(2005, 2, 22, 15, 15, 45, "+01:00").change(usec: 1000000, offset: "-08:00") } + assert_raise(ArgumentError) { Time.new(2005, 2, 22, 15, 15, 45, "+01:00").change(nsec: 1000000000, offset: -28800) } + end + def test_advance assert_equal Time.local(2006, 2, 28, 15, 15, 10), Time.local(2005, 2, 28, 15, 15, 10).advance(years: 1) assert_equal Time.local(2005, 6, 28, 15, 15, 10), Time.local(2005, 2, 28, 15, 15, 10).advance(months: 4) diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index c3afe68378..70ae793cda 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -625,6 +625,12 @@ class TimeWithZoneTest < ActiveSupport::TestCase assert_equal "Fri, 31 Dec 1999 06:00:00 EST -05:00", @twz.change(hour: 6).inspect assert_equal "Fri, 31 Dec 1999 19:15:00 EST -05:00", @twz.change(min: 15).inspect assert_equal "Fri, 31 Dec 1999 19:00:30 EST -05:00", @twz.change(sec: 30).inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(offset: "-10:00").inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(offset: -36000).inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(zone: "Hawaii").inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(zone: -10).inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(zone: -36000).inspect + assert_equal "Fri, 31 Dec 1999 19:00:00 HST -10:00", @twz.change(zone: "Pacific/Honolulu").inspect end def test_change_at_dst_boundary -- cgit v1.2.3 From 90f851a18b1aca6323c77d21153761e36f864079 Mon Sep 17 00:00:00 2001 From: Eugene Kenny Date: Tue, 25 Apr 2017 07:40:51 -0700 Subject: Remove checks for Enumerator#size method The Enumerator#size method was introduced in Ruby 2.0. These tests were added when Rails 4.1 was current, and Ruby 1.9.3 was still supported. Since Rails 5 only Ruby >= 2.2.2 is supported, so the checks are no longer necessary. --- activesupport/test/core_ext/enumerable_test.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 4f1ab993b8..0b345ecf0f 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -171,10 +171,8 @@ class EnumerableTests < ActiveSupport::TestCase assert_equal({ 5 => Payment.new(5), 15 => Payment.new(15), 10 => Payment.new(10) }, payments.index_by(&:price)) assert_equal Enumerator, payments.index_by.class - if Enumerator.method_defined? :size - assert_nil payments.index_by.size - assert_equal 42, (1..42).index_by.size - end + assert_nil payments.index_by.size + assert_equal 42, (1..42).index_by.size assert_equal({ 5 => Payment.new(5), 15 => Payment.new(15), 10 => Payment.new(10) }, payments.index_by.each(&:price)) end -- cgit v1.2.3 From 170085592604ac9f05e7033bc3000af6683ad494 Mon Sep 17 00:00:00 2001 From: "T.J. Schuck" Date: Thu, 4 May 2017 16:04:32 -0400 Subject: Update test names to match method name The method is named `delegate_missing_to`, not `delegate_to_missing` --- activesupport/test/core_ext/module_test.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 085fd6592d..a4d4444d69 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -348,15 +348,15 @@ class ModuleTest < ActiveSupport::TestCase assert has_block.hello? end - def test_delegate_to_missing_with_method + def test_delegate_missing_to_with_method assert_equal "David", DecoratedTester.new(@david).name end - def test_delegate_to_missing_with_reserved_methods + def test_delegate_missing_to_with_reserved_methods assert_equal "David", DecoratedReserved.new(@david).name end - def test_delegate_to_missing_does_not_delegate_to_private_methods + def test_delegate_missing_to_does_not_delegate_to_private_methods e = assert_raises(NoMethodError) do DecoratedReserved.new(@david).private_name end @@ -364,7 +364,7 @@ class ModuleTest < ActiveSupport::TestCase assert_match(/undefined method `private_name' for/, e.message) end - def test_delegate_to_missing_does_not_delegate_to_fake_methods + def test_delegate_missing_to_does_not_delegate_to_fake_methods e = assert_raises(NoMethodError) do DecoratedReserved.new(@david).my_fake_method end @@ -372,7 +372,7 @@ class ModuleTest < ActiveSupport::TestCase assert_match(/undefined method `my_fake_method' for/, e.message) end - def test_delegate_to_missing_affects_respond_to + def test_delegate_missing_to_affects_respond_to assert DecoratedTester.new(@david).respond_to?(:name) assert_not DecoratedTester.new(@david).respond_to?(:private_name) assert_not DecoratedTester.new(@david).respond_to?(:my_fake_method) @@ -382,7 +382,7 @@ class ModuleTest < ActiveSupport::TestCase assert_not DecoratedTester.new(@david).respond_to?(:my_fake_method, true) end - def test_delegate_to_missing_respects_superclass_missing + def test_delegate_missing_to_respects_superclass_missing assert_equal 42, DecoratedTester.new(@david).extra_missing assert_respond_to DecoratedTester.new(@david), :extra_missing -- cgit v1.2.3 From 28938dd64c8b4fa1943d0b878d3d832b94fa12a3 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sat, 20 May 2017 16:33:09 +0100 Subject: Fix implicit calculations with scalars and durations Previously calculations where the scalar is first would be converted to a duration of seconds but this causes issues with dates being converted to times, e.g: Time.zone = "Beijing" # => Asia/Shanghai date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017 2 * 1.day # => 172800 seconds date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00 Now the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain the part structure of the duration where possible, e.g: Time.zone = "Beijing" # => Asia/Shanghai date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017 2 * 1.day # => 2 days date + 2 * 1.day # => Mon, 22 May 2017 Fixes #29160, #28970. --- activesupport/test/core_ext/duration_test.rb | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 1648a9b270..3108f24f21 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -337,6 +337,13 @@ class DurationTest < ActiveSupport::TestCase assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message end + def test_scalar_plus_parts + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal({ days: 1, seconds: 10 }, (scalar + 1.day).parts) + assert_equal({ days: -1, seconds: 10 }, (scalar + -1.day).parts) + end + def test_scalar_minus scalar = ActiveSupport::Duration::Scalar.new(10) @@ -349,6 +356,9 @@ class DurationTest < ActiveSupport::TestCase assert_equal 5, scalar - 5.seconds assert_instance_of ActiveSupport::Duration, scalar - 5.seconds + assert_equal({ days: -1, seconds: 10 }, (scalar - 1.day).parts) + assert_equal({ days: 1, seconds: 10 }, (scalar - -1.day).parts) + exception = assert_raises(TypeError) do scalar - "foo" end @@ -356,6 +366,13 @@ class DurationTest < ActiveSupport::TestCase assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message end + def test_scalar_minus_parts + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal({ days: -1, seconds: 10 }, (scalar - 1.day).parts) + assert_equal({ days: 1, seconds: 10 }, (scalar - -1.day).parts) + end + def test_scalar_multiply scalar = ActiveSupport::Duration::Scalar.new(5) @@ -375,6 +392,14 @@ class DurationTest < ActiveSupport::TestCase assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message end + def test_scalar_multiply_parts + scalar = ActiveSupport::Duration::Scalar.new(1) + assert_equal({ days: 2 }, (scalar * 2.days).parts) + assert_equal(172800, (scalar * 2.days).value) + assert_equal({ days: -2 }, (scalar * -2.days).parts) + assert_equal(-172800, (scalar * -2.days).value) + end + def test_scalar_divide scalar = ActiveSupport::Duration::Scalar.new(10) @@ -394,6 +419,15 @@ class DurationTest < ActiveSupport::TestCase assert_equal "no implicit conversion of String into ActiveSupport::Duration::Scalar", exception.message end + def test_scalar_divide_parts + scalar = ActiveSupport::Duration::Scalar.new(10) + + assert_equal({ days: 2 }, (scalar / 5.days).parts) + assert_equal(172800, (scalar / 5.days).value) + assert_equal({ days: -2 }, (scalar / -5.days).parts) + assert_equal(-172800, (scalar / -5.days).value) + end + def test_twelve_months_equals_one_year assert_equal 12.months, 1.year end -- cgit v1.2.3 From 1c275d812f35f53f93cd96184a4f319983766cc5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 29 May 2017 18:01:50 +0200 Subject: Add option for class_attribute default (#29270) * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation --- activesupport/test/core_ext/class/attribute_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index 5a9ec78cc1..f16043c612 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -3,7 +3,11 @@ require "active_support/core_ext/class/attribute" class ClassAttributeTest < ActiveSupport::TestCase def setup - @klass = Class.new { class_attribute :setting } + @klass = Class.new do + class_attribute :setting + class_attribute :timeout, default: 5 + end + @sub = Class.new(@klass) end @@ -12,6 +16,10 @@ class ClassAttributeTest < ActiveSupport::TestCase assert_nil @sub.setting end + test "custom default" do + assert_equal 5, @klass.timeout + end + test "inheritable" do @klass.setting = 1 assert_equal 1, @sub.setting -- cgit v1.2.3 From 3fbe657e9b65814b3837fd13628e7a812dc0a0ea Mon Sep 17 00:00:00 2001 From: Shota Iguchi Date: Tue, 30 May 2017 20:13:29 +0900 Subject: Add next occur and previous occurred day of week API (#26600) --- activesupport/test/core_ext/date_time_ext_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index be7c14e9b4..276fa2bfd3 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -28,6 +28,28 @@ class DateTimeExtCalculationsTest < ActiveSupport::TestCase end end + def test_next_occur + datetime = DateTime.new(2016, 9, 24, 0, 0) # saturday + assert_equal datetime.next_occurring(:monday), datetime.since(2.days) + assert_equal datetime.next_occurring(:tuesday), datetime.since(3.days) + assert_equal datetime.next_occurring(:wednesday), datetime.since(4.days) + assert_equal datetime.next_occurring(:thursday), datetime.since(5.days) + assert_equal datetime.next_occurring(:friday), datetime.since(6.days) + assert_equal datetime.next_occurring(:saturday), datetime.since(1.week) + assert_equal datetime.next_occurring(:sunday), datetime.since(1.day) + end + + def test_prev_occur + datetime = DateTime.new(2016, 9, 24, 0, 0) # saturday + assert_equal datetime.prev_occurring(:monday), datetime.ago(5.days) + assert_equal datetime.prev_occurring(:tuesday), datetime.ago(4.days) + assert_equal datetime.prev_occurring(:wednesday), datetime.ago(3.days) + assert_equal datetime.prev_occurring(:thursday), datetime.ago(2.days) + assert_equal datetime.prev_occurring(:friday), datetime.ago(1.day) + assert_equal datetime.prev_occurring(:saturday), datetime.ago(1.week) + assert_equal datetime.prev_occurring(:sunday), datetime.ago(6.days) + end + def test_readable_inspect datetime = DateTime.new(2005, 2, 21, 14, 30, 0) assert_equal "Mon, 21 Feb 2005 14:30:00 +0000", datetime.readable_inspect -- cgit v1.2.3 From a5b0c60714e1e8d8c182af830a26e1c7c884271d Mon Sep 17 00:00:00 2001 From: Genadi Samokovarov Date: Tue, 30 May 2017 16:16:19 +0300 Subject: Implement mattr_acessor :default option --- .../core_ext/module/attribute_accessor_test.rb | 38 +++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index 464a000d59..9b185e9381 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -12,7 +12,14 @@ class ModuleAttributeAccessorTest < ActiveSupport::TestCase cattr_accessor(:defa) { "default_accessor_value" } cattr_reader(:defr) { "default_reader_value" } cattr_writer(:defw) { "default_writer_value" } + cattr_accessor(:deff) { false } cattr_accessor(:quux) { :quux } + + cattr_accessor :def_accessor, default: "default_accessor_value" + cattr_reader :def_reader, default: "default_reader_value" + cattr_writer :def_writer, default: "default_writer_value" + cattr_accessor :def_false, default: false + cattr_accessor(:def_priority, default: false) { :no_priority } end @class = Class.new @class.instance_eval { include m } @@ -24,6 +31,21 @@ class ModuleAttributeAccessorTest < ActiveSupport::TestCase assert_nil @object.foo end + def test_mattr_default_keyword_arguments + assert_equal "default_accessor_value", @module.def_accessor + assert_equal "default_reader_value", @module.def_reader + assert_equal "default_writer_value", @module.class_variable_get(:@@def_writer) + end + + def test_mattr_can_default_to_false + assert_equal false, @module.def_false + assert_equal false, @module.deff + end + + def test_mattr_default_priority + assert_equal false, @module.def_priority + end + def test_should_set_mattr_value @module.foo = :test assert_equal :test, @object.foo @@ -91,9 +113,23 @@ class ModuleAttributeAccessorTest < ActiveSupport::TestCase assert_equal "default_writer_value", @module.class_variable_get("@@defw") end - def test_should_not_invoke_default_value_block_multiple_times + def test_method_invocation_should_not_invoke_the_default_block count = 0 + @module.cattr_accessor(:defcount) { count += 1 } + assert_equal 1, count + assert_no_difference "count" do + @module.defcount + end + end + + def test_declaring_multiple_attributes_at_once_invokes_the_block_multiple_times + count = 0 + + @module.cattr_accessor(:defn1, :defn2) { count += 1 } + + assert_equal 1, @module.defn1 + assert_equal 2, @module.defn2 end end -- cgit v1.2.3 From 036bdee4d5bdad3b3fa1d57ca292214afe746a09 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Mon, 19 Jun 2017 19:03:10 +1000 Subject: Make ActiveSupport frozen string literal friendly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ActiveSupport test suite only passes currently if it uses the latest unreleased commits for dalli, and a patch for Builder: https://github.com/tenderlove/builder/pull/6 Beyond that, all external dependencies (at least, to the extent they’re used by ActiveSupport) are happy, including Nokogiri as of 1.8.0. --- activesupport/test/core_ext/string_ext_test.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index a98951e889..daa8c3f2ef 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -233,7 +233,7 @@ class StringInflectionsTest < ActiveSupport::TestCase def test_string_squish original = %{\u205f\u3000 A string surrounded by various unicode spaces, - with tabs(\t\t), newlines(\n\n), unicode nextlines(\u0085\u0085) and many spaces( ). \u00a0\u2007} + with tabs(\t\t), newlines(\n\n), unicode nextlines(\u0085\u0085) and many spaces( ). \u00a0\u2007}.dup expected = "A string surrounded by various unicode spaces, " \ "with tabs( ), newlines( ), unicode nextlines( ) and many spaces( )." @@ -303,8 +303,8 @@ class StringInflectionsTest < ActiveSupport::TestCase end def test_truncate_multibyte - assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".force_encoding(Encoding::UTF_8), - "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".force_encoding(Encoding::UTF_8).truncate(10) + assert_equal "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 ...".dup.force_encoding(Encoding::UTF_8), + "\354\225\204\353\246\254\353\236\221 \354\225\204\353\246\254 \354\225\204\353\235\274\353\246\254\354\230\244".dup.force_encoding(Encoding::UTF_8).truncate(10) end def test_truncate_should_not_be_html_safe @@ -325,7 +325,7 @@ class StringInflectionsTest < ActiveSupport::TestCase end def test_remove! - original = "This is a very good day to die" + original = "This is a very good day to die".dup assert_equal "This is a good day to die", original.remove!(" very") assert_equal "This is a good day to die", original assert_equal "This is a good day", original.remove!(" to ", /die/) @@ -658,7 +658,7 @@ end class OutputSafetyTest < ActiveSupport::TestCase def setup - @string = "hello" + @string = "hello".dup @object = Class.new(Object) do def to_s "other" @@ -734,7 +734,7 @@ class OutputSafetyTest < ActiveSupport::TestCase end test "Concatting safe onto unsafe yields unsafe" do - @other_string = "other" + @other_string = "other".dup string = @string.html_safe @other_string.concat(string) @@ -757,7 +757,7 @@ class OutputSafetyTest < ActiveSupport::TestCase end test "Concatting safe onto unsafe with << yields unsafe" do - @other_string = "other" + @other_string = "other".dup string = @string.html_safe @other_string << string @@ -813,7 +813,7 @@ class OutputSafetyTest < ActiveSupport::TestCase test "Concatting an integer to safe always yields safe" do string = @string.html_safe string = string.concat(13) - assert_equal "hello".concat(13), string + assert_equal "hello".dup.concat(13), string assert string.html_safe? end @@ -868,7 +868,8 @@ end class StringIndentTest < ActiveSupport::TestCase test "does not indent strings that only contain newlines (edge cases)" do - ["", "\n", "\n" * 7].each do |str| + ["", "\n", "\n" * 7].each do |string| + str = string.dup assert_nil str.indent!(8) assert_equal str, str.indent(8) assert_equal str, str.indent(1, "\t") -- cgit v1.2.3 From 6631bc569f3f5cd5bef764a167ba1c9587d80fb7 Mon Sep 17 00:00:00 2001 From: utilum Date: Tue, 20 Jun 2017 06:49:49 +0200 Subject: prepare for Minitest 6 --- activesupport/test/core_ext/duration_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 3108f24f21..cd1b505c34 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -315,7 +315,7 @@ class DurationTest < ActiveSupport::TestCase assert_equal(1, scalar <=> 5) assert_equal(0, scalar <=> 10) assert_equal(-1, scalar <=> 15) - assert_equal(nil, scalar <=> "foo") + assert_nil(scalar <=> "foo") end def test_scalar_plus -- cgit v1.2.3 From cfade1ec7ee7b5b51f3c1578e3474f9c156f2971 Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Thu, 22 Jun 2017 22:59:18 -0400 Subject: Enforce frozen string in Rubocop --- activesupport/test/core_ext/array/access_test.rb | 1 + activesupport/test/core_ext/array/conversions_test.rb | 1 + activesupport/test/core_ext/array/extract_options_test.rb | 1 + activesupport/test/core_ext/array/grouping_test.rb | 1 + activesupport/test/core_ext/array/prepend_append_test.rb | 1 + activesupport/test/core_ext/array/wrap_test.rb | 1 + activesupport/test/core_ext/bigdecimal_test.rb | 1 + activesupport/test/core_ext/class/attribute_test.rb | 1 + activesupport/test/core_ext/class_test.rb | 1 + activesupport/test/core_ext/date_and_time_behavior.rb | 1 + activesupport/test/core_ext/date_and_time_compatibility_test.rb | 1 + activesupport/test/core_ext/date_ext_test.rb | 1 + activesupport/test/core_ext/date_time_ext_test.rb | 1 + activesupport/test/core_ext/digest/uuid_test.rb | 1 + activesupport/test/core_ext/duration_test.rb | 1 + activesupport/test/core_ext/enumerable_test.rb | 1 + activesupport/test/core_ext/file_test.rb | 1 + activesupport/test/core_ext/hash/transform_keys_test.rb | 1 + activesupport/test/core_ext/hash/transform_values_test.rb | 1 + activesupport/test/core_ext/hash_ext_test.rb | 1 + activesupport/test/core_ext/integer_ext_test.rb | 1 + activesupport/test/core_ext/kernel/concern_test.rb | 1 + activesupport/test/core_ext/kernel_test.rb | 1 + activesupport/test/core_ext/load_error_test.rb | 1 + activesupport/test/core_ext/marshal_test.rb | 1 + activesupport/test/core_ext/module/anonymous_test.rb | 1 + activesupport/test/core_ext/module/attr_internal_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_test.rb | 1 + activesupport/test/core_ext/module/attribute_aliasing_test.rb | 1 + activesupport/test/core_ext/module/concerning_test.rb | 1 + activesupport/test/core_ext/module/introspection_test.rb | 1 + activesupport/test/core_ext/module/reachable_test.rb | 1 + activesupport/test/core_ext/module/remove_method_test.rb | 1 + activesupport/test/core_ext/module_test.rb | 1 + activesupport/test/core_ext/name_error_test.rb | 1 + activesupport/test/core_ext/numeric_ext_test.rb | 1 + activesupport/test/core_ext/object/acts_like_test.rb | 1 + activesupport/test/core_ext/object/blank_test.rb | 1 + activesupport/test/core_ext/object/deep_dup_test.rb | 1 + activesupport/test/core_ext/object/duplicable_test.rb | 1 + activesupport/test/core_ext/object/inclusion_test.rb | 1 + activesupport/test/core_ext/object/instance_variables_test.rb | 1 + activesupport/test/core_ext/object/json_cherry_pick_test.rb | 1 + activesupport/test/core_ext/object/json_gem_encoding_test.rb | 1 + activesupport/test/core_ext/object/to_param_test.rb | 1 + activesupport/test/core_ext/object/to_query_test.rb | 1 + activesupport/test/core_ext/object/try_test.rb | 1 + activesupport/test/core_ext/range_ext_test.rb | 1 + activesupport/test/core_ext/regexp_ext_test.rb | 1 + activesupport/test/core_ext/secure_random_test.rb | 1 + activesupport/test/core_ext/string_ext_test.rb | 1 + activesupport/test/core_ext/time_ext_test.rb | 1 + activesupport/test/core_ext/time_with_zone_test.rb | 1 + activesupport/test/core_ext/uri_ext_test.rb | 1 + 55 files changed, 55 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb index a38ea36d00..08af9e1b55 100644 --- a/activesupport/test/core_ext/array/access_test.rb +++ b/activesupport/test/core_ext/array/access_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/conversions_test.rb b/activesupport/test/core_ext/array/conversions_test.rb index 29e661a99b..33d051c514 100644 --- a/activesupport/test/core_ext/array/conversions_test.rb +++ b/activesupport/test/core_ext/array/conversions_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/array/extract_options_test.rb b/activesupport/test/core_ext/array/extract_options_test.rb index 1651bee0f6..09bf97ae6c 100644 --- a/activesupport/test/core_ext/array/extract_options_test.rb +++ b/activesupport/test/core_ext/array/extract_options_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/hash" diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb index 4c6aadba8c..daf47e9a9f 100644 --- a/activesupport/test/core_ext/array/grouping_test.rb +++ b/activesupport/test/core_ext/array/grouping_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/prepend_append_test.rb b/activesupport/test/core_ext/array/prepend_append_test.rb index 763e26191d..3b38acf56c 100644 --- a/activesupport/test/core_ext/array/prepend_append_test.rb +++ b/activesupport/test/core_ext/array/prepend_append_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/wrap_test.rb b/activesupport/test/core_ext/array/wrap_test.rb index ae846cb3f2..451f9db2ed 100644 --- a/activesupport/test/core_ext/array/wrap_test.rb +++ b/activesupport/test/core_ext/array/wrap_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb index 43b659546f..dbd0762574 100644 --- a/activesupport/test/core_ext/bigdecimal_test.rb +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index f16043c612..2933b62c58 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class/attribute" diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index a7905196ae..c0cabea8fd 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/activesupport/test/core_ext/class_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class" require "set" diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb index 6c77e8f313..8d908968ef 100644 --- a/activesupport/test/core_ext/date_and_time_behavior.rb +++ b/activesupport/test/core_ext/date_and_time_behavior.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module DateAndTimeBehavior diff --git a/activesupport/test/core_ext/date_and_time_compatibility_test.rb b/activesupport/test/core_ext/date_and_time_compatibility_test.rb index 6c6205a4d2..04b93105d5 100644 --- a/activesupport/test/core_ext/date_and_time_compatibility_test.rb +++ b/activesupport/test/core_ext/date_and_time_compatibility_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index 50bb1004f7..7c6e705936 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index 276fa2bfd3..beddfe4584 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/digest/uuid_test.rb b/activesupport/test/core_ext/digest/uuid_test.rb index 866a03259a..ea3605bf9c 100644 --- a/activesupport/test/core_ext/digest/uuid_test.rb +++ b/activesupport/test/core_ext/digest/uuid_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/digest/uuid" diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index cd1b505c34..32c0ce4317 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/inflector" require "active_support/time" diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 0b345ecf0f..3259109b0e 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/enumerable" diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb index df5d09acd0..67b1a04429 100644 --- a/activesupport/test/core_ext/file_test.rb +++ b/activesupport/test/core_ext/file_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/file" diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb index 7a11d827f8..f329246bdd 100644 --- a/activesupport/test/core_ext/hash/transform_keys_test.rb +++ b/activesupport/test/core_ext/hash/transform_keys_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/keys" diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb index f2ac4ce6ce..4eb6999510 100644 --- a/activesupport/test/core_ext/hash/transform_values_test.rb +++ b/activesupport/test/core_ext/hash/transform_values_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/transform_values" diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 18da5fcf5f..c533c002a4 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index 137e8ce85f..a7ea084e7f 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/integer" diff --git a/activesupport/test/core_ext/kernel/concern_test.rb b/activesupport/test/core_ext/kernel/concern_test.rb index e7e4f99d7e..1f4fb8029c 100644 --- a/activesupport/test/core_ext/kernel/concern_test.rb +++ b/activesupport/test/core_ext/kernel/concern_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel/concern" diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 26f5088ede..875598f611 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel" diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 44ff6bb051..3d003fd1d5 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/load_error" diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb index cabeed2fae..d17a6fe7f1 100644 --- a/activesupport/test/core_ext/marshal_test.rb +++ b/activesupport/test/core_ext/marshal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/marshal" require "dependencies_test_helpers" diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb index f885444284..d667bc0a34 100644 --- a/activesupport/test/core_ext/module/anonymous_test.rb +++ b/activesupport/test/core_ext/module/anonymous_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/anonymous" diff --git a/activesupport/test/core_ext/module/attr_internal_test.rb b/activesupport/test/core_ext/module/attr_internal_test.rb index 8458e278ee..12dc2f101a 100644 --- a/activesupport/test/core_ext/module/attr_internal_test.rb +++ b/activesupport/test/core_ext/module/attr_internal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attr_internal" diff --git a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb index af240bc38d..e8587e3424 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors_per_thread" diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index 9b185e9381..2cf33fcc12 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors" diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb index fdfa868851..9e5edda77a 100644 --- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb +++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/aliasing" diff --git a/activesupport/test/core_ext/module/concerning_test.rb b/activesupport/test/core_ext/module/concerning_test.rb index 098036828a..64accc06fc 100644 --- a/activesupport/test/core_ext/module/concerning_test.rb +++ b/activesupport/test/core_ext/module/concerning_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/concerning" diff --git a/activesupport/test/core_ext/module/introspection_test.rb b/activesupport/test/core_ext/module/introspection_test.rb index db383850cd..589c9455ed 100644 --- a/activesupport/test/core_ext/module/introspection_test.rb +++ b/activesupport/test/core_ext/module/introspection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/introspection" diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb index 487c7dee16..f8970bc9f4 100644 --- a/activesupport/test/core_ext/module/reachable_test.rb +++ b/activesupport/test/core_ext/module/reachable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/reachable" diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 0c627f1e74..327c66e3ec 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/remove_method" diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index a4d4444d69..b683c4e110 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module" diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index fdb9493d3c..a99b20602d 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/name_error" diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index 3cfbe6e7e6..d4e03a90a4 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/object/acts_like_test.rb b/activesupport/test/core_ext/object/acts_like_test.rb index 631f4e63a8..1f1b71f748 100644 --- a/activesupport/test/core_ext/object/acts_like_test.rb +++ b/activesupport/test/core_ext/object/acts_like_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/blank_test.rb b/activesupport/test/core_ext/object/blank_test.rb index 7fd3fed042..fbd96893f6 100644 --- a/activesupport/test/core_ext/object/blank_test.rb +++ b/activesupport/test/core_ext/object/blank_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/blank" diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index f247ee16de..d6f0a71c5b 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index 68b0129980..7607e98b0c 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "bigdecimal" require "active_support/core_ext/object/duplicable" diff --git a/activesupport/test/core_ext/object/inclusion_test.rb b/activesupport/test/core_ext/object/inclusion_test.rb index 955686d6aa..b706e6b90f 100644 --- a/activesupport/test/core_ext/object/inclusion_test.rb +++ b/activesupport/test/core_ext/object/inclusion_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/inclusion" diff --git a/activesupport/test/core_ext/object/instance_variables_test.rb b/activesupport/test/core_ext/object/instance_variables_test.rb index 5bdb2fbc35..df38282fb0 100644 --- a/activesupport/test/core_ext/object/instance_variables_test.rb +++ b/activesupport/test/core_ext/object/instance_variables_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/json_cherry_pick_test.rb b/activesupport/test/core_ext/object/json_cherry_pick_test.rb index dd4e90918e..9f3f92a74b 100644 --- a/activesupport/test/core_ext/object/json_cherry_pick_test.rb +++ b/activesupport/test/core_ext/object/json_cherry_pick_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" # These test cases were added to test that cherry-picking the json extensions diff --git a/activesupport/test/core_ext/object/json_gem_encoding_test.rb b/activesupport/test/core_ext/object/json_gem_encoding_test.rb index f5016d0c2a..3ff34e448e 100644 --- a/activesupport/test/core_ext/object/json_gem_encoding_test.rb +++ b/activesupport/test/core_ext/object/json_gem_encoding_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "json" require "json/encoding_test_cases" diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb index 56246b24f3..e446092abe 100644 --- a/activesupport/test/core_ext/object/to_param_test.rb +++ b/activesupport/test/core_ext/object/to_param_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/to_param" diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 298c8bf373..44147d47cf 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/ordered_hash" require "active_support/core_ext/object/to_query" diff --git a/activesupport/test/core_ext/object/try_test.rb b/activesupport/test/core_ext/object/try_test.rb index 5c8bf59952..fe437f6260 100644 --- a/activesupport/test/core_ext/object/try_test.rb +++ b/activesupport/test/core_ext/object/try_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index d166c7309c..693de2755d 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index e569a9f234..c937dad1db 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/regexp" diff --git a/activesupport/test/core_ext/secure_random_test.rb b/activesupport/test/core_ext/secure_random_test.rb index fc25f6ab41..b2ac4640ab 100644 --- a/activesupport/test/core_ext/secure_random_test.rb +++ b/activesupport/test/core_ext/secure_random_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/securerandom" diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index a98951e889..ed5854b8ff 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "date" require "abstract_unit" require "timeout" diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 625a5bffb8..f1c6fa4f8c 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 70ae793cda..9401b9be07 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 0f13ca9c0e..555716d1c3 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "uri" require "active_support/core_ext/uri" -- cgit v1.2.3 From 87b3e226d65ac1ed371620bfdcd2f950c87cfece Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Sun, 2 Jul 2017 02:15:17 +0930 Subject: Revert "Merge pull request #29540 from kirs/rubocop-frozen-string" This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa. --- activesupport/test/core_ext/array/access_test.rb | 1 - activesupport/test/core_ext/array/conversions_test.rb | 1 - activesupport/test/core_ext/array/extract_options_test.rb | 1 - activesupport/test/core_ext/array/grouping_test.rb | 1 - activesupport/test/core_ext/array/prepend_append_test.rb | 1 - activesupport/test/core_ext/array/wrap_test.rb | 1 - activesupport/test/core_ext/bigdecimal_test.rb | 1 - activesupport/test/core_ext/class/attribute_test.rb | 1 - activesupport/test/core_ext/class_test.rb | 1 - activesupport/test/core_ext/date_and_time_behavior.rb | 1 - activesupport/test/core_ext/date_and_time_compatibility_test.rb | 1 - activesupport/test/core_ext/date_ext_test.rb | 1 - activesupport/test/core_ext/date_time_ext_test.rb | 1 - activesupport/test/core_ext/digest/uuid_test.rb | 1 - activesupport/test/core_ext/duration_test.rb | 1 - activesupport/test/core_ext/enumerable_test.rb | 1 - activesupport/test/core_ext/file_test.rb | 1 - activesupport/test/core_ext/hash/transform_keys_test.rb | 1 - activesupport/test/core_ext/hash/transform_values_test.rb | 1 - activesupport/test/core_ext/hash_ext_test.rb | 1 - activesupport/test/core_ext/integer_ext_test.rb | 1 - activesupport/test/core_ext/kernel/concern_test.rb | 1 - activesupport/test/core_ext/kernel_test.rb | 1 - activesupport/test/core_ext/load_error_test.rb | 1 - activesupport/test/core_ext/marshal_test.rb | 1 - activesupport/test/core_ext/module/anonymous_test.rb | 1 - activesupport/test/core_ext/module/attr_internal_test.rb | 1 - activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb | 1 - activesupport/test/core_ext/module/attribute_accessor_test.rb | 1 - activesupport/test/core_ext/module/attribute_aliasing_test.rb | 1 - activesupport/test/core_ext/module/concerning_test.rb | 1 - activesupport/test/core_ext/module/introspection_test.rb | 1 - activesupport/test/core_ext/module/reachable_test.rb | 1 - activesupport/test/core_ext/module/remove_method_test.rb | 1 - activesupport/test/core_ext/module_test.rb | 1 - activesupport/test/core_ext/name_error_test.rb | 1 - activesupport/test/core_ext/numeric_ext_test.rb | 1 - activesupport/test/core_ext/object/acts_like_test.rb | 1 - activesupport/test/core_ext/object/blank_test.rb | 1 - activesupport/test/core_ext/object/deep_dup_test.rb | 1 - activesupport/test/core_ext/object/duplicable_test.rb | 1 - activesupport/test/core_ext/object/inclusion_test.rb | 1 - activesupport/test/core_ext/object/instance_variables_test.rb | 1 - activesupport/test/core_ext/object/json_cherry_pick_test.rb | 1 - activesupport/test/core_ext/object/json_gem_encoding_test.rb | 1 - activesupport/test/core_ext/object/to_param_test.rb | 1 - activesupport/test/core_ext/object/to_query_test.rb | 1 - activesupport/test/core_ext/object/try_test.rb | 1 - activesupport/test/core_ext/range_ext_test.rb | 1 - activesupport/test/core_ext/regexp_ext_test.rb | 1 - activesupport/test/core_ext/secure_random_test.rb | 1 - activesupport/test/core_ext/string_ext_test.rb | 1 - activesupport/test/core_ext/time_ext_test.rb | 1 - activesupport/test/core_ext/time_with_zone_test.rb | 1 - activesupport/test/core_ext/uri_ext_test.rb | 1 - 55 files changed, 55 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb index 08af9e1b55..a38ea36d00 100644 --- a/activesupport/test/core_ext/array/access_test.rb +++ b/activesupport/test/core_ext/array/access_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/conversions_test.rb b/activesupport/test/core_ext/array/conversions_test.rb index 33d051c514..29e661a99b 100644 --- a/activesupport/test/core_ext/array/conversions_test.rb +++ b/activesupport/test/core_ext/array/conversions_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/array/extract_options_test.rb b/activesupport/test/core_ext/array/extract_options_test.rb index 09bf97ae6c..1651bee0f6 100644 --- a/activesupport/test/core_ext/array/extract_options_test.rb +++ b/activesupport/test/core_ext/array/extract_options_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/hash" diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb index daf47e9a9f..4c6aadba8c 100644 --- a/activesupport/test/core_ext/array/grouping_test.rb +++ b/activesupport/test/core_ext/array/grouping_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/prepend_append_test.rb b/activesupport/test/core_ext/array/prepend_append_test.rb index 3b38acf56c..763e26191d 100644 --- a/activesupport/test/core_ext/array/prepend_append_test.rb +++ b/activesupport/test/core_ext/array/prepend_append_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/wrap_test.rb b/activesupport/test/core_ext/array/wrap_test.rb index 451f9db2ed..ae846cb3f2 100644 --- a/activesupport/test/core_ext/array/wrap_test.rb +++ b/activesupport/test/core_ext/array/wrap_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb index dbd0762574..43b659546f 100644 --- a/activesupport/test/core_ext/bigdecimal_test.rb +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index 2933b62c58..f16043c612 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class/attribute" diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index c0cabea8fd..a7905196ae 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/activesupport/test/core_ext/class_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class" require "set" diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb index 8d908968ef..6c77e8f313 100644 --- a/activesupport/test/core_ext/date_and_time_behavior.rb +++ b/activesupport/test/core_ext/date_and_time_behavior.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" module DateAndTimeBehavior diff --git a/activesupport/test/core_ext/date_and_time_compatibility_test.rb b/activesupport/test/core_ext/date_and_time_compatibility_test.rb index 04b93105d5..6c6205a4d2 100644 --- a/activesupport/test/core_ext/date_and_time_compatibility_test.rb +++ b/activesupport/test/core_ext/date_and_time_compatibility_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index 7c6e705936..50bb1004f7 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index beddfe4584..276fa2bfd3 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/digest/uuid_test.rb b/activesupport/test/core_ext/digest/uuid_test.rb index ea3605bf9c..866a03259a 100644 --- a/activesupport/test/core_ext/digest/uuid_test.rb +++ b/activesupport/test/core_ext/digest/uuid_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/digest/uuid" diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 32c0ce4317..cd1b505c34 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/inflector" require "active_support/time" diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 3259109b0e..0b345ecf0f 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/enumerable" diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb index 67b1a04429..df5d09acd0 100644 --- a/activesupport/test/core_ext/file_test.rb +++ b/activesupport/test/core_ext/file_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/file" diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb index f329246bdd..7a11d827f8 100644 --- a/activesupport/test/core_ext/hash/transform_keys_test.rb +++ b/activesupport/test/core_ext/hash/transform_keys_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/keys" diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb index 4eb6999510..f2ac4ce6ce 100644 --- a/activesupport/test/core_ext/hash/transform_values_test.rb +++ b/activesupport/test/core_ext/hash/transform_values_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/transform_values" diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index c533c002a4..18da5fcf5f 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index a7ea084e7f..137e8ce85f 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/integer" diff --git a/activesupport/test/core_ext/kernel/concern_test.rb b/activesupport/test/core_ext/kernel/concern_test.rb index 1f4fb8029c..e7e4f99d7e 100644 --- a/activesupport/test/core_ext/kernel/concern_test.rb +++ b/activesupport/test/core_ext/kernel/concern_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel/concern" diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 875598f611..26f5088ede 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel" diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 3d003fd1d5..44ff6bb051 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/load_error" diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb index d17a6fe7f1..cabeed2fae 100644 --- a/activesupport/test/core_ext/marshal_test.rb +++ b/activesupport/test/core_ext/marshal_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/marshal" require "dependencies_test_helpers" diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb index d667bc0a34..f885444284 100644 --- a/activesupport/test/core_ext/module/anonymous_test.rb +++ b/activesupport/test/core_ext/module/anonymous_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/anonymous" diff --git a/activesupport/test/core_ext/module/attr_internal_test.rb b/activesupport/test/core_ext/module/attr_internal_test.rb index 12dc2f101a..8458e278ee 100644 --- a/activesupport/test/core_ext/module/attr_internal_test.rb +++ b/activesupport/test/core_ext/module/attr_internal_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attr_internal" diff --git a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb index e8587e3424..af240bc38d 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors_per_thread" diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index 2cf33fcc12..9b185e9381 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors" diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb index 9e5edda77a..fdfa868851 100644 --- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb +++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/aliasing" diff --git a/activesupport/test/core_ext/module/concerning_test.rb b/activesupport/test/core_ext/module/concerning_test.rb index 64accc06fc..098036828a 100644 --- a/activesupport/test/core_ext/module/concerning_test.rb +++ b/activesupport/test/core_ext/module/concerning_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/concerning" diff --git a/activesupport/test/core_ext/module/introspection_test.rb b/activesupport/test/core_ext/module/introspection_test.rb index 589c9455ed..db383850cd 100644 --- a/activesupport/test/core_ext/module/introspection_test.rb +++ b/activesupport/test/core_ext/module/introspection_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/introspection" diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb index f8970bc9f4..487c7dee16 100644 --- a/activesupport/test/core_ext/module/reachable_test.rb +++ b/activesupport/test/core_ext/module/reachable_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/reachable" diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 327c66e3ec..0c627f1e74 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/remove_method" diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index b683c4e110..a4d4444d69 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module" diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index a99b20602d..fdb9493d3c 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/name_error" diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index d4e03a90a4..3cfbe6e7e6 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/object/acts_like_test.rb b/activesupport/test/core_ext/object/acts_like_test.rb index 1f1b71f748..631f4e63a8 100644 --- a/activesupport/test/core_ext/object/acts_like_test.rb +++ b/activesupport/test/core_ext/object/acts_like_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/blank_test.rb b/activesupport/test/core_ext/object/blank_test.rb index fbd96893f6..7fd3fed042 100644 --- a/activesupport/test/core_ext/object/blank_test.rb +++ b/activesupport/test/core_ext/object/blank_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/blank" diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index d6f0a71c5b..f247ee16de 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index 7607e98b0c..68b0129980 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "bigdecimal" require "active_support/core_ext/object/duplicable" diff --git a/activesupport/test/core_ext/object/inclusion_test.rb b/activesupport/test/core_ext/object/inclusion_test.rb index b706e6b90f..955686d6aa 100644 --- a/activesupport/test/core_ext/object/inclusion_test.rb +++ b/activesupport/test/core_ext/object/inclusion_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/inclusion" diff --git a/activesupport/test/core_ext/object/instance_variables_test.rb b/activesupport/test/core_ext/object/instance_variables_test.rb index df38282fb0..5bdb2fbc35 100644 --- a/activesupport/test/core_ext/object/instance_variables_test.rb +++ b/activesupport/test/core_ext/object/instance_variables_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/json_cherry_pick_test.rb b/activesupport/test/core_ext/object/json_cherry_pick_test.rb index 9f3f92a74b..dd4e90918e 100644 --- a/activesupport/test/core_ext/object/json_cherry_pick_test.rb +++ b/activesupport/test/core_ext/object/json_cherry_pick_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" # These test cases were added to test that cherry-picking the json extensions diff --git a/activesupport/test/core_ext/object/json_gem_encoding_test.rb b/activesupport/test/core_ext/object/json_gem_encoding_test.rb index 3ff34e448e..f5016d0c2a 100644 --- a/activesupport/test/core_ext/object/json_gem_encoding_test.rb +++ b/activesupport/test/core_ext/object/json_gem_encoding_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "json" require "json/encoding_test_cases" diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb index e446092abe..56246b24f3 100644 --- a/activesupport/test/core_ext/object/to_param_test.rb +++ b/activesupport/test/core_ext/object/to_param_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/to_param" diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 44147d47cf..298c8bf373 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/ordered_hash" require "active_support/core_ext/object/to_query" diff --git a/activesupport/test/core_ext/object/try_test.rb b/activesupport/test/core_ext/object/try_test.rb index fe437f6260..5c8bf59952 100644 --- a/activesupport/test/core_ext/object/try_test.rb +++ b/activesupport/test/core_ext/object/try_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index 693de2755d..d166c7309c 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index c937dad1db..e569a9f234 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/regexp" diff --git a/activesupport/test/core_ext/secure_random_test.rb b/activesupport/test/core_ext/secure_random_test.rb index b2ac4640ab..fc25f6ab41 100644 --- a/activesupport/test/core_ext/secure_random_test.rb +++ b/activesupport/test/core_ext/secure_random_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/securerandom" diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index defec8bba0..daa8c3f2ef 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "date" require "abstract_unit" require "timeout" diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index f1c6fa4f8c..625a5bffb8 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 9401b9be07..70ae793cda 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 555716d1c3..0f13ca9c0e 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -1,4 +1,3 @@ -# frozen_string_literal: true require "abstract_unit" require "uri" require "active_support/core_ext/uri" -- cgit v1.2.3 From 6642b112cd7cbff690a003db9e4fb0704e659b6d Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 2 Jul 2017 22:47:11 +0900 Subject: Expectation first --- activesupport/test/core_ext/array/conversions_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array/conversions_test.rb b/activesupport/test/core_ext/array/conversions_test.rb index 29e661a99b..bbe81ae70c 100644 --- a/activesupport/test/core_ext/array/conversions_test.rb +++ b/activesupport/test/core_ext/array/conversions_test.rb @@ -58,7 +58,7 @@ class ToSentenceTest < ActiveSupport::TestCase ["one", "two"].to_sentence(passing: "invalid option") end - assert_equal exception.message, "Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale" + assert_equal "Unknown key: :passing. Valid keys are: :words_connector, :two_words_connector, :last_word_connector, :locale", exception.message end def test_always_returns_string -- cgit v1.2.3 From 8eea74c965b0f66eac3848f1eaaf495d5dc1092e Mon Sep 17 00:00:00 2001 From: Krzysztof Zych Date: Wed, 5 Jul 2017 15:38:54 +0200 Subject: Use `map` in `delegate` so that actual prefixed method names are returned, if using prefix version. --- activesupport/test/core_ext/module_test.rb | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index a4d4444d69..14e166351a 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -392,4 +392,43 @@ class ModuleTest < ActiveSupport::TestCase event = Event.new(Tester.new) assert_equal 1, event.foo end + + def test_private_delegate + location = Class.new do + def initialize(place) + @place = place + end + + private *delegate(:street, :city, to: :@place) + end + + place = location.new(Somewhere.new("Such street", "Sad city")) + + assert_not place.respond_to?(:street) + assert_not place.respond_to?(:city) + + assert place.respond_to?(:street, true) # Asking for private method + assert place.respond_to?(:city, true) + end + + def test_private_delegate_prefixed + location = Class.new do + def initialize(place) + @place = place + end + + private *delegate(:street, :city, to: :@place, prefix: :the) + end + + place = location.new(Somewhere.new("Such street", "Sad city")) + + assert_not place.respond_to?(:street) + assert_not place.respond_to?(:city) + + + assert_not place.respond_to?(:the_street) + assert place.respond_to?(:the_street, true) + assert_not place.respond_to?(:the_city) + assert place.respond_to?(:the_city, true) + end end -- cgit v1.2.3 From 6bb115a6617b320b8ff13a4561ddf8d1a9b44f82 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Thu, 6 Jul 2017 00:16:19 +0900 Subject: Fix warning: `*' interpreted as argument prefix ``` /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:402: warning: `*' interpreted as argument prefix /Users/kamipo/src/github.com/rails/rails/activesupport/test/core_ext/module_test.rb:420: warning: `*' interpreted as argument prefix ``` --- activesupport/test/core_ext/module_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index cba60ef013..68bd5233bf 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -399,7 +399,7 @@ class ModuleTest < ActiveSupport::TestCase @place = place end - private *delegate(:street, :city, to: :@place) + private(*delegate(:street, :city, to: :@place)) end place = location.new(Somewhere.new("Such street", "Sad city")) @@ -417,7 +417,7 @@ class ModuleTest < ActiveSupport::TestCase @place = place end - private *delegate(:street, :city, to: :@place, prefix: :the) + private(*delegate(:street, :city, to: :@place, prefix: :the)) end place = location.new(Somewhere.new("Such street", "Sad city")) -- cgit v1.2.3 From 72950568dde05bfe8a69ce4bbf6338fdebf3062f Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Sun, 9 Jul 2017 15:06:36 +0300 Subject: Use frozen-string-literal in ActiveSupport --- activesupport/test/core_ext/array/access_test.rb | 1 + activesupport/test/core_ext/array/conversions_test.rb | 1 + activesupport/test/core_ext/array/extract_options_test.rb | 1 + activesupport/test/core_ext/array/grouping_test.rb | 1 + activesupport/test/core_ext/array/prepend_append_test.rb | 1 + activesupport/test/core_ext/array/wrap_test.rb | 1 + activesupport/test/core_ext/bigdecimal_test.rb | 1 + activesupport/test/core_ext/class/attribute_test.rb | 1 + activesupport/test/core_ext/class_test.rb | 1 + activesupport/test/core_ext/date_and_time_behavior.rb | 1 + activesupport/test/core_ext/date_and_time_compatibility_test.rb | 1 + activesupport/test/core_ext/date_ext_test.rb | 1 + activesupport/test/core_ext/date_time_ext_test.rb | 1 + activesupport/test/core_ext/digest/uuid_test.rb | 1 + activesupport/test/core_ext/duration_test.rb | 1 + activesupport/test/core_ext/enumerable_test.rb | 1 + activesupport/test/core_ext/file_test.rb | 1 + activesupport/test/core_ext/hash/transform_keys_test.rb | 1 + activesupport/test/core_ext/hash/transform_values_test.rb | 1 + activesupport/test/core_ext/hash_ext_test.rb | 1 + activesupport/test/core_ext/integer_ext_test.rb | 1 + activesupport/test/core_ext/kernel/concern_test.rb | 1 + activesupport/test/core_ext/kernel_test.rb | 1 + activesupport/test/core_ext/load_error_test.rb | 1 + activesupport/test/core_ext/marshal_test.rb | 1 + activesupport/test/core_ext/module/anonymous_test.rb | 1 + activesupport/test/core_ext/module/attr_internal_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_test.rb | 1 + activesupport/test/core_ext/module/attribute_aliasing_test.rb | 1 + activesupport/test/core_ext/module/concerning_test.rb | 1 + activesupport/test/core_ext/module/introspection_test.rb | 1 + activesupport/test/core_ext/module/reachable_test.rb | 1 + activesupport/test/core_ext/module/remove_method_test.rb | 1 + activesupport/test/core_ext/module_test.rb | 1 + activesupport/test/core_ext/name_error_test.rb | 1 + activesupport/test/core_ext/numeric_ext_test.rb | 1 + activesupport/test/core_ext/object/acts_like_test.rb | 1 + activesupport/test/core_ext/object/blank_test.rb | 1 + activesupport/test/core_ext/object/deep_dup_test.rb | 1 + activesupport/test/core_ext/object/duplicable_test.rb | 1 + activesupport/test/core_ext/object/inclusion_test.rb | 1 + activesupport/test/core_ext/object/instance_variables_test.rb | 1 + activesupport/test/core_ext/object/json_cherry_pick_test.rb | 1 + activesupport/test/core_ext/object/json_gem_encoding_test.rb | 1 + activesupport/test/core_ext/object/to_param_test.rb | 1 + activesupport/test/core_ext/object/to_query_test.rb | 1 + activesupport/test/core_ext/object/try_test.rb | 1 + activesupport/test/core_ext/range_ext_test.rb | 1 + activesupport/test/core_ext/regexp_ext_test.rb | 1 + activesupport/test/core_ext/secure_random_test.rb | 1 + activesupport/test/core_ext/string_ext_test.rb | 1 + activesupport/test/core_ext/time_ext_test.rb | 1 + activesupport/test/core_ext/time_with_zone_test.rb | 1 + activesupport/test/core_ext/uri_ext_test.rb | 1 + 55 files changed, 55 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb index a38ea36d00..08af9e1b55 100644 --- a/activesupport/test/core_ext/array/access_test.rb +++ b/activesupport/test/core_ext/array/access_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/conversions_test.rb b/activesupport/test/core_ext/array/conversions_test.rb index bbe81ae70c..5a073344d9 100644 --- a/activesupport/test/core_ext/array/conversions_test.rb +++ b/activesupport/test/core_ext/array/conversions_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/array/extract_options_test.rb b/activesupport/test/core_ext/array/extract_options_test.rb index 1651bee0f6..09bf97ae6c 100644 --- a/activesupport/test/core_ext/array/extract_options_test.rb +++ b/activesupport/test/core_ext/array/extract_options_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/hash" diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb index 4c6aadba8c..daf47e9a9f 100644 --- a/activesupport/test/core_ext/array/grouping_test.rb +++ b/activesupport/test/core_ext/array/grouping_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/prepend_append_test.rb b/activesupport/test/core_ext/array/prepend_append_test.rb index 763e26191d..3b38acf56c 100644 --- a/activesupport/test/core_ext/array/prepend_append_test.rb +++ b/activesupport/test/core_ext/array/prepend_append_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/wrap_test.rb b/activesupport/test/core_ext/array/wrap_test.rb index ae846cb3f2..451f9db2ed 100644 --- a/activesupport/test/core_ext/array/wrap_test.rb +++ b/activesupport/test/core_ext/array/wrap_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb index 43b659546f..dbd0762574 100644 --- a/activesupport/test/core_ext/bigdecimal_test.rb +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index f16043c612..2933b62c58 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class/attribute" diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index a7905196ae..c0cabea8fd 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/activesupport/test/core_ext/class_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/class" require "set" diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb index 6c77e8f313..8d908968ef 100644 --- a/activesupport/test/core_ext/date_and_time_behavior.rb +++ b/activesupport/test/core_ext/date_and_time_behavior.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module DateAndTimeBehavior diff --git a/activesupport/test/core_ext/date_and_time_compatibility_test.rb b/activesupport/test/core_ext/date_and_time_compatibility_test.rb index 6c6205a4d2..04b93105d5 100644 --- a/activesupport/test/core_ext/date_and_time_compatibility_test.rb +++ b/activesupport/test/core_ext/date_and_time_compatibility_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index 50bb1004f7..7c6e705936 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index 276fa2bfd3..beddfe4584 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/digest/uuid_test.rb b/activesupport/test/core_ext/digest/uuid_test.rb index 866a03259a..ea3605bf9c 100644 --- a/activesupport/test/core_ext/digest/uuid_test.rb +++ b/activesupport/test/core_ext/digest/uuid_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/digest/uuid" diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index cd1b505c34..32c0ce4317 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/inflector" require "active_support/time" diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 0b345ecf0f..3259109b0e 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/enumerable" diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb index df5d09acd0..67b1a04429 100644 --- a/activesupport/test/core_ext/file_test.rb +++ b/activesupport/test/core_ext/file_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/file" diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb index 7a11d827f8..f329246bdd 100644 --- a/activesupport/test/core_ext/hash/transform_keys_test.rb +++ b/activesupport/test/core_ext/hash/transform_keys_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/keys" diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb index f2ac4ce6ce..4eb6999510 100644 --- a/activesupport/test/core_ext/hash/transform_values_test.rb +++ b/activesupport/test/core_ext/hash/transform_values_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/transform_values" diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 18da5fcf5f..c533c002a4 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index 137e8ce85f..a7ea084e7f 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/integer" diff --git a/activesupport/test/core_ext/kernel/concern_test.rb b/activesupport/test/core_ext/kernel/concern_test.rb index e7e4f99d7e..1f4fb8029c 100644 --- a/activesupport/test/core_ext/kernel/concern_test.rb +++ b/activesupport/test/core_ext/kernel/concern_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel/concern" diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 26f5088ede..875598f611 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/kernel" diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 44ff6bb051..3d003fd1d5 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/load_error" diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb index cabeed2fae..d17a6fe7f1 100644 --- a/activesupport/test/core_ext/marshal_test.rb +++ b/activesupport/test/core_ext/marshal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/marshal" require "dependencies_test_helpers" diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb index f885444284..d667bc0a34 100644 --- a/activesupport/test/core_ext/module/anonymous_test.rb +++ b/activesupport/test/core_ext/module/anonymous_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/anonymous" diff --git a/activesupport/test/core_ext/module/attr_internal_test.rb b/activesupport/test/core_ext/module/attr_internal_test.rb index 8458e278ee..12dc2f101a 100644 --- a/activesupport/test/core_ext/module/attr_internal_test.rb +++ b/activesupport/test/core_ext/module/attr_internal_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attr_internal" diff --git a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb index af240bc38d..e8587e3424 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors_per_thread" diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index 9b185e9381..2cf33fcc12 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/attribute_accessors" diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb index fdfa868851..9e5edda77a 100644 --- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb +++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/aliasing" diff --git a/activesupport/test/core_ext/module/concerning_test.rb b/activesupport/test/core_ext/module/concerning_test.rb index 098036828a..64accc06fc 100644 --- a/activesupport/test/core_ext/module/concerning_test.rb +++ b/activesupport/test/core_ext/module/concerning_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/concerning" diff --git a/activesupport/test/core_ext/module/introspection_test.rb b/activesupport/test/core_ext/module/introspection_test.rb index db383850cd..589c9455ed 100644 --- a/activesupport/test/core_ext/module/introspection_test.rb +++ b/activesupport/test/core_ext/module/introspection_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/introspection" diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb index 487c7dee16..f8970bc9f4 100644 --- a/activesupport/test/core_ext/module/reachable_test.rb +++ b/activesupport/test/core_ext/module/reachable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/reachable" diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 0c627f1e74..327c66e3ec 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module/remove_method" diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index a4d4444d69..b683c4e110 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/module" diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index fdb9493d3c..a99b20602d 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/name_error" diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index 3cfbe6e7e6..d4e03a90a4 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/object/acts_like_test.rb b/activesupport/test/core_ext/object/acts_like_test.rb index 631f4e63a8..1f1b71f748 100644 --- a/activesupport/test/core_ext/object/acts_like_test.rb +++ b/activesupport/test/core_ext/object/acts_like_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/blank_test.rb b/activesupport/test/core_ext/object/blank_test.rb index 7fd3fed042..fbd96893f6 100644 --- a/activesupport/test/core_ext/object/blank_test.rb +++ b/activesupport/test/core_ext/object/blank_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/blank" diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index f247ee16de..d6f0a71c5b 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index 68b0129980..7607e98b0c 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "bigdecimal" require "active_support/core_ext/object/duplicable" diff --git a/activesupport/test/core_ext/object/inclusion_test.rb b/activesupport/test/core_ext/object/inclusion_test.rb index 955686d6aa..b706e6b90f 100644 --- a/activesupport/test/core_ext/object/inclusion_test.rb +++ b/activesupport/test/core_ext/object/inclusion_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/inclusion" diff --git a/activesupport/test/core_ext/object/instance_variables_test.rb b/activesupport/test/core_ext/object/instance_variables_test.rb index 5bdb2fbc35..df38282fb0 100644 --- a/activesupport/test/core_ext/object/instance_variables_test.rb +++ b/activesupport/test/core_ext/object/instance_variables_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/json_cherry_pick_test.rb b/activesupport/test/core_ext/object/json_cherry_pick_test.rb index dd4e90918e..9f3f92a74b 100644 --- a/activesupport/test/core_ext/object/json_cherry_pick_test.rb +++ b/activesupport/test/core_ext/object/json_cherry_pick_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" # These test cases were added to test that cherry-picking the json extensions diff --git a/activesupport/test/core_ext/object/json_gem_encoding_test.rb b/activesupport/test/core_ext/object/json_gem_encoding_test.rb index f5016d0c2a..3ff34e448e 100644 --- a/activesupport/test/core_ext/object/json_gem_encoding_test.rb +++ b/activesupport/test/core_ext/object/json_gem_encoding_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "json" require "json/encoding_test_cases" diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb index 56246b24f3..e446092abe 100644 --- a/activesupport/test/core_ext/object/to_param_test.rb +++ b/activesupport/test/core_ext/object/to_param_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object/to_param" diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 298c8bf373..44147d47cf 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/ordered_hash" require "active_support/core_ext/object/to_query" diff --git a/activesupport/test/core_ext/object/try_test.rb b/activesupport/test/core_ext/object/try_test.rb index 5c8bf59952..fe437f6260 100644 --- a/activesupport/test/core_ext/object/try_test.rb +++ b/activesupport/test/core_ext/object/try_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index d166c7309c..693de2755d 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index e569a9f234..c937dad1db 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/regexp" diff --git a/activesupport/test/core_ext/secure_random_test.rb b/activesupport/test/core_ext/secure_random_test.rb index fc25f6ab41..b2ac4640ab 100644 --- a/activesupport/test/core_ext/secure_random_test.rb +++ b/activesupport/test/core_ext/secure_random_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/core_ext/securerandom" diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index daa8c3f2ef..defec8bba0 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "date" require "abstract_unit" require "timeout" diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 625a5bffb8..f1c6fa4f8c 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 70ae793cda..9401b9be07 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 0f13ca9c0e..555716d1c3 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "uri" require "active_support/core_ext/uri" -- cgit v1.2.3 From ac717d65a31d05458588b78ea7719b79f8ea69e5 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Mon, 10 Jul 2017 22:39:13 +0900 Subject: [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` --- activesupport/test/core_ext/array/access_test.rb | 1 + activesupport/test/core_ext/array/conversions_test.rb | 1 + activesupport/test/core_ext/array/extract_options_test.rb | 1 + activesupport/test/core_ext/array/grouping_test.rb | 1 + activesupport/test/core_ext/array/prepend_append_test.rb | 1 + activesupport/test/core_ext/array/wrap_test.rb | 1 + activesupport/test/core_ext/bigdecimal_test.rb | 1 + activesupport/test/core_ext/class/attribute_test.rb | 1 + activesupport/test/core_ext/class_test.rb | 1 + activesupport/test/core_ext/date_and_time_behavior.rb | 1 + activesupport/test/core_ext/date_and_time_compatibility_test.rb | 1 + activesupport/test/core_ext/date_ext_test.rb | 1 + activesupport/test/core_ext/date_time_ext_test.rb | 1 + activesupport/test/core_ext/digest/uuid_test.rb | 1 + activesupport/test/core_ext/duration_test.rb | 1 + activesupport/test/core_ext/enumerable_test.rb | 1 + activesupport/test/core_ext/file_test.rb | 1 + activesupport/test/core_ext/hash/transform_keys_test.rb | 1 + activesupport/test/core_ext/hash/transform_values_test.rb | 1 + activesupport/test/core_ext/hash_ext_test.rb | 1 + activesupport/test/core_ext/integer_ext_test.rb | 1 + activesupport/test/core_ext/kernel/concern_test.rb | 1 + activesupport/test/core_ext/kernel_test.rb | 1 + activesupport/test/core_ext/load_error_test.rb | 1 + activesupport/test/core_ext/marshal_test.rb | 1 + activesupport/test/core_ext/module/anonymous_test.rb | 1 + activesupport/test/core_ext/module/attr_internal_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb | 1 + activesupport/test/core_ext/module/attribute_accessor_test.rb | 1 + activesupport/test/core_ext/module/attribute_aliasing_test.rb | 1 + activesupport/test/core_ext/module/concerning_test.rb | 1 + activesupport/test/core_ext/module/introspection_test.rb | 1 + activesupport/test/core_ext/module/reachable_test.rb | 1 + activesupport/test/core_ext/module/remove_method_test.rb | 1 + activesupport/test/core_ext/module_test.rb | 1 + activesupport/test/core_ext/name_error_test.rb | 1 + activesupport/test/core_ext/numeric_ext_test.rb | 1 + activesupport/test/core_ext/object/acts_like_test.rb | 1 + activesupport/test/core_ext/object/blank_test.rb | 1 + activesupport/test/core_ext/object/deep_dup_test.rb | 1 + activesupport/test/core_ext/object/duplicable_test.rb | 1 + activesupport/test/core_ext/object/inclusion_test.rb | 1 + activesupport/test/core_ext/object/instance_variables_test.rb | 1 + activesupport/test/core_ext/object/json_cherry_pick_test.rb | 1 + activesupport/test/core_ext/object/json_gem_encoding_test.rb | 1 + activesupport/test/core_ext/object/to_param_test.rb | 1 + activesupport/test/core_ext/object/to_query_test.rb | 1 + activesupport/test/core_ext/object/try_test.rb | 1 + activesupport/test/core_ext/range_ext_test.rb | 1 + activesupport/test/core_ext/regexp_ext_test.rb | 1 + activesupport/test/core_ext/secure_random_test.rb | 1 + activesupport/test/core_ext/string_ext_test.rb | 1 + activesupport/test/core_ext/time_ext_test.rb | 1 + activesupport/test/core_ext/time_with_zone_test.rb | 1 + activesupport/test/core_ext/uri_ext_test.rb | 1 + 55 files changed, 55 insertions(+) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/array/access_test.rb b/activesupport/test/core_ext/array/access_test.rb index 08af9e1b55..8c217023cf 100644 --- a/activesupport/test/core_ext/array/access_test.rb +++ b/activesupport/test/core_ext/array/access_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/conversions_test.rb b/activesupport/test/core_ext/array/conversions_test.rb index 5a073344d9..0f919efcb0 100644 --- a/activesupport/test/core_ext/array/conversions_test.rb +++ b/activesupport/test/core_ext/array/conversions_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/array/extract_options_test.rb b/activesupport/test/core_ext/array/extract_options_test.rb index 09bf97ae6c..7a4b15cd71 100644 --- a/activesupport/test/core_ext/array/extract_options_test.rb +++ b/activesupport/test/core_ext/array/extract_options_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/hash" diff --git a/activesupport/test/core_ext/array/grouping_test.rb b/activesupport/test/core_ext/array/grouping_test.rb index daf47e9a9f..da9d4963d8 100644 --- a/activesupport/test/core_ext/array/grouping_test.rb +++ b/activesupport/test/core_ext/array/grouping_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/prepend_append_test.rb b/activesupport/test/core_ext/array/prepend_append_test.rb index 3b38acf56c..c34acd66ad 100644 --- a/activesupport/test/core_ext/array/prepend_append_test.rb +++ b/activesupport/test/core_ext/array/prepend_append_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/array/wrap_test.rb b/activesupport/test/core_ext/array/wrap_test.rb index 451f9db2ed..46564b4d73 100644 --- a/activesupport/test/core_ext/array/wrap_test.rb +++ b/activesupport/test/core_ext/array/wrap_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb index dbd0762574..66e81f1162 100644 --- a/activesupport/test/core_ext/bigdecimal_test.rb +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/big_decimal" diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index 2933b62c58..be6ad82367 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/class/attribute" diff --git a/activesupport/test/core_ext/class_test.rb b/activesupport/test/core_ext/class_test.rb index c0cabea8fd..9cc006fc63 100644 --- a/activesupport/test/core_ext/class_test.rb +++ b/activesupport/test/core_ext/class_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/class" require "set" diff --git a/activesupport/test/core_ext/date_and_time_behavior.rb b/activesupport/test/core_ext/date_and_time_behavior.rb index 8d908968ef..256353c309 100644 --- a/activesupport/test/core_ext/date_and_time_behavior.rb +++ b/activesupport/test/core_ext/date_and_time_behavior.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" module DateAndTimeBehavior diff --git a/activesupport/test/core_ext/date_and_time_compatibility_test.rb b/activesupport/test/core_ext/date_and_time_compatibility_test.rb index 04b93105d5..266829a452 100644 --- a/activesupport/test/core_ext/date_and_time_compatibility_test.rb +++ b/activesupport/test/core_ext/date_and_time_compatibility_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb index 7c6e705936..b8672eac4b 100644 --- a/activesupport/test/core_ext/date_ext_test.rb +++ b/activesupport/test/core_ext/date_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb index beddfe4584..a3c2018a31 100644 --- a/activesupport/test/core_ext/date_time_ext_test.rb +++ b/activesupport/test/core_ext/date_time_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/digest/uuid_test.rb b/activesupport/test/core_ext/digest/uuid_test.rb index ea3605bf9c..94cb7d9418 100644 --- a/activesupport/test/core_ext/digest/uuid_test.rb +++ b/activesupport/test/core_ext/digest/uuid_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/digest/uuid" diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 32c0ce4317..c655f466f2 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/inflector" require "active_support/time" diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb index 3259109b0e..8d71320931 100644 --- a/activesupport/test/core_ext/enumerable_test.rb +++ b/activesupport/test/core_ext/enumerable_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/array" require "active_support/core_ext/enumerable" diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb index 67b1a04429..23e3c277cc 100644 --- a/activesupport/test/core_ext/file_test.rb +++ b/activesupport/test/core_ext/file_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/file" diff --git a/activesupport/test/core_ext/hash/transform_keys_test.rb b/activesupport/test/core_ext/hash/transform_keys_test.rb index f329246bdd..b9e41f7b25 100644 --- a/activesupport/test/core_ext/hash/transform_keys_test.rb +++ b/activesupport/test/core_ext/hash/transform_keys_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/hash/keys" diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb index 4eb6999510..d34b7fa7b9 100644 --- a/activesupport/test/core_ext/hash/transform_values_test.rb +++ b/activesupport/test/core_ext/hash/transform_values_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/hash/indifferent_access" require "active_support/core_ext/hash/transform_values" diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index c533c002a4..c537fb86fe 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/hash" require "bigdecimal" diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index a7ea084e7f..14169b084d 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/integer" diff --git a/activesupport/test/core_ext/kernel/concern_test.rb b/activesupport/test/core_ext/kernel/concern_test.rb index 1f4fb8029c..b40ff6a623 100644 --- a/activesupport/test/core_ext/kernel/concern_test.rb +++ b/activesupport/test/core_ext/kernel/concern_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/kernel/concern" diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb index 875598f611..ef11e10af8 100644 --- a/activesupport/test/core_ext/kernel_test.rb +++ b/activesupport/test/core_ext/kernel_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/kernel" diff --git a/activesupport/test/core_ext/load_error_test.rb b/activesupport/test/core_ext/load_error_test.rb index 3d003fd1d5..4fdd228ff8 100644 --- a/activesupport/test/core_ext/load_error_test.rb +++ b/activesupport/test/core_ext/load_error_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/load_error" diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb index d17a6fe7f1..7ac051b4b1 100644 --- a/activesupport/test/core_ext/marshal_test.rb +++ b/activesupport/test/core_ext/marshal_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/marshal" require "dependencies_test_helpers" diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb index d667bc0a34..606f22c9b5 100644 --- a/activesupport/test/core_ext/module/anonymous_test.rb +++ b/activesupport/test/core_ext/module/anonymous_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/anonymous" diff --git a/activesupport/test/core_ext/module/attr_internal_test.rb b/activesupport/test/core_ext/module/attr_internal_test.rb index 12dc2f101a..c2a28eced4 100644 --- a/activesupport/test/core_ext/module/attr_internal_test.rb +++ b/activesupport/test/core_ext/module/attr_internal_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/attr_internal" diff --git a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb index e8587e3424..e0fbd1002c 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_per_thread_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/attribute_accessors_per_thread" diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb index 2cf33fcc12..f1d6859a88 100644 --- a/activesupport/test/core_ext/module/attribute_accessor_test.rb +++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/attribute_accessors" diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb index 9e5edda77a..187a0f4da2 100644 --- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb +++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/aliasing" diff --git a/activesupport/test/core_ext/module/concerning_test.rb b/activesupport/test/core_ext/module/concerning_test.rb index 64accc06fc..192c3d5a9c 100644 --- a/activesupport/test/core_ext/module/concerning_test.rb +++ b/activesupport/test/core_ext/module/concerning_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/concerning" diff --git a/activesupport/test/core_ext/module/introspection_test.rb b/activesupport/test/core_ext/module/introspection_test.rb index 589c9455ed..76d3012239 100644 --- a/activesupport/test/core_ext/module/introspection_test.rb +++ b/activesupport/test/core_ext/module/introspection_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/introspection" diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb index f8970bc9f4..a69fc6839e 100644 --- a/activesupport/test/core_ext/module/reachable_test.rb +++ b/activesupport/test/core_ext/module/reachable_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/reachable" diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 327c66e3ec..dbf71b477d 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module/remove_method" diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 3dd10ab325..69c8a312d8 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/module" diff --git a/activesupport/test/core_ext/name_error_test.rb b/activesupport/test/core_ext/name_error_test.rb index a99b20602d..d1dace3713 100644 --- a/activesupport/test/core_ext/name_error_test.rb +++ b/activesupport/test/core_ext/name_error_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/name_error" diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index d4e03a90a4..d38124b214 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/object/acts_like_test.rb b/activesupport/test/core_ext/object/acts_like_test.rb index 1f1b71f748..9f7b81f7fc 100644 --- a/activesupport/test/core_ext/object/acts_like_test.rb +++ b/activesupport/test/core_ext/object/acts_like_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/blank_test.rb b/activesupport/test/core_ext/object/blank_test.rb index fbd96893f6..749e59ec00 100644 --- a/activesupport/test/core_ext/object/blank_test.rb +++ b/activesupport/test/core_ext/object/blank_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object/blank" diff --git a/activesupport/test/core_ext/object/deep_dup_test.rb b/activesupport/test/core_ext/object/deep_dup_test.rb index d6f0a71c5b..2486592441 100644 --- a/activesupport/test/core_ext/object/deep_dup_test.rb +++ b/activesupport/test/core_ext/object/deep_dup_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index 7607e98b0c..93f39b00bb 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "bigdecimal" require "active_support/core_ext/object/duplicable" diff --git a/activesupport/test/core_ext/object/inclusion_test.rb b/activesupport/test/core_ext/object/inclusion_test.rb index b706e6b90f..52c21f2e8e 100644 --- a/activesupport/test/core_ext/object/inclusion_test.rb +++ b/activesupport/test/core_ext/object/inclusion_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object/inclusion" diff --git a/activesupport/test/core_ext/object/instance_variables_test.rb b/activesupport/test/core_ext/object/instance_variables_test.rb index df38282fb0..b9ec827954 100644 --- a/activesupport/test/core_ext/object/instance_variables_test.rb +++ b/activesupport/test/core_ext/object/instance_variables_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/object/json_cherry_pick_test.rb b/activesupport/test/core_ext/object/json_cherry_pick_test.rb index 9f3f92a74b..22659a4050 100644 --- a/activesupport/test/core_ext/object/json_cherry_pick_test.rb +++ b/activesupport/test/core_ext/object/json_cherry_pick_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" # These test cases were added to test that cherry-picking the json extensions diff --git a/activesupport/test/core_ext/object/json_gem_encoding_test.rb b/activesupport/test/core_ext/object/json_gem_encoding_test.rb index 3ff34e448e..4cdb6ed09f 100644 --- a/activesupport/test/core_ext/object/json_gem_encoding_test.rb +++ b/activesupport/test/core_ext/object/json_gem_encoding_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "json" require "json/encoding_test_cases" diff --git a/activesupport/test/core_ext/object/to_param_test.rb b/activesupport/test/core_ext/object/to_param_test.rb index e446092abe..612156bd99 100644 --- a/activesupport/test/core_ext/object/to_param_test.rb +++ b/activesupport/test/core_ext/object/to_param_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object/to_param" diff --git a/activesupport/test/core_ext/object/to_query_test.rb b/activesupport/test/core_ext/object/to_query_test.rb index 44147d47cf..7593bcfa4d 100644 --- a/activesupport/test/core_ext/object/to_query_test.rb +++ b/activesupport/test/core_ext/object/to_query_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/ordered_hash" require "active_support/core_ext/object/to_query" diff --git a/activesupport/test/core_ext/object/try_test.rb b/activesupport/test/core_ext/object/try_test.rb index fe437f6260..fe68b24bf5 100644 --- a/activesupport/test/core_ext/object/try_test.rb +++ b/activesupport/test/core_ext/object/try_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/object" diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb index 693de2755d..a96e3d62e8 100644 --- a/activesupport/test/core_ext/range_ext_test.rb +++ b/activesupport/test/core_ext/range_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "active_support/core_ext/numeric" diff --git a/activesupport/test/core_ext/regexp_ext_test.rb b/activesupport/test/core_ext/regexp_ext_test.rb index c937dad1db..5737bdafda 100644 --- a/activesupport/test/core_ext/regexp_ext_test.rb +++ b/activesupport/test/core_ext/regexp_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/regexp" diff --git a/activesupport/test/core_ext/secure_random_test.rb b/activesupport/test/core_ext/secure_random_test.rb index b2ac4640ab..7067fb524c 100644 --- a/activesupport/test/core_ext/secure_random_test.rb +++ b/activesupport/test/core_ext/secure_random_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/core_ext/securerandom" diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index defec8bba0..0afff5aa50 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "date" require "abstract_unit" require "timeout" diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index f1c6fa4f8c..dc2f4c5ac7 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "core_ext/date_and_time_behavior" diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb index 9401b9be07..0f80a24758 100644 --- a/activesupport/test/core_ext/time_with_zone_test.rb +++ b/activesupport/test/core_ext/time_with_zone_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "active_support/time" require "time_zone_test_helpers" diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb index 555716d1c3..8816b0d392 100644 --- a/activesupport/test/core_ext/uri_ext_test.rb +++ b/activesupport/test/core_ext/uri_ext_test.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + require "abstract_unit" require "uri" require "active_support/core_ext/uri" -- cgit v1.2.3