Opened for feedback.
This came up due to #7798. I figured that if the if was a 1.8 to 1.9 difference, we should not just fix docs, but remove the if. Now one test fails:
@@ -1 +1 @@
I'm not sure this test is good, though: do we really want to proxy .class?
Looks good to me. I hang my head in abject shame for not noticing this sooner. ;-)
Proxying class seems wrong to me. Does changing that break chaining method calls?
I have no idea.
Since my commit is the fix, should I change the test so that it passes and then open another that does not proxy #class?
I think it's fine to do it here, it can be in a different commit.
Okay. I've fixed the test, so it passes. I wrote a new test to check the proxy-ing of class:
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte
index 4bfd210..a8c61af 100644
@@ -50,6 +50,10 @@ class MultibyteCharsTest < ActiveSupport::TestCase
assert_equal BYTE_STRING.length, BYTE_STRING.mb_chars.length
+ def test_class_is_not_forwarded
+ assert_equal BYTE_STRING.mb_chars.class, ActiveSupport::Multibyte::Chars
and now I get this unrelated failure:
assert !@proxy_class.consumes?(BYTE_STRING) # => this fails
How strange...any ideas on why adding a test would cause an unrelated test to fail?
Fix documentation for String#mb_chars.
This documentation has been out of date.
Simplify String#mb_chars and stop proxying #class
This behavior mattered under Ruby 1.8, but that doesn't matter now
that we don't support it.
In addition, we don't want to proxy the #class method. A test was added
to prevent against regressions.
I've fixed the issue with the test, added in a CHANGELOG entry.