You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no AccessVariable#scope method. Consequently, the define_method method does not work if passed a method whose @executable is a AccessVariable, because it calls for_define_method, which tries to do @executable.scope. This is specifically an issue for me because RSpec uses define_method to restore the original version of a stubbed method after a test (if the original version is from the object's singleton class), and I'm trying to stub an attr_reader defined in a module's singleton class.
How to Reproduce
class Foo
attr_reader :bar
end
meth = Foo.instance_method(:bar)
Foo.send(:undef_method, :bar)
Foo.send(:define_method, :bar, meth)
The text was updated successfully, but these errors were encountered:
sarahzrf
changed the title
AccessVariable has no scope method, breaking define_method with it, and specifically certain RSpec features
AccessVariable has no scope method, which breaks define_method, and specifically certain RSpec features
Jul 25, 2016
Problem
There is no
AccessVariable#scope
method. Consequently, thedefine_method
method does not work if passed a method whose@executable
is aAccessVariable
, because it callsfor_define_method
, which tries to do@executable.scope
. This is specifically an issue for me because RSpec usesdefine_method
to restore the original version of a stubbed method after a test (if the original version is from the object's singleton class), and I'm trying to stub anattr_reader
defined in a module's singleton class.How to Reproduce
Configuration Details
rbx -v
:rubinius 3.49 (2.3.1 0c24d047 2016-07-22 3.8.0) [x86_64-linux-gnu]
uname -a
:Linux benzrf-laptop 4.6.4-1-ARCH #1 SMP PREEMPT Mon Jul 11 19:12:32 CEST 2016 x86_64 GNU/Linux
config.rb
(as a Gist link): If this is part of the Rubinius build process, I'm using Arch's official package. Otherwise, I don't know.configure.log
(as a Gist link): Same as forconfig.rb
.Stack Trace
https://gist.github.com/4d89b32af7ea2f8d423d46677dbcc690
The text was updated successfully, but these errors were encountered: