Skip to content

How can i stub a cart? #32

Description

@jpaulo

Hello,

in the process of implementing a rspec test for my controller, i need to stub a shopping cart, so that my "method" doesn't fail because of an empty cart. Is that possible? I've been trying to do something like

  allow_any_instance_of(CartItem).to receive(quantity: 1, item_type: "FrameItem", price: 60)

but this give me errors like " CartItem does not implement #quantity". Surely i am doing something wrong. Appreciate the help!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions