faker_maker 2.1.1 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +13 -14
  3. data/.rubocop.yml +3 -3
  4. data/Gemfile +4 -0
  5. data/README.md +7 -1
  6. data/faker_maker.gemspec +2 -2
  7. data/lib/faker_maker/factory.rb +2 -2
  8. data/lib/faker_maker/version.rb +1 -1
  9. data/lib/faker_maker.rb +1 -1
  10. data/usefakermaker.com/.gitignore +5 -0
  11. data/usefakermaker.com/404.html +25 -0
  12. data/usefakermaker.com/Gemfile +39 -0
  13. data/usefakermaker.com/README.md +5 -0
  14. data/usefakermaker.com/_config.yml +299 -0
  15. data/usefakermaker.com/_config.yml.orig +55 -0
  16. data/usefakermaker.com/_data/navigation.yml +51 -0
  17. data/usefakermaker.com/_data/ui-text.yml +2132 -0
  18. data/usefakermaker.com/_site/assets/css/main.css +6 -0
  19. data/usefakermaker.com/_site/assets/css/main.css.map +1 -0
  20. data/usefakermaker.com/_site/assets/js/_main.js +230 -0
  21. data/usefakermaker.com/_site/assets/js/lunr/lunr-en.js +69 -0
  22. data/usefakermaker.com/_site/assets/js/lunr/lunr-gr.js +522 -0
  23. data/usefakermaker.com/_site/assets/js/lunr/lunr-store.js +1 -0
  24. data/usefakermaker.com/_site/assets/js/lunr/lunr.js +3475 -0
  25. data/usefakermaker.com/_site/assets/js/lunr/lunr.min.js +6 -0
  26. data/usefakermaker.com/_site/assets/js/main.min.js +7 -0
  27. data/usefakermaker.com/_site/assets/js/main.min.js.map +1 -0
  28. data/usefakermaker.com/_site/assets/js/plugins/gumshoe.js +484 -0
  29. data/usefakermaker.com/_site/assets/js/plugins/jquery.ba-throttle-debounce.js +252 -0
  30. data/usefakermaker.com/_site/assets/js/plugins/jquery.fitvids.js +82 -0
  31. data/usefakermaker.com/_site/assets/js/plugins/jquery.greedy-navigation.js +128 -0
  32. data/usefakermaker.com/_site/assets/js/plugins/jquery.magnific-popup.js +1860 -0
  33. data/usefakermaker.com/_site/assets/js/plugins/smooth-scroll.js +650 -0
  34. data/usefakermaker.com/_site/assets/js/vendor/jquery/jquery-3.6.0.js +10881 -0
  35. data/usefakermaker.com/_site/feed.xml +1 -0
  36. data/usefakermaker.com/_site/robots.txt +1 -0
  37. data/usefakermaker.com/_site/sitemap.xml +3 -0
  38. data/usefakermaker.com/about.markdown +18 -0
  39. data/usefakermaker.com/assets/images/pug.png +0 -0
  40. data/usefakermaker.com/assets/images/unipug.svg +135 -0
  41. data/usefakermaker.com/docs/contributing/index.md +7 -0
  42. data/{docs/installation.md → usefakermaker.com/docs/installing/index.md} +3 -5
  43. data/{docs/usage/arrays.md → usefakermaker.com/docs/usage/arrays/index.md} +2 -6
  44. data/{docs/usage/building_instances.md → usefakermaker.com/docs/usage/building-instances/index.md} +6 -10
  45. data/{docs/usage/chaos.md → usefakermaker.com/docs/usage/chaos/index.md} +6 -10
  46. data/{docs/usage/destroying_factories.md → usefakermaker.com/docs/usage/destroying-factories/index.md} +7 -9
  47. data/{docs/usage/embedding_factories.md → usefakermaker.com/docs/usage/embedding-factories/index.md} +2 -6
  48. data/{docs/usage → usefakermaker.com/docs/usage/getting-started}/index.md +12 -15
  49. data/{docs/usage/audit_logs.md → usefakermaker.com/docs/usage/history-logging/index.md} +4 -4
  50. data/{docs/usage/inheritance.md → usefakermaker.com/docs/usage/inheritance/index.md} +7 -9
  51. data/{docs/usage/json_field_names.md → usefakermaker.com/docs/usage/json-field-names/index.md} +2 -6
  52. data/{docs/usage/lifecycle_hooks.md → usefakermaker.com/docs/usage/lifecycle-hooks/index.md} +3 -7
  53. data/{docs/usage/dependencies.md → usefakermaker.com/docs/usage/managing-dependencies/index.md} +2 -6
  54. data/{docs/usage/omitting_fields copy.md → usefakermaker.com/docs/usage/omitting-fields/index.md} +4 -8
  55. data/usefakermaker.com/pages/index.markdown +27 -0
  56. metadata +53 -30
  57. data/docs/.bundle/config +0 -2
  58. data/docs/.keep +0 -1
  59. data/docs/_config.yml +0 -8
  60. data/docs/contributing.md +0 -9
  61. data/docs/credits.md +0 -9
  62. data/docs/index.md +0 -21
  63. data/docs/logo.png +0 -0
@@ -1,12 +1,8 @@
1
1
  ---
2
- layout: default
2
+ layout: single
3
3
  title: Inheritance
4
- parent: Usage
5
- nav_order: 1
6
4
  ---
7
5
 
8
- # Inheritance
9
-
10
6
  FakerMaker can exploit the Ruby class hierarchy to provide additional specialisation or to override some behaviours:
11
7
 
12
8
  ```ruby
@@ -22,16 +18,18 @@ FakerMaker.factory :motorbike, parent: :vehicle do
22
18
  end
23
19
  ```
24
20
 
25
- This is the equivalent of:
21
+ This is the equivalent of:
22
+
23
+ Since v3.0.0 Classes generated by FakerMaker are in the `FakerMaker::Factory` namespace.
26
24
 
27
25
  ```ruby
28
- class Vehicle < Object
26
+ class FakerMaker::Factory::Vehicle < Object
29
27
  # ...
30
28
  end
31
29
 
32
- class Motorbike < Vehicle
30
+ class FakerMaker::Factory::Motorbike < FakerMaker::Factory::Vehicle
33
31
  # ...
34
32
  end
35
33
  ```
36
34
 
37
- so a motorbike will still have a colour and engine capacity between 600 and 2500.
35
+ so a motorbike will still have a colour and engine capacity between 600 and 2500.
@@ -1,12 +1,8 @@
1
1
  ---
2
- layout: default
2
+ layout: single
3
3
  title: JSON Field Names
4
- parent: Usage
5
- nav_order: 4
6
4
  ---
7
5
 
8
- # JSON Field Names
9
-
10
6
  JavaScript likes to use camelCase, Ruby's idiom is to use snake_case. This can make make manipulating factory-built objects in ruby ugly. To avoid this, you can call your fields one thing and ask the JSON outputter to rename the field when generating JSON.
11
7
 
12
8
  Faker Maker provides two mechanisms for dealing with this.
@@ -54,4 +50,4 @@ v.to_json
54
50
 
55
51
  ## Combining the two approaches
56
52
 
57
- If the factory has a `:naming` strategy defined and an attribute has its own `:json` name defined, the attribute's `:json` name will take precedence.
53
+ If the factory has a `:naming` strategy defined and an attribute has its own `:json` name defined, the attribute's `:json` name will take precedence.
@@ -1,12 +1,8 @@
1
1
  ---
2
- layout: default
2
+ layout: single
3
3
  title: Lifecycle Hooks
4
- parent: Usage
5
- nav_order: 8
6
4
  ---
7
5
 
8
- # Lifecycle Hooks
9
-
10
6
  Faker Maker has a few hooks which can be added to the factory which are triggered when the factory builds an instance.
11
7
 
12
8
  * `before_build` the instance has been created but none of the values have been set yet
@@ -15,7 +11,7 @@ Faker Maker has a few hooks which can be added to the factory which are triggere
15
11
  For instance:
16
12
 
17
13
  ```ruby
18
- FakerMaker.factory :user do
14
+ FakerMaker.factory :user do
19
15
  before_build do |instance, factory|
20
16
  puts 'Building an instance of User'
21
17
  end
@@ -23,7 +19,7 @@ FakerMaker.factory :user do
23
19
  name {'Patsy Stone'}
24
20
  email {'patsy@fabulous.co.uk'}
25
21
  admin {false}
26
-
22
+
27
23
  after_build do |instance, factory|
28
24
  puts "Built an instance of User (#{instance.name})"
29
25
  end
@@ -1,10 +1,6 @@
1
1
  ---
2
- layout: default
2
+ layout: single
3
3
  title: Managing Dependencies
4
- parent: Usage
5
- nav_order: 3
6
4
  ---
7
5
 
8
- # Managing Dependencies
9
-
10
- Factory definition files are Plain Ol' Ruby. If you depend on another factory because you either extend from it or use it just add a `require` or (depending on your load path) `require_relative` to the top of your file.
6
+ Factory definition files are Plain Ol' Ruby. If you depend on another factory because you either extend from it or use it just add a `require` or (depending on your load path) `require_relative` to the top of your file.
@@ -1,16 +1,12 @@
1
1
  ---
2
- layout: default
2
+ layout: single
3
3
  title: Omitting Fields
4
- parent: Usage
5
- nav_order: 5
6
4
  ---
7
5
 
8
- # Omitting Fields
9
-
10
6
  Sometimes you want a field present, other times you don't. This is often the case when you want to skip fields which have null or empty values.
11
7
 
12
8
  ```ruby
13
- FakerMaker.factory :user do
9
+ FakerMaker.factory :user do
14
10
  name {'Patsy Stone'}
15
11
  email(omit: :nil) {'patsy@fabulous.co.uk'}
16
12
  admin {false}
@@ -34,9 +30,9 @@ There are three special modifiers:
34
30
  These can be mixed with real values, e.g.
35
31
 
36
32
  ```ruby
37
- FakerMaker.factory :user do
33
+ FakerMaker.factory :user do
38
34
  name {'Patsy Stone'}
39
35
  email(omit: [:nil, :empty, 'test@foobar.com']) {'patsy@fabulous.co.uk'}
40
36
  admin {false}
41
37
  end
42
- ```
38
+ ```
@@ -0,0 +1,27 @@
1
+ ---
2
+ # Feel free to add content and custom Front Matter to this file.
3
+ # To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
4
+
5
+ # layout: single
6
+ layout: splash
7
+ permalink: /
8
+ author_profile: false
9
+
10
+ feature_row:
11
+ - image_path: /assets/images/unipug.svg
12
+ alt: An illustration of cute pug dog pretending to be a unicorn by wearing a costume
13
+ title: Factories over fixtures
14
+ excerpt: FakerMaker is a simple factory builder so you can throw away your fixtures and generate test data instead.
15
+ url: "/docs/installing/"
16
+ btn_label: "Get Started"
17
+ btn_class: "btn btn--success"
18
+ ---
19
+
20
+ {% include feature_row type="center" %}
21
+
22
+ Sometimes you need generate data; something testers need to do a lot. Often, a bunch of fixtures will be built by hand, carefully maintained and curated, until the API or schema or something changes and all the fixtures need to be pruned before the tests pass again. This drives testers into building fixtures which individually cover lots of acceptance critera just so that they can drive down the number of them they have to maintain until the fixtures don’t resemble anything like realistic criteria.
23
+
24
+ If you’re testing a Rails application, you can use the awesome FactoryBot to generate faked model instances but what if you’re not using Rails or you don’t have model classes or you’re testing an API? This is what Faker Maker aims to help with.
25
+
26
+ It is designed to resemble the Factory Bot gem but without needing an existing class definition to back its object and so it goes without saying that it offers no persistence mechanism. Its purpose is to provide a simple framework for generating data to test JSON APIs and is intended to be used with the Faker gem (but has no dependency upon it).
27
+
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faker_maker
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nigel Brookes-Thomas
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-07 00:00:00.000000000 Z
10
+ date: 2025-04-25 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activesupport
@@ -19,7 +18,7 @@ dependencies:
19
18
  version: '5.2'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '8'
21
+ version: '9'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,21 +28,21 @@ dependencies:
29
28
  version: '5.2'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '8'
31
+ version: '9'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: bundler
35
34
  requirement: !ruby/object:Gem::Requirement
36
35
  requirements:
37
36
  - - "~>"
38
37
  - !ruby/object:Gem::Version
39
- version: '2.0'
38
+ version: '2'
40
39
  type: :development
41
40
  prerelease: false
42
41
  version_requirements: !ruby/object:Gem::Requirement
43
42
  requirements:
44
43
  - - "~>"
45
44
  - !ruby/object:Gem::Version
46
- version: '2.0'
45
+ version: '2'
47
46
  - !ruby/object:Gem::Dependency
48
47
  name: faker
49
48
  requirement: !ruby/object:Gem::Requirement
@@ -206,26 +205,6 @@ files:
206
205
  - _config.yml
207
206
  - bin/console
208
207
  - bin/setup
209
- - docs/.bundle/config
210
- - docs/.keep
211
- - docs/_config.yml
212
- - docs/contributing.md
213
- - docs/credits.md
214
- - docs/index.md
215
- - docs/installation.md
216
- - docs/logo.png
217
- - docs/usage/arrays.md
218
- - docs/usage/audit_logs.md
219
- - docs/usage/building_instances.md
220
- - docs/usage/chaos.md
221
- - docs/usage/dependencies.md
222
- - docs/usage/destroying_factories.md
223
- - docs/usage/embedding_factories.md
224
- - docs/usage/index.md
225
- - docs/usage/inheritance.md
226
- - docs/usage/json_field_names.md
227
- - docs/usage/lifecycle_hooks.md
228
- - docs/usage/omitting_fields copy.md
229
208
  - faker_maker.gemspec
230
209
  - img/unipug.svg
231
210
  - lib/faker_maker.rb
@@ -240,6 +219,52 @@ files:
240
219
  - lib/faker_maker/naming/json.rb
241
220
  - lib/faker_maker/naming/json_capitalized.rb
242
221
  - lib/faker_maker/version.rb
222
+ - usefakermaker.com/.gitignore
223
+ - usefakermaker.com/404.html
224
+ - usefakermaker.com/Gemfile
225
+ - usefakermaker.com/README.md
226
+ - usefakermaker.com/_config.yml
227
+ - usefakermaker.com/_config.yml.orig
228
+ - usefakermaker.com/_data/navigation.yml
229
+ - usefakermaker.com/_data/ui-text.yml
230
+ - usefakermaker.com/_site/assets/css/main.css
231
+ - usefakermaker.com/_site/assets/css/main.css.map
232
+ - usefakermaker.com/_site/assets/js/_main.js
233
+ - usefakermaker.com/_site/assets/js/lunr/lunr-en.js
234
+ - usefakermaker.com/_site/assets/js/lunr/lunr-gr.js
235
+ - usefakermaker.com/_site/assets/js/lunr/lunr-store.js
236
+ - usefakermaker.com/_site/assets/js/lunr/lunr.js
237
+ - usefakermaker.com/_site/assets/js/lunr/lunr.min.js
238
+ - usefakermaker.com/_site/assets/js/main.min.js
239
+ - usefakermaker.com/_site/assets/js/main.min.js.map
240
+ - usefakermaker.com/_site/assets/js/plugins/gumshoe.js
241
+ - usefakermaker.com/_site/assets/js/plugins/jquery.ba-throttle-debounce.js
242
+ - usefakermaker.com/_site/assets/js/plugins/jquery.fitvids.js
243
+ - usefakermaker.com/_site/assets/js/plugins/jquery.greedy-navigation.js
244
+ - usefakermaker.com/_site/assets/js/plugins/jquery.magnific-popup.js
245
+ - usefakermaker.com/_site/assets/js/plugins/smooth-scroll.js
246
+ - usefakermaker.com/_site/assets/js/vendor/jquery/jquery-3.6.0.js
247
+ - usefakermaker.com/_site/feed.xml
248
+ - usefakermaker.com/_site/robots.txt
249
+ - usefakermaker.com/_site/sitemap.xml
250
+ - usefakermaker.com/about.markdown
251
+ - usefakermaker.com/assets/images/pug.png
252
+ - usefakermaker.com/assets/images/unipug.svg
253
+ - usefakermaker.com/docs/contributing/index.md
254
+ - usefakermaker.com/docs/installing/index.md
255
+ - usefakermaker.com/docs/usage/arrays/index.md
256
+ - usefakermaker.com/docs/usage/building-instances/index.md
257
+ - usefakermaker.com/docs/usage/chaos/index.md
258
+ - usefakermaker.com/docs/usage/destroying-factories/index.md
259
+ - usefakermaker.com/docs/usage/embedding-factories/index.md
260
+ - usefakermaker.com/docs/usage/getting-started/index.md
261
+ - usefakermaker.com/docs/usage/history-logging/index.md
262
+ - usefakermaker.com/docs/usage/inheritance/index.md
263
+ - usefakermaker.com/docs/usage/json-field-names/index.md
264
+ - usefakermaker.com/docs/usage/lifecycle-hooks/index.md
265
+ - usefakermaker.com/docs/usage/managing-dependencies/index.md
266
+ - usefakermaker.com/docs/usage/omitting-fields/index.md
267
+ - usefakermaker.com/pages/index.markdown
243
268
  homepage: https://billyruffian.github.io/faker_maker/
244
269
  licenses:
245
270
  - MIT
@@ -247,7 +272,6 @@ metadata:
247
272
  homepage_uri: https://billyruffian.github.io/faker_maker/
248
273
  source_code_uri: https://github.com/BillyRuffian/faker_maker
249
274
  changelog_uri: https://github.com/BillyRuffian/faker_maker/releases
250
- post_install_message:
251
275
  rdoc_options: []
252
276
  require_paths:
253
277
  - lib
@@ -262,8 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
262
286
  - !ruby/object:Gem::Version
263
287
  version: '0'
264
288
  requirements: []
265
- rubygems_version: 3.5.23
266
- signing_key:
289
+ rubygems_version: 3.6.2
267
290
  specification_version: 4
268
291
  summary: FakerMaker bakes fakes.
269
292
  test_files: []
data/docs/.bundle/config DELETED
@@ -1,2 +0,0 @@
1
- ---
2
- BUNDLE_JOBS: "12"
data/docs/.keep DELETED
@@ -1 +0,0 @@
1
-
data/docs/_config.yml DELETED
@@ -1,8 +0,0 @@
1
- remote_theme: pmarsceill/just-the-docs
2
- logo: "https://raw.githubusercontent.com/BillyRuffian/faker_maker/master/docs/logo.png"
3
- title: Faker Maker
4
- description: A simple data generator with a straighforward syntax for Ruby
5
- aux_links:
6
- "Faker Maker on GitHub":
7
- - "//github.com/BillyRuffian/faker_maker"
8
- footer_content: "Copyright &copy; 2019-2020 Nigel Brookes-Thomas. Distributed by an <a href=\"https://github.com/BillyRuffian/faker_maker/blob/master/LICENSE.txt\">MIT license.</a>"
data/docs/contributing.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- layout: default
3
- title: Contributing
4
- nav_order: 3
5
- ---
6
-
7
- # Contributing
8
-
9
- Bug reports and pull requests are welcome on GitHub at https://github.com/BillyRuffian/faker_maker.
data/docs/credits.md DELETED
@@ -1,9 +0,0 @@
1
- ---
2
- layout: default
3
- title: Credits
4
- nav_order: 4
5
- ---
6
-
7
- # Extra Credit
8
-
9
- Unipug logo by [1smr1](https://pixabay.com/users/1smr1-4646356/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2970825) from [Pixabay](https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=2970825).
data/docs/index.md DELETED
@@ -1,21 +0,0 @@
1
- ---
2
- layout: default
3
- title: Home
4
- nav_order: 1
5
- permalink: /
6
- ---
7
-
8
- # Factories over fixtures
9
- {: .fs-9 }
10
-
11
-
12
- FakerMaker is a simple factory builder so you can throw away your fixtures and generate test data instead.
13
- {: .fs-6 .fw-300 }
14
-
15
- ---
16
-
17
- Sometimes you need generate data; something testers need to do a lot. Often, a bunch of fixtures will be built by hand, carefully maintained and curated, until the API or schema or something changes and all the fixtures need to be pruned before the tests pass again. This drives testers into building fixtures which individually cover lots of acceptance critera just so that they can drive down the number of them they have to maintain until the fixtures don't resemble anything like realistic criteria.
18
-
19
- If you're testing a Rails application, you can use the awesome [FactoryBot](https://github.com/thoughtbot/factory_bot) to generate faked model instances but what if you're not using Rails or you don't have model classes or you're testing an API? This is what Faker Maker aims to help with.
20
-
21
- It is designed to resemble the Factory Bot gem but without needing an existing class definition to back its object and so it goes without saying that it offers no persistence mechanism. Its purpose is to provide a simple framework for generating data to test JSON APIs and is intended to be used with the [Faker](https://github.com/stympy/faker) gem (but has no dependency upon it).
data/docs/logo.png DELETED
Binary file