1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2015-02-12 02:47:29 +00:00
parent 0605e80c9d
commit 2049c58dfd

View file

@ -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