factory_bot 5.0.2 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +58 -13
- data/GETTING_STARTED.md +745 -149
- data/NEWS.md +53 -0
- data/README.md +19 -18
- data/lib/factory_bot/aliases.rb +4 -4
- data/lib/factory_bot/attribute/association.rb +2 -2
- data/lib/factory_bot/attribute/dynamic.rb +3 -2
- data/lib/factory_bot/attribute_assigner.rb +10 -10
- data/lib/factory_bot/attribute_list.rb +1 -1
- data/lib/factory_bot/callback.rb +3 -11
- data/lib/factory_bot/configuration.rb +6 -6
- data/lib/factory_bot/declaration/association.rb +30 -2
- data/lib/factory_bot/declaration/implicit.rb +4 -1
- data/lib/factory_bot/declaration.rb +1 -1
- data/lib/factory_bot/declaration_list.rb +2 -2
- data/lib/factory_bot/decorator/invocation_tracker.rb +2 -1
- data/lib/factory_bot/decorator.rb +18 -6
- data/lib/factory_bot/definition.rb +66 -19
- data/lib/factory_bot/definition_hierarchy.rb +1 -11
- data/lib/factory_bot/definition_proxy.rb +77 -12
- data/lib/factory_bot/enum.rb +27 -0
- data/lib/factory_bot/errors.rb +3 -0
- data/lib/factory_bot/evaluator.rb +8 -9
- data/lib/factory_bot/evaluator_class_definer.rb +1 -1
- data/lib/factory_bot/factory.rb +13 -13
- data/lib/factory_bot/factory_runner.rb +4 -4
- data/lib/factory_bot/find_definitions.rb +1 -1
- data/lib/factory_bot/internal.rb +68 -1
- data/lib/factory_bot/linter.rb +9 -13
- data/lib/factory_bot/null_factory.rb +10 -4
- data/lib/factory_bot/null_object.rb +2 -6
- data/lib/factory_bot/registry.rb +4 -4
- data/lib/factory_bot/reload.rb +1 -2
- data/lib/factory_bot/sequence.rb +5 -5
- data/lib/factory_bot/strategy/attributes_for.rb +4 -0
- data/lib/factory_bot/strategy/build.rb +4 -0
- data/lib/factory_bot/strategy/create.rb +4 -0
- data/lib/factory_bot/strategy/null.rb +8 -2
- data/lib/factory_bot/strategy/stub.rb +20 -5
- data/lib/factory_bot/strategy_calculator.rb +1 -1
- data/lib/factory_bot/strategy_syntax_method_registrar.rb +12 -1
- data/lib/factory_bot/syntax/default.rb +12 -24
- data/lib/factory_bot/syntax/methods.rb +3 -3
- data/lib/factory_bot/trait.rb +5 -3
- data/lib/factory_bot/version.rb +1 -1
- data/lib/factory_bot.rb +21 -93
- metadata +12 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bcbbd8bee01abdb25a5cfdbbbbca29396f587236f0c20f8300adbf6e32f783c
|
4
|
+
data.tar.gz: 94d8e73507ae61edba7fb3129ee74c4fe9998a8fb78614ecba9966199561c8e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e97d9530810f0de00f6e0129df37db52722ee8d430f7b118ffdcebdc0eecc1e1532356b7c8e01cc85265c04f18eb174d3d5ff09fe235c5f30ceb7b5e16432508
|
7
|
+
data.tar.gz: 71b77c30b16c89588d6946505be547374321597e8e16f89673766cda94b22188dc28070a34144ae126dad93042de0173e1d92173237ae1e929a3131e85569a51
|
data/CONTRIBUTING.md
CHANGED
@@ -12,7 +12,7 @@ Here are some ways *you* can contribute:
|
|
12
12
|
* by suggesting new features
|
13
13
|
* by writing or editing documentation
|
14
14
|
* by writing specifications
|
15
|
-
* by writing code ( **no patch is too small** : fix typos, add comments,
|
15
|
+
* by writing code ( **no patch is too small** : fix typos, add comments, etc. )
|
16
16
|
* by refactoring code
|
17
17
|
* by closing [issues][]
|
18
18
|
* by reviewing patches
|
@@ -23,13 +23,10 @@ Here are some ways *you* can contribute:
|
|
23
23
|
|
24
24
|
* We use the [GitHub issue tracker][issues] to track bugs and features.
|
25
25
|
* Before submitting a bug report or feature request, check to make sure it hasn't
|
26
|
-
already been submitted.
|
27
|
-
* When submitting a bug report, please include a [
|
28
|
-
|
29
|
-
|
30
|
-
should include a pull request with failing specs.
|
31
|
-
|
32
|
-
[gist]: https://gist.github.com/
|
26
|
+
already been submitted.
|
27
|
+
* When submitting a bug report, please include a [reproduction script] and any
|
28
|
+
other details that may be necessary to reproduce the bug, including your gem
|
29
|
+
version, Ruby version, and operating system.
|
33
30
|
|
34
31
|
## Cleaning up issues
|
35
32
|
|
@@ -40,21 +37,69 @@ already been submitted.
|
|
40
37
|
We will happily reopen the issue.
|
41
38
|
|
42
39
|
## Submitting a Pull Request
|
40
|
+
|
43
41
|
1. [Fork][fork] the [official repository][repo].
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
1. [Create a topic branch.][branch]
|
43
|
+
1. Implement your feature or bug fix.
|
44
|
+
1. Add, commit, and push your changes.
|
45
|
+
1. [Submit a pull request.][pr]
|
46
|
+
|
47
|
+
### Notes
|
48
48
|
|
49
|
-
## Notes
|
50
49
|
* Please add tests if you changed code. Contributions without tests won't be accepted.
|
51
50
|
* If you don't know how to add tests, please put in a PR and leave a comment
|
52
51
|
asking for help. We love helping!
|
53
52
|
* Please don't update the Gem version.
|
54
53
|
|
54
|
+
## Setting up
|
55
|
+
|
56
|
+
```sh
|
57
|
+
bundle install
|
58
|
+
```
|
59
|
+
|
60
|
+
## Running the test suite
|
61
|
+
|
62
|
+
The default rake task will run the full test suite and [standard]:
|
63
|
+
|
64
|
+
```sh
|
65
|
+
bundle exec rake
|
66
|
+
```
|
67
|
+
|
68
|
+
You can also run a single group of tests (unit, spec, or feature)
|
69
|
+
|
70
|
+
```sh
|
71
|
+
bundle exec rake spec:unit
|
72
|
+
bundle exec rake spec:acceptance
|
73
|
+
bundle exec rake features
|
74
|
+
```
|
75
|
+
|
76
|
+
To run an individual rspec test, you can provide a path and line number:
|
77
|
+
|
78
|
+
```sh
|
79
|
+
bundle exec rspec spec/path/to/spec.rb:123
|
80
|
+
```
|
81
|
+
|
82
|
+
You can run tests with a specific version of rails via [appraisal]. To run
|
83
|
+
the default rake task against Rails 6, for example:
|
84
|
+
|
85
|
+
```sh
|
86
|
+
bundle exec appraisal 6.0 rake
|
87
|
+
```
|
88
|
+
|
89
|
+
## Formatting
|
90
|
+
|
91
|
+
Use [standard] to automatically format your code:
|
92
|
+
|
93
|
+
```sh
|
94
|
+
bundle exec rake standard:fix
|
95
|
+
```
|
96
|
+
|
55
97
|
[repo]: https://github.com/thoughtbot/factory_bot/tree/master
|
56
98
|
[fork]: https://help.github.com/articles/fork-a-repo/
|
57
99
|
[branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
|
58
100
|
[pr]: https://help.github.com/articles/using-pull-requests/
|
101
|
+
[standard]: https://github.com/testdouble/standard
|
102
|
+
[appraisal]: https://github.com/thoughtbot/appraisal
|
103
|
+
[reproduction script]: https://github.com/thoughtbot/factory_bot/blob/master/.github/REPRODUCTION_SCRIPT.rb
|
59
104
|
|
60
105
|
Inspired by https://github.com/middleman/middleman-heroku/blob/master/CONTRIBUTING.md
|