Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vgsantoniazzi/instance-factory
A gem for create a unique instace of FactoryGirl for associatons
https://github.com/vgsantoniazzi/instance-factory
Last synced: about 2 months ago
JSON representation
A gem for create a unique instace of FactoryGirl for associatons
- Host: GitHub
- URL: https://github.com/vgsantoniazzi/instance-factory
- Owner: vgsantoniazzi
- Created: 2014-05-14T03:11:41.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-19T13:36:32.000Z (about 9 years ago)
- Last Synced: 2024-10-18T08:39:02.272Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 35.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## 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 [email protected]: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
```ruby
FactoryGirl::SyntaxRunner.send(:include, InstanceFactory)
```Adjust your spec_helper
```ruby
RSpec.configure do |config|
config.include InstanceFactoryconfig.after(:each) do
instance_factory_clear!
end
end
```Or to include on default test of rails 4
```ruby
class ActiveSupport::TestCase
include InstanceFactory
endafter :each do
instance_factory_clear!
end
```## Contributing
I :heart: Open source!
[Follow github guides for forking a project](https://guides.github.com/activities/forking/)
[Follow github guides for contributing open source](https://guides.github.com/activities/contributing-to-open-source/#contributing)
## Code status
[![Build Status](https://travis-ci.org/vgsantoniazzi/instance-factory.svg?branch=master)](https://travis-ci.org/vgsantoniazzi/instance-factory)
## License
Gem is released under the [MIT license](http://opensource.org/licenses/MIT).