Welcome to Instance Factory
Use current object for associations, preventing FactoryGirl creates a new one record in database. Works with FactoryGirl, RSpec and Minitest.
Getting Started
From rubygems:
Manually
gem install instance-factory
Gemfile
gem "instance-factory"
From source code:
git clone git@github.com:vgsantoniazzi/instance-factory.git
cd instance-factory
gem build --verbose instance-factory.gemspec
gem install instance-factory-version.gem
Usage
To include helper on FactoryGirl
FactoryGirl::SyntaxRunner.send(:include, InstanceFactory)
Adjust your spec_helper
RSpec.configure do |config|
config.include InstanceFactory
config.after(:each) do
instance_factory_clear!
end
end
Or to include on default test of rails 4
class ActiveSupport::TestCase
include InstanceFactory
end
after :each do
instance_factory_clear!
end
Contributing
I ❤️ Open source!
Follow github guides for forking a project
Follow github guides for contributing open source
Code status
License
Gem is released under the MIT license.