I need simulate sending params in test, same as these inputs would send:
<input id="quantity" name="quantities[9671]" type="number" value="1" />
<input id="quantity" name="quantities[9822]" type="number" value="1" />
Test looks like this: (using Test Unit, the default testing framework in Rails):
test "placing item into basket"
cart = Cart.new(session)
post :create,
product_variant_ids: [@product.variants.first.id],
"quantities[#{@product.variants.first.id}]" => 1 # <<<------ not working
assert_equal 1, cart.items.count
end
Aucun commentaire:
Enregistrer un commentaire