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

Commit 6e0354e

Browse files
committed
Remove 2.0 workarounds
1 parent ad80096 commit 6e0354e

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

lib/rspec/mocks/method_double.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def raise_method_not_stubbed_error
208208

209209
private
210210

211-
# In Ruby 2.0.0 and above prepend will alter the method lookup chain.
211+
# Prepend alters the method lookup chain.
212212
# We use an object's singleton class to define method doubles upon,
213213
# however if the object has had its singleton class (as opposed to
214214
# its actual class) prepended too then the the method lookup chain
@@ -218,7 +218,6 @@ def raise_method_not_stubbed_error
218218
# This code works around that by providing a mock definition target
219219
# that is either the singleton class, or if necessary, a prepended module
220220
# of our own.
221-
#
222221

223222
# We subclass `Module` in order to be able to easily detect our prepended module.
224223
RSpecPrependedModule = Class.new(Module)

lib/rspec/mocks/proxy.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@ def visibility_for(_method_name)
233233

234234
def self.prepended_modules_of(klass)
235235
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)
241237
ancestors[0, singleton_index]
242238
end
243239

0 commit comments

Comments
 (0)