sam-github/vpim — pull request #6 by h2s (2013-08-05 05:39:27+00:00)
Title: Assert RuntimeError when modifying frozen objects in Ruby 1.9 and beyond

Before trying to fix the invalid multibyte escape error in Ruby 2.0, I first want to get the test_vcard.rb suite all green in Ruby 1.8.7, 1.9.2, 1.9.3 and 2.0.0.

This test failure resulted from the fact that as of Ruby 1.9, attempts to modify frozen objects raise RuntimeErrors instead of TypeErrors.

test_modify_name(TestVcard) [test/test_vcard.rb:693]:
[TypeError] exception expected, not
Class:
Message: <"can't modify frozen Vpim::Vcard::Name">
---Backtrace---
test/test_vcard.rb:694:in `block in test_modify_name'

The fix for this is simply to assert the correct type of error according to the version of Ruby currently executing.