diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-12 02:47:29 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-12 02:47:29 +0000 |
commit | 2049c58dfd7accccc719fba6eeb8e3c8c6e53045 (patch) | |
tree | 13134ef25a63e5917c51ee5ec609470466205a22 | |
parent | 0605e80c9df94527bedce3baffbe85a827179177 (diff) | |
download | ruby-2049c58dfd7accccc719fba6eeb8e3c8c6e53045.tar.gz |
drbtest.rb: refactor
* test/drb/drbtest.rb (test_07_public_private_protected_missing):
refactor by splitting and using assert_raise.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49574 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/drb/drbtest.rb | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index aac705c831..b2576d8e13 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -197,38 +197,33 @@ module DRbCore end end - def test_07_public_private_protected_missing - assert_nothing_raised() { - begin - @there.method_missing(:eval, 'nil') - rescue NoMethodError - assert_match(/^private method \`eval\'/, $!.message) - end + def test_07_private_missing + e = assert_raise(NoMethodError) { + @there.method_missing(:eval, 'nil') } - assert_nothing_raised() { - begin - @there.call_private_method - rescue NoMethodError - assert_equal(NoMethodError, $!.class) - assert_match(/^private method \`call_private_method\'/, $!.message) - end + assert_match(/^private method \`eval\'/, e.message) + + e = assert_raise(NoMethodError) { + @there.call_private_method } - assert_nothing_raised() { - begin - @there.call_protected_method - rescue NoMethodError - assert_equal(NoMethodError, $!.class) - assert_match(/^protected method \`call_protected_method\'/, $!.message) - end + assert_match(/^private method \`call_private_method\'/, e.message) + end + + def test_07_protected_missing + e = assert_raise(NoMethodError) { + @there.call_protected_method } - assert_nothing_raised() { - begin - @there.method_missing(:undefined_method_test) - rescue NoMethodError - assert_equal(NoMethodError, $!.class) - assert_match(/^undefined method \`undefined_method_test\'/, $!.message) - end + assert_match(/^protected method \`call_protected_method\'/, e.message) + end + + def test_07_public_missing + e = assert_raise(NoMethodError) { + @there.method_missing(:undefined_method_test) } + assert_match(/^undefined method \`undefined_method_test\'/, e.message) + end + + def test_07_send_missing assert_raise(DRb::DRbConnError) do @there.method_missing(:__send__, :to_s) end |