anybody know, how I can stub class variable initialization?
I define
@@connection = Bunny.new.start
for restrict connection numbers, but now I have to test it, and when I try stub it in general way, like
allow_any_instance_of(Bunny).to receive(:start) { something }
it doesn't work. @@
variable initializes earlier.
Also, I can redefine it:
before do
@@connection = double('conn')
end
but it doesn't suit for me because I have to do not allow create a connection to AMQP
SOLVE
I didn't figure out how to do that, so I used bunny-mock, and it helped me
I don't know if it's bad practice but what about:
i. e.