On 9 Apr 2008, at 12:22, Andy Croll wrote:
> it "should increment quantity when it does find a product" do
>
> @cart_item1
> .should_receive(:increment_quantity).once.with(:no_args).and_return(2)
>@cart.should_receive(:find_item_by_name).twice.with("Brown
> Trousers").and_return(nil, @
Chris Parsons wrote:
> it "should increment quantity when it does find a product" do
>@cart.should_receive(:find_items_by_name).with("name").and
> return(@product)
>@cart.add_product(@product)
>@cart.items.should have(1).item
> end
My final solution for this was to write...
describe
Chris Parsons wrote:
> I'm guessing this spec will fail with your current code as I don't
> think CartItem::new_from_product is working.
Wow. I've never had code I hadn't posted correctly debugged before. You
were absolutely right, thanks! Seems my testing approach in that spec
was somehow fakin
On 9 Apr 2008, at 06:25, Andy Croll wrote:
> current = self.items.find_by_name(product.name)
You're finding by the CartItem name and passing the product name - it
looks like that's drawing a blank match when you're expecting it not to.
How about a cart_item_spec.rb:
describe CartItem do