Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit b529c15

Browse files
committed
Add clarification about JRuby 9.1 workaround
1 parent ba59f63 commit b529c15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/rspec/mocks/test_double.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,16 @@ def method_missing(message, *args, &block)
8484
end
8585
end
8686

87+
visibility = proxy.visibility_for(message)
88+
8789
# Defined private and protected methods will still trigger `method_missing`
8890
# when called publicly. We want ruby's method visibility error to get raised,
8991
# so we simply delegate to `super` in that case.
92+
# return super if visibility == :private || visibility == :protected
9093
# ...well, we would delegate to `super`, but there's a JRuby
9194
# bug, so we raise our own visibility error instead:
9295
# https://github.com/jruby/jruby/issues/1398
93-
visibility = proxy.visibility_for(message)
96+
# Only works without this workaround with JRuby 9.2
9497
if visibility == :private || visibility == :protected
9598
ErrorGenerator.new(self).raise_non_public_error(
9699
message, visibility

0 commit comments

Comments
 (0)