On Mon, Mar 24, 2008 at 3:24 AM, nathan.wu <[EMAIL PROTECTED]> wrote: > ids = Category.find(:all).map(&:id) > > ids = mock('ids') > Category.should_receive(:find).with(all).and_return(??) > > and > what's the difference between mock and mock_model > when should i use mock and mock_model
categories = [mock_model(Category, :id => 1), mock_model(Category, :id => 2)] Category.should_receive(:find).with(:all).and_return categories mock just creates a mock object for you. mock_model makes it simulate the class name you pass it, and creates a default unique ID. Pat _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users