The Programmer
        
        
          
        
      Factory Girl
Ruby on Rails 用 Factory Girl 自動產生 rspec 測資
安裝
在 Gemfile 加上以下的部分,然後執行 bundle。
| 1 | # Gemfile | 
設定
在 spec/support/factory_girl.rb 新增一個檔案,且加入以下的東西。
| 1 | # RSpec | 
然後在 spec/spec_helper.rb 的最前面加入以下行,使用 factory_girl 的設定檔。
| 1 | ## spec/spec_helper.rb |