What does assign method do in testing?

assigns - Any objects that are stored as instance variables in
actions for use in views.


I have a code :-

test “should update line_item” do
patch :update, id:@line_item, line_item: {
cart_id:@line_item.cart_id, product_id:@line_item.product_id}
assert_redirected_to line_item_path(assigns(:line_item))

Does assigns(:line_item) give back an instance of the model LineItem
? I am bit confused with the use of the method assigns.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs