File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change
1
+ * Deprecate ` ActiveSupport::ProxyObject ` in favor of Ruby's buildin ` BasicObject `
2
+
3
+ * Earlopain*
4
+
1
5
* ` stub_const ` now accepts a ` exists: false ` parameter to allow stubbing missing constants.
2
6
3
7
* Jean Boussier*
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
3
module ActiveSupport
4
- # = Active Support Proxy \Object
5
- #
6
- # A class with no predefined methods that behaves similarly to Ruby's
7
- # BasicObject. Used for proxy classes.
8
- class ProxyObject < ::BasicObject
4
+ class ProxyObject < ::BasicObject # :nodoc:
9
5
undef_method :==
10
6
undef_method :equal?
11
7
12
8
# Let ActiveSupport::ProxyObject at least raise exceptions.
13
9
def raise ( *args )
14
10
::Object . send ( :raise , *args )
15
11
end
12
+
13
+ def self . inherited ( _subclass )
14
+ ::ActiveSupport . deprecator . warn ( <<~MSG )
15
+ ActiveSupport::ProxyObject is deprecated and will be removed in Rails 7.3.
16
+ Use Ruby's buildin BasicObject instead.
17
+ MSG
18
+ end
16
19
end
17
20
end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "abstract_unit"
4
+
5
+ class ProxyObjectTest < ActiveSupport ::TestCase
6
+ def test_accessing_proxy_object_is_deprecated
7
+ proxy = assert_deprecated ( ActiveSupport . deprecator ) do
8
+ Class . new ( ActiveSupport ::ProxyObject ) do
9
+ def some_method
10
+ "foo"
11
+ end
12
+ end
13
+ end
14
+ assert_equal ( "foo" , proxy . new . some_method )
15
+ end
16
+ end
You can’t perform that action at this time.
0 commit comments