[rspec-users] Counter.should_not_receive(:message) not working?

Justin Ko jko170 at gmail.com
Thu Mar 17 20:53:05 EDT 2011


On Thu, Mar 17, 2011 at 2:55 PM, Pete Campbell <lists at ruby-forum.com> wrote:

> Even simpler...
>
> describe 'Show' do
>  it 'should fail because increment is called' do
>    Counter.should_not_receive(:increment)    # Incorrectly passes
>     get :show, :count_me => 'true'
>  end
>   it 'should fail because increment is not called' do
>    Counter.should_receive(:increment)    # Correctly fails
>    get :show
>  end
> end
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>

I would say "count_me" is not returning what you think it is. Try adding
"raise count_me.inspect" in the controller action to see if this is the
case.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110317/7d3f99b0/attachment.html>


More information about the rspec-users mailing list