Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Ruby 1.9 test fix #2

wants to merge 1 commit into from

2 participants


No description provided.


Is the encoding coming back in these assertions always Encoding::ASCII_8BIT? We don't need to check for Ruby 1.9 because that test will only be run on 1.9 anyway (see here).
I think the real issue is that there's a bug in that the ASCII_8BIT (binary) encoding is being returned in every case?


Obviously you're right, that's not the problem :/ I somehow assumed Encoding was present (and misimplemented) on 1.8 as well, but no, it's definitely missing.. checking now what's up.


Uuuuuh this gets interesting: all works fine if I run ruby19 -Ilib:test test/test_erb_util_module_override.rb but fails if I run it through rake...


And same happens if I run it through testrb ...


what about if you do ruby19 rake ... ?


Ha! I know why! The problem is the way the require lines happen when running via rake (hoe) or testrb.

Ruby will not reload fast_xs_monkey_patching when it's included at the top of test_erb_util_module_overrides.rb, but will include erb at that point, making it non-override...

A quick and dirty solution would be to rename test_*.rb to tc_*.rb and add a test_all.rb entry that creates a testsuite to run the others (I have the code to do that)...


(When I said rake before I meant ruby19 -S rake of course, otherwise I would be running it with ruby18 actually. But see the latest comment for the solution ;))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 25, 2012
  1. @Flameeyes
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 5 deletions.
  1. +7 −5 test/test_erb_util_module_overrides.rb
12 test/test_erb_util_module_overrides.rb
@@ -35,11 +35,13 @@ def test_escape_url
def test_preserve_encoding
foo = "foo"
- foo.force_encoding Encoding::US_ASCII
- assert_equal Encoding::US_ASCII, url_encode(foo).encoding
- assert_equal Encoding::US_ASCII, html_escape(foo).encoding
- assert_equal Encoding::US_ASCII, u(foo).encoding
- assert_equal Encoding::US_ASCII, h(foo).encoding
+ ascii_encoding = (RUBY_VERSION =~ /1\.9/) ? Encoding::ASCII_8BIT : Encoding::US_ASCII
+ foo.force_encoding ascii_encoding
+ assert_equal ascii_encoding, url_encode(foo).encoding
+ assert_equal ascii_encoding, html_escape(foo).encoding
+ assert_equal ascii_encoding, u(foo).encoding
+ assert_equal ascii_encoding, h(foo).encoding
foo.force_encoding Encoding::BINARY
assert_equal Encoding::BINARY, url_encode(foo).encoding
Something went wrong with that request. Please try again.