Skip to content

Instantly share code, notes, and snippets.

@costis
Forked from dolzenko/factory_girl_debugging.rb
Created January 10, 2013 15:45
Show Gist options
  • Save costis/4503011 to your computer and use it in GitHub Desktop.
Save costis/4503011 to your computer and use it in GitHub Desktop.
require 'factory_girl_rails'
require 'rspec'
require 'rspec-rails'
require 'rspec/mocks/standalone' # => if factories need stubs (for remote services for example)
include FactoryGirl::Syntax::Methods # make FG methods available at top level, so you can do `> create :user`
def reload_factories!
FactoryGirl.instance_variable_set(:@factories, nil) # => clear loaded factories/sequences
# FactoryGirl.instance_variable_set(:@sequences, nil)
load Rails.root.join('spec/factories.rb') # => loads factories again
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment