Hi,
I’m getting the following error when running spec on my controller:
#Mock:core.core_file=(#Mock:core_file) - expected calls: 0, actual
calls: 1
This is my mocha rspec setup:
@core = mock(‘core’)
core_file = mock(‘core_file’)
Core.stubs(:new).returns(@core)
And this is the line in my controller on which it fails:
@core.core_file = @core_file
I tried stubbing core_file of @core, but that didn’t do anything (e.g.
@core.stubs(‘core_file’).returns(core_file)). And it makes sense,
because in the controller, I assign core_file - I don’t access
core_file.
So, the question comes down to: how do I stub instance variable
assignment?
Thanks,
Tiberiu