Displaying 1 result from an estimated 1 matches for "test_delegates".
2006 Dec 02
0
Fwd: Re: Mocha and ActiveRecord
...ns762 at gmail.com> wrote:
>>
>> Suppose I have an Order, which has_many OrderItems. Suppose I want to
>> write a test that checks that when I ask the Order to do something, it
>> asks its order items to do that something. I tried to do this like so:
>>
>> def test_delegates
>> order_items = []
>> 3.times {
>> item = mock("order item", :do_something => nil)
>> order_items.push(item)
>> }
>>
>> order = Order.new(:order_items => order_items)
>> order.do_something
&g...