factory_bot 5.1.1 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +52 -13
  3. data/GETTING_STARTED.md +426 -68
  4. data/NEWS.md +18 -1
  5. data/README.md +4 -4
  6. data/lib/factory_bot/aliases.rb +3 -3
  7. data/lib/factory_bot/attribute/association.rb +2 -2
  8. data/lib/factory_bot/attribute/dynamic.rb +2 -1
  9. data/lib/factory_bot/attribute_assigner.rb +9 -10
  10. data/lib/factory_bot/attribute_list.rb +1 -1
  11. data/lib/factory_bot/callback.rb +2 -10
  12. data/lib/factory_bot/configuration.rb +6 -6
  13. data/lib/factory_bot/declaration.rb +1 -1
  14. data/lib/factory_bot/declaration_list.rb +2 -2
  15. data/lib/factory_bot/decorator/invocation_tracker.rb +1 -1
  16. data/lib/factory_bot/decorator.rb +1 -1
  17. data/lib/factory_bot/definition.rb +42 -16
  18. data/lib/factory_bot/definition_hierarchy.rb +1 -11
  19. data/lib/factory_bot/definition_proxy.rb +64 -6
  20. data/lib/factory_bot/enum.rb +27 -0
  21. data/lib/factory_bot/evaluator.rb +5 -7
  22. data/lib/factory_bot/evaluator_class_definer.rb +1 -1
  23. data/lib/factory_bot/factory.rb +12 -12
  24. data/lib/factory_bot/factory_runner.rb +3 -3
  25. data/lib/factory_bot/find_definitions.rb +1 -1
  26. data/lib/factory_bot/internal.rb +18 -29
  27. data/lib/factory_bot/linter.rb +9 -13
  28. data/lib/factory_bot/null_factory.rb +10 -4
  29. data/lib/factory_bot/null_object.rb +2 -6
  30. data/lib/factory_bot/registry.rb +4 -4
  31. data/lib/factory_bot/reload.rb +0 -1
  32. data/lib/factory_bot/sequence.rb +5 -5
  33. data/lib/factory_bot/strategy/null.rb +4 -2
  34. data/lib/factory_bot/strategy/stub.rb +6 -2
  35. data/lib/factory_bot/strategy_syntax_method_registrar.rb +12 -1
  36. data/lib/factory_bot/syntax/default.rb +7 -19
  37. data/lib/factory_bot/trait.rb +1 -1
  38. data/lib/factory_bot/version.rb +1 -1
  39. data/lib/factory_bot.rb +21 -55
  40. metadata +12 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d19c695ef0088d163b82c6b32066d4385d4be7fb8c0dc0b29c350d2e2187f2d
4
- data.tar.gz: 55270eb96b553aa9b0c186bc7eeaf9d084fc79252b7fb8443d6276b1865168cc
3
+ metadata.gz: 97d3a72c7d45c5c561f8c5ac318e8650d0f9787abeac65f598f06f0c04856727
4
+ data.tar.gz: 3afcae7ade56a0d0e1858e4205e4356efce894afd1a87370759bff3199439a07
5
5
  SHA512:
6
- metadata.gz: d61c40f944ae69e27a32e0992d8c289e9d0d9d5a48efe2998b8c53eca17be8a3591f886762866155032662e0eb32a4d52f342cfc1c88b22e637cab3d6e999f81
7
- data.tar.gz: 2aa21a35633016a9e9871c9e56782af137a209ad1c155d51d768ba129d5dea016c54f9d1186191d2ed24e616f5d6516b78698488b8ee536fd929e28c7055ff1f
6
+ metadata.gz: e3266e75f1419558703243a719bb837237f48b21757b4b6fd469a37340dcf426568238fea348a99f8b61402dc7f3fa8842bd9ea998850b701dfe7c64f47070ca
7
+ data.tar.gz: f411a10292c3a4b47ded4de7ed26f6e2d13a2a5d9ab49805eed4e7ffe1a27d44c61f345afa701cb25bdbfc4c12509006c702253039d7d9137aa13605a5652d51
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, clean up inconsistent whitespace )
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 [Gist][] that includes a stack
28
- trace and any details that may be necessary to reproduce the bug, including
29
- your gem version, Ruby version, and operating system. Ideally, a bug report
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,63 @@ 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
- 2. [Create a topic branch.][branch]
45
- 3. Implement your feature or bug fix.
46
- 4. Add, commit, and push your changes.
47
- 5. [Submit a pull request.][pr]
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
+ ## Running the test suite
55
+
56
+ The default rake task will run the full test suite and [standard]:
57
+
58
+ ```sh
59
+ bundle exec rake
60
+ ```
61
+
62
+ You can also run a single group of tests (unit, spec, or feature)
63
+
64
+ ```sh
65
+ bundle exec rake spec:unit
66
+ bundle exec rake spec:acceptance
67
+ bundle exec rake features
68
+ ```
69
+
70
+ To run an individual rspec test, you can provide a path and line number:
71
+
72
+ ```sh
73
+ bundle exec rspec spec/path/to/spec.rb:123
74
+ ```
75
+
76
+ You can run tests with a specific version of rails via [appraisal]. To run
77
+ the default rake task against Rails 6, for example:
78
+
79
+ ```sh
80
+ bundle exec appraisal 6.0 rake
81
+ ```
82
+
83
+ ## Formatting
84
+
85
+ Use [standard] to automatically format your code:
86
+
87
+ ```sh
88
+ bundle exec rake standard:fix
89
+ ```
90
+
55
91
  [repo]: https://github.com/thoughtbot/factory_bot/tree/master
56
92
  [fork]: https://help.github.com/articles/fork-a-repo/
57
93
  [branch]: https://help.github.com/articles/creating-and-deleting-branches-within-your-repository/
58
94
  [pr]: https://help.github.com/articles/using-pull-requests/
95
+ [standard]: https://github.com/testdouble/standard
96
+ [appraisal]: https://github.com/thoughtbot/appraisal
97
+ [reproduction script]: https://github.com/thoughtbot/factory_bot/blob/master/.github/REPRODUCTION_SCRIPT.rb
59
98
 
60
99
  Inspired by https://github.com/middleman/middleman-heroku/blob/master/CONTRIBUTING.md