Created
February 15, 2013 21:21
-
-
Save JonRowe/4963637 to your computer and use it in GitHub Desktop.
Snippet from rspec-expectations showing failure due to usage of `public_send`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let(:proxy_class) do | |
Class.new(BasicObject) do | |
def initialize(target) | |
@target = target | |
end | |
def proxied? | |
true | |
end | |
def method_missing(name, *args) | |
@target.send(name, *args) | |
end | |
end | |
end | |
it 'works properly on BasicObject-subclassed proxy objects' do | |
#fails when be_ matcher uses #public_send as the `proxied?` method isn't public on the proxy class | |
expect(proxy_class.new(Object.new)).to be_proxied | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment