I’m trying to test a Rails controller and am having trouble getting
SHOULD_NOT_RECEIVE to work on a class method. I can never get
Counter.should_not_receive(:xxx) to fail when the message ‘xxx’ is sent.
@counter = Counter.increment if count_me
describe ‘Show’ do
it “should INCREMENT only when count-me is true” do
get :show, :count_me => ‘true’
Why does this pass? Counter.should_receive(:increment) passes
correctly (or fails if COUNT_ME isn’t set correctly), but shouldn’t the
next 2 statements fail?
This is in Rails 2.3.11 & MongoDB.