Replace fixtures with factory girl in for generated scffold test cases

124 views Asked by At

I have generated a scaffold which auto generated specs for me,If I want to replace the default fixtures with factories of factory girl what is the procedure
If I replace the Model.create! with FactoryGirl.build(:model) Test cases fails for

GET #index assigns all tag_menus as @tag_menus
DELETE #destroy destroys the requested tag_menu
DELETE #destroy redirects to the tag_menus list
1

There are 1 answers

2
Andy Waite On BEST ANSWER

FactoryGirl.build doesn't persist to the database, you need FactoryGirl.create.