btakita / rr

RR (Double Ruby) is a test double framework that features a rich selection of double techniques and a terse syntax.
http://github.com/rr/rr
MIT License
501 stars 58 forks source link

Can't proxy a Proc.call call #55

Closed kjvarga closed 12 years ago

kjvarga commented 13 years ago

The following spec:

describe "as a Proc" do
  before :each do
   @ids = [1,2,3]
   @proc = Proc.new { |records| records.reverse }
  end             

  it "the proc should reverse the list" do
   mock.proxy(@proxy).call(@ids)
   @proc.call(@ids).should == @ids.reverse
  end
end

Is failing with:

1) AridCache::CacheProxy::ResultProcessor proxies as a Proc the proc should reverse the list
   Failure/Error: mock.proxy(@proxy).call(@ids)
   RR::Errors::TimesCalledError:
     call([1, 2, 3])
     Called 0 times.
     Expected 1 times.
   # ./spec/arid_cache/cache_proxy/result_processor_spec.rb:287

It's not recognizing the call to call()

5long commented 12 years ago

Oops, the issue is actually a year old.

@kjvarga There's a typo in the line mock.proxy(@proxy).call(@ids): @proxy instead of @proc. And this snippet works for me: https://gist.github.com/3835159