What "assigns"

I am currently in the study of rubies on rails and in the rspek test environment can anyone tell me what rspec is prescribed in this test

describe "GET index" do it "assigns all mymodel as @mymodel" do mymodel = Factory(:mymodel) get :index assigns(:mymodels).should eq([mymodel]) end end 
+4
source share
1 answer

assigns simply checks the value of the instance variables set in your controller.

Here he checks @mymodels .

+8
source

Source: https://habr.com/ru/post/1387737/


All Articles