Skip to content

Reload FactoryGirl factories

Andrew Nikolaev edited this page Jun 25, 2013 · 1 revision
# ./Gemfile
gem 'factory_girl_rails', require: false
# ./spec/spec_helper.rb
require 'factory_girl'

def zeus_running?
  File.exists? '.zeus.sock'
end

FactoryGirl.find_definitions unless zeus_running?
# ./custom_plan.rb
require 'zeus/rails'

class CustomPlan < Zeus::Rails
  def test
    require 'factory_girl'
    FactoryGirl.reload
    super
  end
end

Zeus.plan = CustomPlan.new