Factory Girl - what's the purpose?

前端 未结 3 1274
陌清茗
陌清茗 2020-12-22 23:03

What\'s the purpose of Factory Girl in rspec tests when I could use before(:each) blocks? It feels like the only difference between Factory Girl and a bef

3条回答
  •  难免孤独
    2020-12-22 23:38

    also fixture definitions are global across your entire application. Factories can be local - so data specific to a isolated test case is in the setup for that particular context and not in a single global fixtures file.

    This book covers the subject very well if you want some more reading matter

提交回复
热议问题