Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AccessVariable has no scope method, which breaks define_method, and specifically certain RSpec features #3685

Closed
sarahzrf opened this issue Jul 25, 2016 · 0 comments

Comments

@sarahzrf
Copy link

sarahzrf commented Jul 25, 2016

Problem

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)

Configuration Details

  • Output of rbx -v: rubinius 3.49 (2.3.1 0c24d047 2016-07-22 3.8.0) [x86_64-linux-gnu]
  • Output of 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
  • Distribution name (in case of Linux/BSD): Arch
  • Contents of 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.
  • Contents of configure.log (as a Gist link): Same as for config.rb.

Stack Trace

https://gist.github.com/4d89b32af7ea2f8d423d46677dbcc690

@sarahzrf 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
@brixen brixen closed this as completed in 8a6c33a Jul 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant