I am currently attempt to learn Ruby on Rails, and the testing framework RSpec. What does assigns do in this RSpec test?
describe "GET index" do
it "assigns all mymodel as @mymodel" do
mymodel = Factory(:mymodel)
get :index
assigns(:mymodels).should eq([mymodel])
end
end
assignssimply checks the value of the instance variables you set in your controller.Here it checks
@mymodels.