factory_bot-preload 0.3.0 โ†’ 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d637fe4bb5ac2873148d2fb9c64772f5b5dcffad6eb317701bf56c67ad2131ce
4
- data.tar.gz: 207e9f509ef305d20d11e3d3f8a3a663e62d7408064bb9f6a240d8a32b4753b2
3
+ metadata.gz: 9b5cd0131b6a2d6dea0c8bc0bd89e58ebae69a106121a1a3606d9c4e0ce6b4e5
4
+ data.tar.gz: 06dbc270b82948a7fbb8a1bb0b0cc556249a8d482297e155ea1f56f60a818e5b
5
5
  SHA512:
6
- metadata.gz: 246ed765e74d0205c3a16cb2da2f83f783b627762eea4044b2cb028eaa31d36af6ba7b1b6ec97f47465856170a214a493eb8702b701406028caaafa6e96391e2
7
- data.tar.gz: 5185f494d6cf186e9396e574f92eef8b77143edc14ae723175e7a27f2b2dcaf66493bb58cfe416aab5be68def1b7626b1f9cd2391b2a9ec6ff87ba0db8813970
6
+ metadata.gz: 57177f7079c553e105eba5004b817e166819e5d33e2649aca2308a17f1556fd069735b12bd0b5537b0a69049a371d4b681ed50628ecb7b0f0811733356db1ea9
7
+ data.tar.gz: 17e354ab4f1afda71aaeed92fe894be9fce31801ab2485e5af51c0dcbb854c52fe3ea7b330b0927cc9644d57f5653b1be4e27fc716c8208726443ba72024bedf
@@ -0,0 +1,4 @@
1
+ # You can read more about CODEOWNERS at
2
+ # https://help.github.com/github/creating-cloning-and-archiving-repositories/about-code-owners
3
+
4
+ * @fnando
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+ ---
3
+ github: [fnando]
4
+ custom: ["https://paypal.me/nandovieira/๐Ÿ•"]
@@ -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,5 @@
1
+ ---
2
+ contact_links:
3
+ - name: "๐Ÿคจ Q&A"
4
+ url: https://github.com/fnando/factory_bot-preload/discussions/new?category=q-a
5
+ about: Have a question? Ask it away here!
@@ -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/.rubocop.yml CHANGED
@@ -3,4 +3,8 @@ inherit_gem:
3
3
  rubocop-fnando: .rubocop.yml
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.6
6
+ TargetRubyVersion: 2.7
7
+ NewCops: enable
8
+ Exclude:
9
+ - vendor/**/*
10
+ - gemfiles/**/*
@@ -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
- [![Travis-CI](https://travis-ci.org/fnando/factory_bot-preload.svg)](https://travis-ci.org/fnando/factory_bot-preload)
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 YAML/CSV/SQL files. Here enters [factory_bot](https://rubygems.org/gems/factory_bot) (FB).
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 that hitting the database everytime to create records is pretty slow. And believe me, you'll feel the pain when you have lots of tests/specs.
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 preloaded, so you don't have to recreate it every time (that will work for 99.37% of the time, according to statistics I just made up).
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
- ### Installation
25
+ ### Setup
22
26
 
23
27
  Add both FB and FBP to your Gemfile:
24
28
 
@@ -208,27 +212,25 @@ That's it!
208
212
 
209
213
  ## Maintainer
210
214
 
211
- * Nando Vieira (http://nandovieira.com)
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.
212
225
 
213
226
  ## License
214
227
 
215
- (The MIT License)
216
-
217
- Permission is hereby granted, free of charge, to any person obtaining
218
- a copy of this software and associated documentation files (the
219
- 'Software'), to deal in the Software without restriction, including
220
- without limitation the rights to use, copy, modify, merge, publish,
221
- distribute, sublicense, and/or sell copies of the Software, and to
222
- permit persons to whom the Software is furnished to do so, subject to
223
- the following conditions:
224
-
225
- The above copyright notice and this permission notice shall be
226
- included in all copies or substantial portions of the Software.
227
-
228
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
229
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
230
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
231
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
232
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
233
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
234
- 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: :spec
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: :test
25
+ task default: %i[test rubocop]
23
26
  else
24
27
  task :default do
25
- system "TEST_FRAMEWORK=rspec bundle exec rake spec"
26
- system "TEST_FRAMEWORK=minitest bundle exec rake test"
28
+ system "TEST_FRAMEWORK=rspec bundle exec rake"
29
+ system "TEST_FRAMEWORK=minitest bundle exec rake"
27
30
  end
28
31
  end
@@ -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. It will be easier and, probably, faster!"
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 {|f| File.basename(f) }
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", "~> 1.4"
47
+ s.add_development_dependency "sqlite3"
33
48
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec path: ".."
5
+ gem "rails", "~> 7.0.0"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+ gemspec path: ".."
5
+ gem "rails", "~> 6.1.0"
@@ -8,7 +8,9 @@ module FactoryBot
8
8
  def self.load_models
9
9
  return unless defined?(Rails)
10
10
 
11
- Dir[Rails.application.root.join("app/models/**/*.rb")].each do |file|
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
@@ -35,7 +37,7 @@ module FactoryBot
35
37
  end
36
38
 
37
39
  def factory(name, model = nil, &block)
38
- if block_given?
40
+ if block
39
41
  factory_set(name, &block)
40
42
  else
41
43
  factory_get(name, model)
@@ -51,7 +53,8 @@ module FactoryBot
51
53
  end
52
54
 
53
55
  unless factory
54
- raise "Couldn't find #{name.inspect} factory for #{model.name.inspect} model"
56
+ raise "Couldn't find #{name.inspect} factory " \
57
+ "for #{model.name.inspect} model"
55
58
  end
56
59
 
57
60
  factory
@@ -6,6 +6,7 @@ require "factory_bot/syntax/methods"
6
6
  module FactoryBot
7
7
  module Preload
8
8
  def self.minitest
9
+ FactoryBot::Preload::Helpers.load_models
9
10
  FactoryBot::Preload.clean
10
11
  FactoryBot::Preload.run
11
12
  end
@@ -5,7 +5,7 @@ module FactoryBot
5
5
  module Version
6
6
  MAJOR = 0
7
7
  MINOR = 3
8
- PATCH = 0
8
+ PATCH = 1
9
9
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
10
10
  end
11
11
  end
@@ -6,13 +6,8 @@ require "active_record"
6
6
  module FactoryBot
7
7
  module Preload
8
8
  class << self
9
- attr_accessor :preloaders
10
- attr_accessor :factories
11
- attr_accessor :record_ids
12
- attr_accessor :clean_with
13
- attr_accessor :default_helper_name
14
- attr_accessor :helper_name
15
- attr_accessor :reserved_tables
9
+ attr_accessor :preloaders, :factories, :record_ids, :clean_with,
10
+ :default_helper_name, :helper_name, :reserved_tables
16
11
  end
17
12
 
18
13
  self.preloaders = []
@@ -75,9 +70,7 @@ module FactoryBot
75
70
  end
76
71
 
77
72
  def self.active_record_names
78
- names = active_record.descendants.collect(&:table_name).uniq.compact
79
-
80
- names.reject {|name| reserved_tables.include?(name) }
73
+ connection.tables.reject {|name| reserved_tables.include?(name) }
81
74
  end
82
75
 
83
76
  def self.reload_factories
@@ -39,12 +39,16 @@ describe FactoryBot::Preload do
39
39
  end
40
40
 
41
41
  it "raises error for missing factories" do
42
- expect { users(:mary) }.to raise_error(%[Couldn't find :mary factory for "User" model])
42
+ expect do
43
+ users(:mary)
44
+ end.to raise_error(%[Couldn't find :mary factory for "User" model])
43
45
  end
44
46
 
45
47
  it "raises error for missing clean type" do
46
48
  FactoryBot::Preload.clean_with = :invalid
47
- expect { FactoryBot::Preload.clean }.to raise_error(%[Couldn't find invalid clean type])
49
+ expect do
50
+ FactoryBot::Preload.clean
51
+ end.to raise_error(%[Couldn't find invalid clean type])
48
52
  end
49
53
 
50
54
  it "ignores reserved table names when creating helpers" do
@@ -126,6 +130,8 @@ describe FactoryBot::Preload do
126
130
  end
127
131
 
128
132
  it "includes helpers into factory_bot" do
129
- expect(FactoryBot::SyntaxRunner.included_modules).to include(FactoryBot::Preload::Helpers)
133
+ helpers_module = FactoryBot::Preload::Helpers
134
+
135
+ expect(FactoryBot::SyntaxRunner.included_modules).to include(helpers_module)
130
136
  end
131
137
  end
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,7 @@ SimpleCov.start do
6
6
  end
7
7
 
8
8
  ENV["RAILS_ENV"] = "test"
9
- ENV["BUNDLE_GEMFILE"] = File.dirname(__FILE__) + "/../Gemfile"
9
+ ENV["BUNDLE_GEMFILE"] = "#{File.dirname(__FILE__)}/../Gemfile"
10
10
  ENV["DATABASE_URL"] = "sqlite3::memory:"
11
11
 
12
12
  require "bundler/setup"
@@ -20,7 +20,7 @@ require "rails/test_unit/railtie"
20
20
 
21
21
  module RSpec
22
22
  class Application < ::Rails::Application
23
- config.root = File.dirname(__FILE__) + "/support/app"
23
+ config.root = "#{File.dirname(__FILE__)}/support/app"
24
24
  config.active_support.deprecation = :log
25
25
  config.eager_load = false
26
26
  end
@@ -29,7 +29,7 @@ end
29
29
  RSpec::Application.initialize!
30
30
  ActiveRecord::Migration.verbose = true
31
31
  ActiveRecord::Base.establish_connection ENV["DATABASE_URL"]
32
- load File.dirname(__FILE__) + "/support/app/db/schema.rb"
32
+ load "#{File.dirname(__FILE__)}/support/app/db/schema.rb"
33
33
 
34
34
  require "rspec/rails"
35
35
 
@@ -38,4 +38,4 @@ RSpec.configure do |config|
38
38
  end
39
39
 
40
40
  require "factory_bot/preload"
41
- require File.dirname(__FILE__) + "/support/factories"
41
+ require "#{File.dirname(__FILE__)}/support/factories"
@@ -2,13 +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
- drop_table :assets
11
- rescue Exception => error
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)
12
11
  end
13
12
 
14
13
  create_table :users do |t|
@@ -27,8 +26,7 @@ ActiveRecord::Schema.define(version: 0) do
27
26
  t.references :user
28
27
  end
29
28
 
30
- create_table :categories do |t|
31
- end
29
+ create_table :categories
32
30
 
33
31
  create_table :categories_users, id: false do |t|
34
32
  t.references :category
data/test/test_helper.rb CHANGED
@@ -6,7 +6,7 @@ SimpleCov.start do
6
6
  end
7
7
 
8
8
  ENV["RAILS_ENV"] = "test"
9
- ENV["BUNDLE_GEMFILE"] = File.dirname(__FILE__) + "/../Gemfile"
9
+ ENV["BUNDLE_GEMFILE"] = "#{File.dirname(__FILE__)}/../Gemfile"
10
10
  ENV["DATABASE_URL"] = "sqlite3::memory:"
11
11
 
12
12
  require "bundler/setup"
@@ -22,7 +22,7 @@ require "minitest/utils"
22
22
 
23
23
  class SampleApplication < ::Rails::Application
24
24
  config.api = true
25
- config.root = __dir__ + "/../spec/support/app"
25
+ config.root = "#{__dir__}/../spec/support/app"
26
26
  config.active_support.deprecation = :log
27
27
  config.eager_load = false
28
28
  end
@@ -32,7 +32,7 @@ require "rails/test_help"
32
32
 
33
33
  ActiveRecord::Migration.verbose = true
34
34
  ActiveRecord::Base.establish_connection ENV["DATABASE_URL"]
35
- load __dir__ + "/../spec/support/app/db/schema.rb"
35
+ load "#{__dir__}/../spec/support/app/db/schema.rb"
36
36
 
37
37
  module ActiveSupport
38
38
  class TestCase
@@ -41,6 +41,6 @@ module ActiveSupport
41
41
  end
42
42
 
43
43
  require "factory_bot/preload"
44
- require __dir__ + "/../spec/support/factories"
44
+ require "#{__dir__}/../spec/support/factories"
45
45
 
46
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.3.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: 2020-02-08 00:00:00.000000000 Z
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: '1.4'
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: '1.4'
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,16 +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
- - ".travis.yml"
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
208
+ - gemfiles/6_1.gemfile
209
+ - gemfiles/7_0.gemfile
199
210
  - lib/factory_bot/preload.rb
200
211
  - lib/factory_bot/preload/extension.rb
201
212
  - lib/factory_bot/preload/helpers.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
- post_install_message:
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: '0'
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.1.2
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!
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/.travis.yml DELETED
@@ -1,24 +0,0 @@
1
- ---
2
- language: ruby
3
- sudo: false
4
- cache: bundler
5
- before_install:
6
- - gem install bundler
7
- before_script:
8
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- - chmod +x ./cc-test-reporter
10
- - "./cc-test-reporter before-build"
11
- rvm:
12
- - 2.7.0
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: ABKL9+QRkF2+B8kQicumx122YSivY0L4yIZnbr5PxoRkgWdUVqyDPmhkz6yL4vhu53dRciKRLel1r+6QZ7rGDxRA0sOOSVyOw3ciyGSgIUFPTe8hO/r4wVKjCqoqK35gzd96x8DUSXBNMoTxFbgAXr7EajMMX8FQY5KjIomVloA=