I'm mocking a java interface in rspec
clock = ClockInterface.new
clock.should_receive(:currentTime)
When I run rspec everything works fine but I see a warning which directs me to the following
https://github.com/jruby/jruby/wiki/Persistence
When I attempt to set
ClockInterface.__persistence__ = true
I get a NoMethodError. I'm using jruby 1.7.4
ClockInterface
is an interface rather than a class, and doesn’t have the __persistent__
method, unlike classes for which that method gets added through their proxy.
To get your test to work properly, you should instead use:
clock = mock(ClockInterface)
clock.should_receive(:currentTime)