factory_bot-preload 0.2.1 โ 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +4 -0
- data/.github/FUNDING.yml +4 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +40 -0
- data/.github/ISSUE_TEMPLATE/config.yml +5 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +23 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +38 -0
- data/.github/dependabot.yml +20 -0
- data/.github/workflows/ruby-tests.yml +57 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +5 -1
- data/CODE_OF_CONDUCT.md +74 -0
- data/CONTRIBUTING.md +81 -0
- data/LICENSE.md +20 -0
- data/README.md +61 -34
- data/Rakefile +7 -4
- data/factory_bot-preload.gemspec +18 -3
- data/gemfiles/6_1.gemfile +5 -0
- data/gemfiles/7_0.gemfile +5 -0
- data/lib/factory_bot/preload/helpers.rb +15 -5
- data/lib/factory_bot/preload/minitest.rb +1 -0
- data/lib/factory_bot/preload/version.rb +1 -1
- data/lib/factory_bot/preload.rb +17 -15
- data/spec/factory_bot/preload_spec.rb +39 -4
- data/spec/spec_helper.rb +7 -5
- data/spec/support/app/app/models/models/asset.rb +6 -0
- data/spec/support/app/db/schema.rb +11 -8
- data/spec/support/factories.rb +5 -0
- data/test/factory_bot/preload_test.rb +28 -0
- data/test/test_helper.rb +7 -5
- metadata +34 -15
- data/.rspec +0 -1
- data/.travis.yml +0 -24
- data/lib/factory_bot-preload.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5cd0131b6a2d6dea0c8bc0bd89e58ebae69a106121a1a3606d9c4e0ce6b4e5
|
4
|
+
data.tar.gz: 06dbc270b82948a7fbb8a1bb0b0cc556249a8d482297e155ea1f56f60a818e5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57177f7079c553e105eba5004b817e166819e5d33e2649aca2308a17f1556fd069735b12bd0b5537b0a69049a371d4b681ed50628ecb7b0f0811733356db1ea9
|
7
|
+
data.tar.gz: 17e354ab4f1afda71aaeed92fe894be9fce31801ab2485e5af51c0dcbb854c52fe3ea7b330b0927cc9644d57f5653b1be4e27fc716c8208726443ba72024bedf
|
data/.github/CODEOWNERS
ADDED
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
name: "๐ Bug Report"
|
3
|
+
about: Report a reproducible bug or regression.
|
4
|
+
title: "Bug: "
|
5
|
+
labels: "Status: Unconfirmed"
|
6
|
+
---
|
7
|
+
|
8
|
+
<!--
|
9
|
+
- Please provide a clear and concise description of what the bug is.
|
10
|
+
- If possible, add an example reproducing your issue.
|
11
|
+
- Please test using the latest version of factory_bot-preload
|
12
|
+
to make sure your issue has not already been fixed.
|
13
|
+
-->
|
14
|
+
|
15
|
+
## Description
|
16
|
+
|
17
|
+
[Add bug description here]
|
18
|
+
|
19
|
+
## How to reproduce
|
20
|
+
|
21
|
+
[Add steps on how to reproduce this issue]
|
22
|
+
|
23
|
+
## What do you expect
|
24
|
+
|
25
|
+
[Describe what do you expect to happen]
|
26
|
+
|
27
|
+
## What happened instead
|
28
|
+
|
29
|
+
[Describe the actual results]
|
30
|
+
|
31
|
+
## Software:
|
32
|
+
|
33
|
+
- Gem version: [Add gem version here]
|
34
|
+
- Ruby version: [Add version here]
|
35
|
+
|
36
|
+
## Full backtrace
|
37
|
+
|
38
|
+
```text
|
39
|
+
[Paste full backtrace here]
|
40
|
+
```
|
@@ -0,0 +1,23 @@
|
|
1
|
+
---
|
2
|
+
name: "๐ก Feature request"
|
3
|
+
about: Have an idea that may be useful? Make a suggestion!
|
4
|
+
title: 'Feature Request: '
|
5
|
+
labels: 'Feature request'
|
6
|
+
|
7
|
+
---
|
8
|
+
|
9
|
+
## Description
|
10
|
+
|
11
|
+
_A clear and concise description of what the problem is._
|
12
|
+
|
13
|
+
## Describe the solution
|
14
|
+
|
15
|
+
_A clear and concise description of what you want to happen._
|
16
|
+
|
17
|
+
## Alternatives you considered
|
18
|
+
|
19
|
+
_A clear and concise description of any alternative solutions or features you've considered._
|
20
|
+
|
21
|
+
## Additional context
|
22
|
+
|
23
|
+
_Add any other context, screenshots, links, etc about the feature request here._
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<!--
|
2
|
+
If you're making a doc PR or something tiny where the below is irrelevant,
|
3
|
+
delete this template and use a short description, but in your description aim to
|
4
|
+
include both what the change is, and why it is being made, with enough context
|
5
|
+
for anyone to understand.
|
6
|
+
-->
|
7
|
+
|
8
|
+
<details>
|
9
|
+
<summary>PR Checklist</summary>
|
10
|
+
|
11
|
+
### PR Structure
|
12
|
+
|
13
|
+
- [ ] This PR has reasonably narrow scope (if not, break it down into smaller
|
14
|
+
PRs).
|
15
|
+
- [ ] This PR avoids mixing refactoring changes with feature changes (split into
|
16
|
+
two PRs otherwise).
|
17
|
+
- [ ] This PR's title starts is concise and descriptive.
|
18
|
+
|
19
|
+
### Thoroughness
|
20
|
+
|
21
|
+
- [ ] This PR adds tests for the most critical parts of the new functionality or
|
22
|
+
fixes.
|
23
|
+
- [ ] I've updated any docs, `.md` files, etcโฆ affected by this change.
|
24
|
+
|
25
|
+
</details>
|
26
|
+
|
27
|
+
### What
|
28
|
+
|
29
|
+
[TODO: Short statement about what is changing.]
|
30
|
+
|
31
|
+
### Why
|
32
|
+
|
33
|
+
[TODO: Why this change is being made. Include any context required to understand
|
34
|
+
the why.]
|
35
|
+
|
36
|
+
### Known limitations
|
37
|
+
|
38
|
+
[TODO or N/A]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
# Documentation:
|
3
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
4
|
+
|
5
|
+
version: 2
|
6
|
+
updates:
|
7
|
+
- package-ecosystem: "github-actions"
|
8
|
+
directory: "/"
|
9
|
+
schedule:
|
10
|
+
interval: "daily"
|
11
|
+
|
12
|
+
- package-ecosystem: npm
|
13
|
+
directory: "/"
|
14
|
+
schedule:
|
15
|
+
interval: "daily"
|
16
|
+
|
17
|
+
- package-ecosystem: bundler
|
18
|
+
directory: "/"
|
19
|
+
schedule:
|
20
|
+
interval: "daily"
|
@@ -0,0 +1,57 @@
|
|
1
|
+
---
|
2
|
+
name: ruby-tests
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request_target:
|
6
|
+
push:
|
7
|
+
branches:
|
8
|
+
- main
|
9
|
+
workflow_dispatch:
|
10
|
+
inputs: {}
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
build:
|
14
|
+
name: Tests with Ruby ${{ matrix.ruby }} and ${{ matrix.gemfile }}
|
15
|
+
runs-on: "ubuntu-latest"
|
16
|
+
if: |
|
17
|
+
github.actor == 'dependabot[bot]' && github.event_name == 'pull_request_target' ||
|
18
|
+
github.actor != 'dependabot[bot]'
|
19
|
+
strategy:
|
20
|
+
fail-fast: false
|
21
|
+
matrix:
|
22
|
+
ruby: ["2.7", "3.0", "3.1"]
|
23
|
+
gemfile:
|
24
|
+
- Gemfile
|
25
|
+
- gemfiles/7_0.gemfile
|
26
|
+
- gemfiles/6_1.gemfile
|
27
|
+
- gemfiles/6_0.gemfile
|
28
|
+
- gemfiles/5_2.gemfile
|
29
|
+
|
30
|
+
steps:
|
31
|
+
- uses: actions/checkout@v3
|
32
|
+
|
33
|
+
- uses: actions/cache@v2
|
34
|
+
with:
|
35
|
+
path: vendor/bundle
|
36
|
+
key: >
|
37
|
+
${{ runner.os }}-${{ matrix.ruby }}-gems-${{
|
38
|
+
hashFiles(matrix.gemfile) }}
|
39
|
+
|
40
|
+
- name: Set up Ruby
|
41
|
+
uses: ruby/setup-ruby@v1
|
42
|
+
with:
|
43
|
+
ruby-version: ${{ matrix.ruby }}
|
44
|
+
|
45
|
+
- name: Install gem dependencies
|
46
|
+
env:
|
47
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
48
|
+
run: |
|
49
|
+
gem install bundler
|
50
|
+
bundle config path vendor/bundle
|
51
|
+
bundle update --jobs 4 --retry 3
|
52
|
+
|
53
|
+
- name: Run Tests
|
54
|
+
env:
|
55
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
56
|
+
run: |
|
57
|
+
bundle exec rake
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at me@fnando.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# Contributing to factory_bot-preload
|
2
|
+
|
3
|
+
๐๐ First off, thanks for taking the time to contribute! ๐๐
|
4
|
+
|
5
|
+
The following is a set of guidelines for contributing to this project. These are
|
6
|
+
mostly guidelines, not rules. Use your best judgment, and feel free to propose
|
7
|
+
changes to this document in a pull request.
|
8
|
+
|
9
|
+
## Code of Conduct
|
10
|
+
|
11
|
+
Everyone interacting in this project's codebases, issue trackers, chat rooms and
|
12
|
+
mailing lists is expected to follow the
|
13
|
+
[code of conduct](https://github.com/fnando/factory_bot-preload/blob/main/CODE_OF_CONDUCT.md).
|
14
|
+
|
15
|
+
## Reporting bugs
|
16
|
+
|
17
|
+
This section guides you through submitting a bug report. Following these
|
18
|
+
guidelines helps maintainers and the community understand your report, reproduce
|
19
|
+
the behavior, and find related reports.
|
20
|
+
|
21
|
+
- Before creating bug reports, please check the open issues; somebody may
|
22
|
+
already have submitted something similar, and you may not need to create a new
|
23
|
+
one.
|
24
|
+
- When you are creating a bug report, please include as many details as
|
25
|
+
possible, with an example reproducing the issue.
|
26
|
+
|
27
|
+
## Contributing with code
|
28
|
+
|
29
|
+
Before making any radicals changes, please make sure you discuss your intention
|
30
|
+
by
|
31
|
+
[opening an issue on Github](https://github.com/fnando/factory_bot-preload/issues).
|
32
|
+
|
33
|
+
When you're ready to make your pull request, follow checklist below to make sure
|
34
|
+
your contribution is according to how this project works.
|
35
|
+
|
36
|
+
1. [Fork](https://help.github.com/forking/) factory_bot-preload
|
37
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
38
|
+
3. Make your changes using [descriptive commit messages](#commit-messages)
|
39
|
+
4. Update CHANGELOG.md describing your changes by adding an entry to the
|
40
|
+
"Unreleased" section. If this section is not available, create one right
|
41
|
+
before the last version.
|
42
|
+
5. Push to your branch - `git push origin my_branch`
|
43
|
+
6. [Create a pull request](https://help.github.com/articles/creating-a-pull-request)
|
44
|
+
7. That's it!
|
45
|
+
|
46
|
+
## Styleguides
|
47
|
+
|
48
|
+
### Commit messages
|
49
|
+
|
50
|
+
- Use the present tense ("Add feature" not "Added feature")
|
51
|
+
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
|
52
|
+
- Limit the first line to 72 characters or less
|
53
|
+
- Reference issues and pull requests liberally after the first line
|
54
|
+
|
55
|
+
### Changelog
|
56
|
+
|
57
|
+
- Add a message describing your changes to the "Unreleased" section. The
|
58
|
+
changelog message should follow the same style as the commit message.
|
59
|
+
- Prefix your message with one of the following:
|
60
|
+
- `[Added]` for new features.
|
61
|
+
- `[Changed]` for changes in existing functionality.
|
62
|
+
- `[Deprecated]` for soon-to-be removed features.
|
63
|
+
- `[Removed]` for now removed features.
|
64
|
+
- `[Fixed]` for any bug fixes.
|
65
|
+
- `[Security]` in case of vulnerabilities.
|
66
|
+
|
67
|
+
### Ruby code
|
68
|
+
|
69
|
+
- This project uses [Rubocop](https://rubocop.org) to enforce code style. Before
|
70
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
71
|
+
the expected style by running `rake`.
|
72
|
+
- Do not change the library version. This will be done by the maintainer
|
73
|
+
whenever a new version is about to be released.
|
74
|
+
|
75
|
+
### JavaScript code
|
76
|
+
|
77
|
+
- This project uses [ESLint](https://eslint.org) to enforce code style. Before
|
78
|
+
submitting your changes, make sure your tests are passing and code conforms to
|
79
|
+
the expected style by running `yarn test:ci`.
|
80
|
+
- Do not change the library version. This will be done by the maintainer
|
81
|
+
whenever a new version is about to be released.
|
data/LICENSE.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Nando Vieira
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,16 +1,20 @@
|
|
1
1
|
# factory_bot-preload
|
2
2
|
|
3
|
-
[![
|
4
|
-
[![Code Climate](https://codeclimate.com/github/fnando/factory_bot-preload/badges/gpa.svg)](https://codeclimate.com/github/fnando/factory_bot-preload)
|
5
|
-
[![Test Coverage](https://codeclimate.com/github/fnando/factory_bot-preload/badges/coverage.svg)](https://codeclimate.com/github/fnando/factory_bot-preload/coverage)
|
3
|
+
[![ruby-tests](https://github.com/fnando/factory_bot-preload/actions/workflows/ruby-tests.yml/badge.svg)](https://github.com/fnando/factory_bot-preload/actions/workflows/ruby-tests.yml)
|
6
4
|
[![Gem](https://img.shields.io/gem/v/factory_bot-preload.svg)](https://rubygems.org/gems/factory_bot-preload)
|
7
5
|
[![Gem](https://img.shields.io/gem/dt/factory_bot-preload.svg)](https://rubygems.org/gems/factory_bot-preload)
|
8
6
|
|
9
|
-
We all love Rails fixtures because they're fast, but we hate to deal with
|
7
|
+
We all love Rails fixtures because they're fast, but we hate to deal with
|
8
|
+
YAML/CSV/SQL files. Here enters
|
9
|
+
[factory_bot](https://rubygems.org/gems/factory_bot) (FB).
|
10
10
|
|
11
|
-
Now, you can easily create records by using predefined factories. The problem is
|
11
|
+
Now, you can easily create records by using predefined factories. The problem is
|
12
|
+
that hitting the database everytime to create records is pretty slow. And
|
13
|
+
believe me, you'll feel the pain when you have lots of tests/specs.
|
12
14
|
|
13
|
-
So here enters Factory Bot Preload (FBP). You can define which factories will be
|
15
|
+
So here enters Factory Bot Preload (FBP). You can define which factories will be
|
16
|
+
preloaded, so you don't have to recreate it every time (that will work for
|
17
|
+
99.37% of the time, according to statistics I just made up).
|
14
18
|
|
15
19
|
## Installation
|
16
20
|
|
@@ -18,7 +22,7 @@ So here enters Factory Bot Preload (FBP). You can define which factories will be
|
|
18
22
|
|
19
23
|
## Intructions
|
20
24
|
|
21
|
-
###
|
25
|
+
### Setup
|
22
26
|
|
23
27
|
Add both FB and FBP to your Gemfile:
|
24
28
|
|
@@ -30,20 +34,30 @@ gem "pg"
|
|
30
34
|
|
31
35
|
group :test, :development do
|
32
36
|
gem "factory_bot"
|
33
|
-
gem "factory_bot-preload"
|
37
|
+
gem "factory_bot-preload", require: false
|
34
38
|
end
|
35
39
|
```
|
36
40
|
|
41
|
+
Notice that adding `require: false` is important; otherwise you won't be able to
|
42
|
+
run commands such as `rails db:test:prepare`.
|
43
|
+
|
37
44
|
### RSpec Setup
|
38
45
|
|
39
|
-
On your `spec/spec_helper.rb` file, make sure that transactional fixtures are
|
46
|
+
On your `spec/spec_helper.rb` file, make sure that transactional fixtures are
|
47
|
+
enabled. Here's is my file without all those RSpec comments:
|
40
48
|
|
41
49
|
```ruby
|
42
50
|
ENV["RAILS_ENV"] ||= "test"
|
43
51
|
require File.expand_path("../../config/environment", __FILE__)
|
44
52
|
require "rspec/rails"
|
45
53
|
|
46
|
-
|
54
|
+
# First, load factory_bot/preload.
|
55
|
+
require "factory_bot/preload"
|
56
|
+
|
57
|
+
# Then load your factories
|
58
|
+
Dir[Rails.root.join("spec/support/factories/**/*.rb")].each do |file|
|
59
|
+
require file
|
60
|
+
end
|
47
61
|
|
48
62
|
RSpec.configure do |config|
|
49
63
|
config.use_transactional_fixtures = true
|
@@ -51,9 +65,21 @@ RSpec.configure do |config|
|
|
51
65
|
end
|
52
66
|
```
|
53
67
|
|
68
|
+
You may want to configure the generated helper names. For instance, imagine you
|
69
|
+
have a namespace like `MyApp::Models::User`. That'd generate a helper method
|
70
|
+
like `myapp_models_user`. If you don't have conflicting names, you can strip
|
71
|
+
`myapp_models_` like this:
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
FactoryBot::Preload.helper_name = lambda do |class_name, helper_name|
|
75
|
+
helper_name.gsub(/^myapp_models_/, "")
|
76
|
+
end
|
77
|
+
```
|
78
|
+
|
54
79
|
### Minitest Setup
|
55
80
|
|
56
|
-
On your `test/test_helper.rb` file, make sure that transaction fixtures are
|
81
|
+
On your `test/test_helper.rb` file, make sure that transaction fixtures are
|
82
|
+
enabled. Here's what your file may look like:
|
57
83
|
|
58
84
|
```ruby
|
59
85
|
ENV["RAILS_ENV"] ||= "test"
|
@@ -82,7 +108,9 @@ FactoryBot::Preload.minitest
|
|
82
108
|
|
83
109
|
### Usage
|
84
110
|
|
85
|
-
Create your factories and load it from your setup file (either
|
111
|
+
Create your factories and load it from your setup file (either
|
112
|
+
`test/test_helper.rb` or `spec/spec_helper.rb`) You may have something like
|
113
|
+
this:
|
86
114
|
|
87
115
|
```ruby
|
88
116
|
FactoryBot.define do
|
@@ -145,7 +173,8 @@ FactoryBot.define do
|
|
145
173
|
end
|
146
174
|
```
|
147
175
|
|
148
|
-
Like Rails fixtures, FBP will define methods for each model. You can use it on
|
176
|
+
Like Rails fixtures, FBP will define methods for each model. You can use it on
|
177
|
+
your examples and alike.
|
149
178
|
|
150
179
|
```ruby
|
151
180
|
require "test_helper"
|
@@ -183,27 +212,25 @@ That's it!
|
|
183
212
|
|
184
213
|
## Maintainer
|
185
214
|
|
186
|
-
|
215
|
+
- [Nando Vieira](https://github.com/fnando)
|
216
|
+
|
217
|
+
## Contributors
|
218
|
+
|
219
|
+
- https://github.com/fnando/factory_bot-preload/contributors
|
220
|
+
|
221
|
+
## Contributing
|
222
|
+
|
223
|
+
For more details about how to contribute, please read
|
224
|
+
https://github.com/fnando/factory_bot-preload/blob/main/CONTRIBUTING.md.
|
187
225
|
|
188
226
|
## License
|
189
227
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
The above copyright notice and this permission notice shall be
|
201
|
-
included in all copies or substantial portions of the Software.
|
202
|
-
|
203
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
204
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
205
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
206
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
207
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
208
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
209
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
228
|
+
The gem is available as open source under the terms of the
|
229
|
+
[MIT License](https://opensource.org/licenses/MIT). A copy of the license can be
|
230
|
+
found at https://github.com/fnando/factory_bot-preload/blob/main/LICENSE.md.
|
231
|
+
|
232
|
+
## Code of Conduct
|
233
|
+
|
234
|
+
Everyone interacting in the factory_bot-preload project's codebases, issue
|
235
|
+
trackers, chat rooms and mailing lists is expected to follow the
|
236
|
+
[code of conduct](https://github.com/fnando/factory_bot-preload/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,13 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "bundler/gem_tasks"
|
4
|
+
require "rubocop/rake_task"
|
5
|
+
|
6
|
+
RuboCop::RakeTask.new
|
4
7
|
|
5
8
|
case ENV["TEST_FRAMEWORK"]
|
6
9
|
when "rspec"
|
7
10
|
require "rspec/core/rake_task"
|
8
11
|
RSpec::Core::RakeTask.new
|
9
12
|
|
10
|
-
task default:
|
13
|
+
task default: %i[spec rubocop]
|
11
14
|
when "minitest"
|
12
15
|
require "rake/testtask"
|
13
16
|
|
@@ -19,10 +22,10 @@ when "minitest"
|
|
19
22
|
t.warning = false
|
20
23
|
end
|
21
24
|
|
22
|
-
task default:
|
25
|
+
task default: %i[test rubocop]
|
23
26
|
else
|
24
27
|
task :default do
|
25
|
-
system "TEST_FRAMEWORK=rspec bundle exec rake
|
26
|
-
system "TEST_FRAMEWORK=minitest bundle exec rake
|
28
|
+
system "TEST_FRAMEWORK=rspec bundle exec rake"
|
29
|
+
system "TEST_FRAMEWORK=minitest bundle exec rake"
|
27
30
|
end
|
28
31
|
end
|
data/factory_bot-preload.gemspec
CHANGED
@@ -9,17 +9,32 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.authors = ["Nando Vieira"]
|
10
10
|
s.email = ["fnando.vieira@gmail.com"]
|
11
11
|
s.homepage = "http://rubygems.org/gems/factory_bot-preload"
|
12
|
-
s.summary = "Preload factories (Factory Bot) just like fixtures.
|
12
|
+
s.summary = "Preload factories (Factory Bot) just like fixtures. " \
|
13
|
+
"It will be easier and, probably, faster!"
|
13
14
|
s.description = s.summary
|
15
|
+
s.required_ruby_version = ">= 2.7"
|
14
16
|
|
15
17
|
s.files = `git ls-files`.split("\n")
|
16
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map do |f|
|
20
|
+
File.basename(f)
|
21
|
+
end
|
18
22
|
s.require_paths = ["lib"]
|
19
23
|
|
20
24
|
s.add_dependency "activerecord"
|
21
25
|
s.add_dependency "factory_bot"
|
22
26
|
|
27
|
+
github_url = "https://github.com/fnando/factory_bot-preload"
|
28
|
+
github_tree_url = "#{github_url}/tree/v#{s.version}"
|
29
|
+
|
30
|
+
s.metadata["homepage_uri"] = s.homepage
|
31
|
+
s.metadata["bug_tracker_uri"] = "#{github_url}/issues"
|
32
|
+
s.metadata["source_code_uri"] = github_tree_url
|
33
|
+
s.metadata["changelog_uri"] = "#{github_tree_url}/CHANGELOG.md"
|
34
|
+
s.metadata["documentation_uri"] = "#{github_tree_url}/README.md"
|
35
|
+
s.metadata["license_uri"] = "#{github_tree_url}/LICENSE.md"
|
36
|
+
s.metadata["rubygems_mfa_required"] = "true"
|
37
|
+
|
23
38
|
s.add_development_dependency "bundler"
|
24
39
|
s.add_development_dependency "minitest-utils"
|
25
40
|
s.add_development_dependency "pry-meta"
|
@@ -29,5 +44,5 @@ Gem::Specification.new do |s|
|
|
29
44
|
s.add_development_dependency "rubocop"
|
30
45
|
s.add_development_dependency "rubocop-fnando"
|
31
46
|
s.add_development_dependency "simplecov"
|
32
|
-
s.add_development_dependency "sqlite3"
|
47
|
+
s.add_development_dependency "sqlite3"
|
33
48
|
end
|
@@ -8,16 +8,25 @@ module FactoryBot
|
|
8
8
|
def self.load_models
|
9
9
|
return unless defined?(Rails)
|
10
10
|
|
11
|
-
|
11
|
+
models_path = Rails.application.root.join("app/models/**/*.rb")
|
12
|
+
|
13
|
+
Dir[models_path].sort.each do |file|
|
12
14
|
require_dependency file
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.define_helper_methods
|
17
19
|
ActiveRecord::Base.descendants.each do |model|
|
18
|
-
|
20
|
+
next if FactoryBot::Preload.reserved_tables.include?(model.table_name)
|
21
|
+
|
22
|
+
helper_name = model.name.underscore.tr("/", "_").pluralize
|
23
|
+
|
24
|
+
helper_name = FactoryBot::Preload.helper_name.call(
|
25
|
+
model.name,
|
26
|
+
helper_name
|
27
|
+
)
|
19
28
|
|
20
|
-
define_method(
|
29
|
+
define_method(helper_name) do |name|
|
21
30
|
factory(name, model)
|
22
31
|
end
|
23
32
|
end
|
@@ -28,7 +37,7 @@ module FactoryBot
|
|
28
37
|
end
|
29
38
|
|
30
39
|
def factory(name, model = nil, &block)
|
31
|
-
if
|
40
|
+
if block
|
32
41
|
factory_set(name, &block)
|
33
42
|
else
|
34
43
|
factory_get(name, model)
|
@@ -44,7 +53,8 @@ module FactoryBot
|
|
44
53
|
end
|
45
54
|
|
46
55
|
unless factory
|
47
|
-
raise "Couldn't find #{name.inspect} factory
|
56
|
+
raise "Couldn't find #{name.inspect} factory " \
|
57
|
+
"for #{model.name.inspect} model"
|
48
58
|
end
|
49
59
|
|
50
60
|
factory
|
data/lib/factory_bot/preload.rb
CHANGED
@@ -5,6 +5,22 @@ require "active_record"
|
|
5
5
|
|
6
6
|
module FactoryBot
|
7
7
|
module Preload
|
8
|
+
class << self
|
9
|
+
attr_accessor :preloaders, :factories, :record_ids, :clean_with,
|
10
|
+
:default_helper_name, :helper_name, :reserved_tables
|
11
|
+
end
|
12
|
+
|
13
|
+
self.preloaders = []
|
14
|
+
self.factories = {}
|
15
|
+
self.record_ids = {}
|
16
|
+
self.clean_with = :truncation
|
17
|
+
self.default_helper_name = ->(_class_name, helper_name) { helper_name }
|
18
|
+
self.helper_name = default_helper_name
|
19
|
+
self.reserved_tables = %w[
|
20
|
+
ar_internal_metadata
|
21
|
+
schema_migrations
|
22
|
+
]
|
23
|
+
|
8
24
|
require "factory_bot/preload/helpers"
|
9
25
|
require "factory_bot/preload/version"
|
10
26
|
require "factory_bot/preload/rspec" if defined?(RSpec)
|
@@ -16,18 +32,6 @@ module FactoryBot
|
|
16
32
|
::FactoryBot::SyntaxRunner.include ::FactoryBot::Preload::Helpers
|
17
33
|
end
|
18
34
|
|
19
|
-
class << self
|
20
|
-
attr_accessor :preloaders
|
21
|
-
attr_accessor :factories
|
22
|
-
attr_accessor :record_ids
|
23
|
-
attr_accessor :clean_with
|
24
|
-
end
|
25
|
-
|
26
|
-
self.preloaders = []
|
27
|
-
self.factories = {}
|
28
|
-
self.record_ids = {}
|
29
|
-
self.clean_with = :truncation
|
30
|
-
|
31
35
|
def self.active_record
|
32
36
|
ActiveRecord::Base
|
33
37
|
end
|
@@ -66,9 +70,7 @@ module FactoryBot
|
|
66
70
|
end
|
67
71
|
|
68
72
|
def self.active_record_names
|
69
|
-
|
70
|
-
reserved_tables = %w[ar_internal_metadata schema_migrations]
|
71
|
-
names.reject {|name| reserved_tables.include?(name) }
|
73
|
+
connection.tables.reject {|name| reserved_tables.include?(name) }
|
72
74
|
end
|
73
75
|
|
74
76
|
def self.reload_factories
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe FactoryBot::Preload do
|
4
6
|
it "queues preloader block" do
|
5
|
-
block = proc {}
|
7
|
+
block = proc { }
|
6
8
|
FactoryBot.preload(&block)
|
7
9
|
expect(FactoryBot::Preload.preloaders).to include(block)
|
8
10
|
end
|
@@ -37,12 +39,43 @@ describe FactoryBot::Preload do
|
|
37
39
|
end
|
38
40
|
|
39
41
|
it "raises error for missing factories" do
|
40
|
-
expect
|
42
|
+
expect do
|
43
|
+
users(:mary)
|
44
|
+
end.to raise_error(%[Couldn't find :mary factory for "User" model])
|
41
45
|
end
|
42
46
|
|
43
47
|
it "raises error for missing clean type" do
|
44
48
|
FactoryBot::Preload.clean_with = :invalid
|
45
|
-
expect
|
49
|
+
expect do
|
50
|
+
FactoryBot::Preload.clean
|
51
|
+
end.to raise_error(%[Couldn't find invalid clean type])
|
52
|
+
end
|
53
|
+
|
54
|
+
it "ignores reserved table names when creating helpers" do
|
55
|
+
mod = Module.new do
|
56
|
+
include FactoryBot::Preload::Helpers
|
57
|
+
end
|
58
|
+
|
59
|
+
instance = Object.new.extend(mod)
|
60
|
+
|
61
|
+
expect(instance).not_to respond_to(:active_record_internal_metadata)
|
62
|
+
expect(instance).not_to respond_to(:active_record_schema_migrations)
|
63
|
+
expect(instance).not_to respond_to(:primary_schema_migrations)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "processes helper name" do
|
67
|
+
FactoryBot::Preload.helper_name = lambda do |_class_name, helper_name|
|
68
|
+
helper_name.gsub(/^models_/, "")
|
69
|
+
end
|
70
|
+
|
71
|
+
mod = Module.new do
|
72
|
+
include FactoryBot::Preload::Helpers
|
73
|
+
end
|
74
|
+
|
75
|
+
instance = Object.new.extend(mod)
|
76
|
+
|
77
|
+
expect(instance).to respond_to(:assets)
|
78
|
+
expect(assets(:asset).name).to eq("Some asset")
|
46
79
|
end
|
47
80
|
|
48
81
|
example "association uses preloaded record" do
|
@@ -97,6 +130,8 @@ describe FactoryBot::Preload do
|
|
97
130
|
end
|
98
131
|
|
99
132
|
it "includes helpers into factory_bot" do
|
100
|
-
|
133
|
+
helpers_module = FactoryBot::Preload::Helpers
|
134
|
+
|
135
|
+
expect(FactoryBot::SyntaxRunner.included_modules).to include(helpers_module)
|
101
136
|
end
|
102
137
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "simplecov"
|
4
|
-
SimpleCov.start
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter(/schema\.rb/)
|
6
|
+
end
|
5
7
|
|
6
8
|
ENV["RAILS_ENV"] = "test"
|
7
|
-
ENV["BUNDLE_GEMFILE"] = File.dirname(__FILE__)
|
9
|
+
ENV["BUNDLE_GEMFILE"] = "#{File.dirname(__FILE__)}/../Gemfile"
|
8
10
|
ENV["DATABASE_URL"] = "sqlite3::memory:"
|
9
11
|
|
10
12
|
require "bundler/setup"
|
@@ -18,7 +20,7 @@ require "rails/test_unit/railtie"
|
|
18
20
|
|
19
21
|
module RSpec
|
20
22
|
class Application < ::Rails::Application
|
21
|
-
config.root = File.dirname(__FILE__)
|
23
|
+
config.root = "#{File.dirname(__FILE__)}/support/app"
|
22
24
|
config.active_support.deprecation = :log
|
23
25
|
config.eager_load = false
|
24
26
|
end
|
@@ -27,7 +29,7 @@ end
|
|
27
29
|
RSpec::Application.initialize!
|
28
30
|
ActiveRecord::Migration.verbose = true
|
29
31
|
ActiveRecord::Base.establish_connection ENV["DATABASE_URL"]
|
30
|
-
load File.dirname(__FILE__)
|
32
|
+
load "#{File.dirname(__FILE__)}/support/app/db/schema.rb"
|
31
33
|
|
32
34
|
require "rspec/rails"
|
33
35
|
|
@@ -36,4 +38,4 @@ RSpec.configure do |config|
|
|
36
38
|
end
|
37
39
|
|
38
40
|
require "factory_bot/preload"
|
39
|
-
require File.dirname(__FILE__)
|
41
|
+
require "#{File.dirname(__FILE__)}/support/factories"
|
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
ActiveRecord::Schema.define(version: 0) do
|
4
4
|
begin
|
5
|
-
drop_table :users
|
6
|
-
drop_table :skills
|
7
|
-
drop_table :preloads
|
8
|
-
drop_table :categories
|
9
|
-
drop_table :categories_users
|
10
|
-
|
5
|
+
drop_table :users if table_exists?(:users)
|
6
|
+
drop_table :skills if table_exists?(:skills)
|
7
|
+
drop_table :preloads if table_exists?(:preloads)
|
8
|
+
drop_table :categories if table_exists?(:categories)
|
9
|
+
drop_table :categories_users if table_exists?(:categories_users)
|
10
|
+
drop_table :assets if table_exists?(:assets)
|
11
11
|
end
|
12
12
|
|
13
13
|
create_table :users do |t|
|
@@ -26,11 +26,14 @@ ActiveRecord::Schema.define(version: 0) do
|
|
26
26
|
t.references :user
|
27
27
|
end
|
28
28
|
|
29
|
-
create_table :categories
|
30
|
-
end
|
29
|
+
create_table :categories
|
31
30
|
|
32
31
|
create_table :categories_users, id: false do |t|
|
33
32
|
t.references :category
|
34
33
|
t.references :user
|
35
34
|
end
|
35
|
+
|
36
|
+
create_table :assets do |t|
|
37
|
+
t.string :name
|
38
|
+
end
|
36
39
|
end
|
data/spec/support/factories.rb
CHANGED
@@ -16,9 +16,14 @@ FactoryBot.define do
|
|
16
16
|
name { "My Preload" }
|
17
17
|
end
|
18
18
|
|
19
|
+
factory :asset, class: "Models::Asset" do
|
20
|
+
name { "Some asset" }
|
21
|
+
end
|
22
|
+
|
19
23
|
preload do
|
20
24
|
factory(:john) { create(:user) }
|
21
25
|
factory(:ruby) { create(:skill, user: users(:john)) }
|
22
26
|
factory(:my) { create(:preload) }
|
27
|
+
factory(:asset) { create(:asset) }
|
23
28
|
end
|
24
29
|
end
|
@@ -5,6 +5,7 @@ require "test_helper"
|
|
5
5
|
class PreloadTest < ActiveSupport::TestCase
|
6
6
|
setup do
|
7
7
|
FactoryBot::Preload.clean_with = :truncation
|
8
|
+
FactoryBot::Preload.helper_name = FactoryBot::Preload.default_helper_name
|
8
9
|
end
|
9
10
|
|
10
11
|
test "queues preloader block" do
|
@@ -100,4 +101,31 @@ class PreloadTest < ActiveSupport::TestCase
|
|
100
101
|
assert_equal 0, users(:john).invitations
|
101
102
|
refute users(:john).frozen?
|
102
103
|
end
|
104
|
+
|
105
|
+
test "ignores reserved table names" do
|
106
|
+
mod = Module.new do
|
107
|
+
include FactoryBot::Preload::Helpers
|
108
|
+
end
|
109
|
+
|
110
|
+
instance = Object.new.extend(mod)
|
111
|
+
|
112
|
+
refute_respond_to instance, :active_record_internal_metadata
|
113
|
+
refute_respond_to instance, :active_record_schema_migrations
|
114
|
+
refute_respond_to instance, :primary_schema_migrations
|
115
|
+
end
|
116
|
+
|
117
|
+
test "processes helper name" do
|
118
|
+
FactoryBot::Preload.helper_name = lambda do |_class_name, helper_name|
|
119
|
+
helper_name.gsub(/^models_/, "")
|
120
|
+
end
|
121
|
+
|
122
|
+
mod = Module.new do
|
123
|
+
include FactoryBot::Preload::Helpers
|
124
|
+
end
|
125
|
+
|
126
|
+
instance = Object.new.extend(mod)
|
127
|
+
|
128
|
+
assert_respond_to instance, :assets
|
129
|
+
assert_equal "Some asset", assets(:asset).name
|
130
|
+
end
|
103
131
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "simplecov"
|
4
|
-
SimpleCov.start
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter(/schema\.rb/)
|
6
|
+
end
|
5
7
|
|
6
8
|
ENV["RAILS_ENV"] = "test"
|
7
|
-
ENV["BUNDLE_GEMFILE"] = File.dirname(__FILE__)
|
9
|
+
ENV["BUNDLE_GEMFILE"] = "#{File.dirname(__FILE__)}/../Gemfile"
|
8
10
|
ENV["DATABASE_URL"] = "sqlite3::memory:"
|
9
11
|
|
10
12
|
require "bundler/setup"
|
@@ -20,7 +22,7 @@ require "minitest/utils"
|
|
20
22
|
|
21
23
|
class SampleApplication < ::Rails::Application
|
22
24
|
config.api = true
|
23
|
-
config.root = __dir__
|
25
|
+
config.root = "#{__dir__}/../spec/support/app"
|
24
26
|
config.active_support.deprecation = :log
|
25
27
|
config.eager_load = false
|
26
28
|
end
|
@@ -30,7 +32,7 @@ require "rails/test_help"
|
|
30
32
|
|
31
33
|
ActiveRecord::Migration.verbose = true
|
32
34
|
ActiveRecord::Base.establish_connection ENV["DATABASE_URL"]
|
33
|
-
load __dir__
|
35
|
+
load "#{__dir__}/../spec/support/app/db/schema.rb"
|
34
36
|
|
35
37
|
module ActiveSupport
|
36
38
|
class TestCase
|
@@ -39,6 +41,6 @@ module ActiveSupport
|
|
39
41
|
end
|
40
42
|
|
41
43
|
require "factory_bot/preload"
|
42
|
-
require __dir__
|
44
|
+
require "#{__dir__}/../spec/support/factories"
|
43
45
|
|
44
46
|
FactoryBot::Preload.minitest
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_bot-preload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -168,16 +168,16 @@ dependencies:
|
|
168
168
|
name: sqlite3
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- - "
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- - "
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '0'
|
181
181
|
description: Preload factories (Factory Bot) just like fixtures. It will be easier
|
182
182
|
and, probably, faster!
|
183
183
|
email:
|
@@ -186,17 +186,27 @@ executables: []
|
|
186
186
|
extensions: []
|
187
187
|
extra_rdoc_files: []
|
188
188
|
files:
|
189
|
+
- ".github/CODEOWNERS"
|
190
|
+
- ".github/FUNDING.yml"
|
191
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
192
|
+
- ".github/ISSUE_TEMPLATE/config.yml"
|
193
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
194
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
195
|
+
- ".github/dependabot.yml"
|
196
|
+
- ".github/workflows/ruby-tests.yml"
|
189
197
|
- ".gitignore"
|
190
|
-
- ".rspec"
|
191
198
|
- ".rubocop.yml"
|
192
|
-
-
|
199
|
+
- CODE_OF_CONDUCT.md
|
200
|
+
- CONTRIBUTING.md
|
193
201
|
- Gemfile
|
202
|
+
- LICENSE.md
|
194
203
|
- README.md
|
195
204
|
- Rakefile
|
196
205
|
- factory_bot-preload.gemspec
|
197
206
|
- gemfiles/5_2.gemfile
|
198
207
|
- gemfiles/6_0.gemfile
|
199
|
-
-
|
208
|
+
- gemfiles/6_1.gemfile
|
209
|
+
- gemfiles/7_0.gemfile
|
200
210
|
- lib/factory_bot/preload.rb
|
201
211
|
- lib/factory_bot/preload/extension.rb
|
202
212
|
- lib/factory_bot/preload/helpers.rb
|
@@ -206,6 +216,7 @@ files:
|
|
206
216
|
- spec/factory_bot/preload_spec.rb
|
207
217
|
- spec/spec_helper.rb
|
208
218
|
- spec/support/app/app/models/category.rb
|
219
|
+
- spec/support/app/app/models/models/asset.rb
|
209
220
|
- spec/support/app/app/models/preload.rb
|
210
221
|
- spec/support/app/app/models/skill.rb
|
211
222
|
- spec/support/app/app/models/user.rb
|
@@ -216,8 +227,15 @@ files:
|
|
216
227
|
- test/test_helper.rb
|
217
228
|
homepage: http://rubygems.org/gems/factory_bot-preload
|
218
229
|
licenses: []
|
219
|
-
metadata:
|
220
|
-
|
230
|
+
metadata:
|
231
|
+
homepage_uri: http://rubygems.org/gems/factory_bot-preload
|
232
|
+
bug_tracker_uri: https://github.com/fnando/factory_bot-preload/issues
|
233
|
+
source_code_uri: https://github.com/fnando/factory_bot-preload/tree/v0.3.1
|
234
|
+
changelog_uri: https://github.com/fnando/factory_bot-preload/tree/v0.3.1/CHANGELOG.md
|
235
|
+
documentation_uri: https://github.com/fnando/factory_bot-preload/tree/v0.3.1/README.md
|
236
|
+
license_uri: https://github.com/fnando/factory_bot-preload/tree/v0.3.1/LICENSE.md
|
237
|
+
rubygems_mfa_required: 'true'
|
238
|
+
post_install_message:
|
221
239
|
rdoc_options: []
|
222
240
|
require_paths:
|
223
241
|
- lib
|
@@ -225,15 +243,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
225
243
|
requirements:
|
226
244
|
- - ">="
|
227
245
|
- !ruby/object:Gem::Version
|
228
|
-
version: '
|
246
|
+
version: '2.7'
|
229
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
248
|
requirements:
|
231
249
|
- - ">="
|
232
250
|
- !ruby/object:Gem::Version
|
233
251
|
version: '0'
|
234
252
|
requirements: []
|
235
|
-
rubygems_version: 3.
|
236
|
-
signing_key:
|
253
|
+
rubygems_version: 3.3.7
|
254
|
+
signing_key:
|
237
255
|
specification_version: 4
|
238
256
|
summary: Preload factories (Factory Bot) just like fixtures. It will be easier and,
|
239
257
|
probably, faster!
|
@@ -241,6 +259,7 @@ test_files:
|
|
241
259
|
- spec/factory_bot/preload_spec.rb
|
242
260
|
- spec/spec_helper.rb
|
243
261
|
- spec/support/app/app/models/category.rb
|
262
|
+
- spec/support/app/app/models/models/asset.rb
|
244
263
|
- spec/support/app/app/models/preload.rb
|
245
264
|
- spec/support/app/app/models/skill.rb
|
246
265
|
- spec/support/app/app/models/user.rb
|
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/.travis.yml
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
---
|
2
|
-
|
3
|
-
language: ruby
|
4
|
-
sudo: false
|
5
|
-
cache: bundler
|
6
|
-
before_install:
|
7
|
-
- gem install bundler
|
8
|
-
before_script:
|
9
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
10
|
-
- chmod +x ./cc-test-reporter
|
11
|
-
- "./cc-test-reporter before-build"
|
12
|
-
rvm:
|
13
|
-
- 2.6.5
|
14
|
-
- 2.5.7
|
15
|
-
gemfile:
|
16
|
-
- gemfiles/6_0.gemfile
|
17
|
-
- gemfiles/5_2.gemfile
|
18
|
-
notifications:
|
19
|
-
email: false
|
20
|
-
after_script:
|
21
|
-
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
22
|
-
env:
|
23
|
-
global:
|
24
|
-
- secure: Euebw1utbb/4mu9AwgmnNk1cF4flaUVxterXl2yG9STc3oR9e8IczV+r3107CuIu57O6xbi5WarzSgyASSmC/0G9vhT3OaMx0lAY55zy93LaYbkcbcaAYCfbw6h1RHZ1pA3K4SVw/+n+p2jg9xFTTRLUmOHb2vXHH79WAo+Ri9s=
|
data/lib/factory_bot-preload.rb
DELETED