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.

Controller:
def show
  @counter = Counter.increment if count_me
end


RSpec:
describe 'Show' do
  it "should INCREMENT only when count-me is true" do
    Counter.should_receive(:increment)
    Counter.should_receive(:increment).never
    Counter.should_not_receive(:increment)
    get :show, :count_me => 'true'
  end
end

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.

Thanks!

-- 
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to