Skip to content

Instantly share code, notes, and snippets.

@JonRowe
Created February 15, 2013 21:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonRowe/4963637 to your computer and use it in GitHub Desktop.
Save JonRowe/4963637 to your computer and use it in GitHub Desktop.
Snippet from rspec-expectations showing failure due to usage of `public_send`
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