This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -155,10 +155,19 @@ def self.expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods)
155
155
# @api private
156
156
# Determines where the methods like `should_receive`, and `stub` are added.
157
157
def self . default_should_syntax_host
158
+ # JRuby 1.7.4 introduces a regression whereby `defined?(::BasicObject) => nil`
159
+ # yet `BasicObject` still exists and patching onto ::Object breaks things
160
+ # e.g. SimpleDelegator expectations won't work
161
+ #
162
+ # See: https://github.com/jruby/jruby/issues/814
163
+ if defined? ( JRUBY_VERSION ) && JRUBY_VERSION == '1.7.4' && RUBY_VERSION . to_f > 1.8
164
+ return ::BasicObject
165
+ end
166
+
158
167
# On 1.8.7, Object.ancestors.last == Kernel but
159
168
# things blow up if we include `RSpec::Mocks::Methods`
160
169
# into Kernel...not sure why.
161
- return Object unless defined? ( ::BasicObject ) || ( RUBY_PLATFORM == 'java' && RUBY_VERSION . to_f > 1.8 )
170
+ return Object unless defined? ( ::BasicObject )
162
171
163
172
# MacRuby has BasicObject but it's not the root class.
164
173
return Object unless Object . ancestors . last == ::BasicObject
You can’t perform that action at this time.
0 commit comments