This repository was archived by the owner on Nov 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Expand file tree Collapse file tree 2 files changed +2
-7
lines changed Original file line number Diff line number Diff line change @@ -208,7 +208,7 @@ def raise_method_not_stubbed_error
208
208
209
209
private
210
210
211
- # In Ruby 2.0.0 and above prepend will alter the method lookup chain.
211
+ # Prepend alters the method lookup chain.
212
212
# We use an object's singleton class to define method doubles upon,
213
213
# however if the object has had its singleton class (as opposed to
214
214
# its actual class) prepended too then the the method lookup chain
@@ -218,7 +218,6 @@ def raise_method_not_stubbed_error
218
218
# This code works around that by providing a mock definition target
219
219
# that is either the singleton class, or if necessary, a prepended module
220
220
# of our own.
221
- #
222
221
223
222
# We subclass `Module` in order to be able to easily detect our prepended module.
224
223
RSpecPrependedModule = Class . new ( Module )
Original file line number Diff line number Diff line change @@ -233,11 +233,7 @@ def visibility_for(_method_name)
233
233
234
234
def self . prepended_modules_of ( klass )
235
235
ancestors = klass . ancestors
236
-
237
- # `|| 0` is necessary for Ruby 2.0, where the singleton class
238
- # is only in the ancestor list when there are prepended modules.
239
- singleton_index = ancestors . index ( klass ) || 0
240
-
236
+ singleton_index = ancestors . index ( klass )
241
237
ancestors [ 0 , singleton_index ]
242
238
end
243
239
You can’t perform that action at this time.
0 commit comments