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
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
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs