faker_maker 0.6.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.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +171 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/faker_maker.gemspec +47 -0
- data/lib/.DS_Store +0 -0
- data/lib/faker_maker/attribute.rb +36 -0
- data/lib/faker_maker/base.rb +12 -0
- data/lib/faker_maker/definition_proxy.rb +14 -0
- data/lib/faker_maker/factory.rb +80 -0
- data/lib/faker_maker/version.rb +3 -0
- data/lib/faker_maker.rb +40 -0
- metadata +161 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e70530ef4ef67e59247210037bbdbe4fd0c23c6c26666b1459db6f5ac9f65a5e
|
4
|
+
data.tar.gz: f007f3658015e759942885a786424b4f444f34b4d655ab64f5da5044e90274df
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 42b0194260b51a49a03063183da089d885291211f4bc5ef3583b0df79d0ecac6f742ada1a7c0541fef24c2bded3056d91b83697db487eee2f569326dd00324d5
|
7
|
+
data.tar.gz: cf02455a97627cb404d7cb6365d8485d5ff8266797e91bb9745eeb8a40499575832b31cd4dfceaedeea8634aed6c7b5ee0ccc78922243be5fecbd6f322da1e1e
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
faker_maker (0.1.0)
|
5
|
+
activesupport (>= 5.2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.2.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 0.7, < 2)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
coderay (1.1.2)
|
16
|
+
concurrent-ruby (1.1.4)
|
17
|
+
diff-lcs (1.3)
|
18
|
+
docile (1.3.1)
|
19
|
+
faker (1.9.3)
|
20
|
+
i18n (>= 0.7)
|
21
|
+
i18n (1.5.3)
|
22
|
+
concurrent-ruby (~> 1.0)
|
23
|
+
json (2.2.0)
|
24
|
+
method_source (0.9.2)
|
25
|
+
minitest (5.11.3)
|
26
|
+
pry (0.12.2)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
rake (10.5.0)
|
30
|
+
rspec (3.8.0)
|
31
|
+
rspec-core (~> 3.8.0)
|
32
|
+
rspec-expectations (~> 3.8.0)
|
33
|
+
rspec-mocks (~> 3.8.0)
|
34
|
+
rspec-core (3.8.0)
|
35
|
+
rspec-support (~> 3.8.0)
|
36
|
+
rspec-expectations (3.8.2)
|
37
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
+
rspec-support (~> 3.8.0)
|
39
|
+
rspec-mocks (3.8.0)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.8.0)
|
42
|
+
rspec-support (3.8.0)
|
43
|
+
simplecov (0.16.1)
|
44
|
+
docile (~> 1.1)
|
45
|
+
json (>= 1.8, < 3)
|
46
|
+
simplecov-html (~> 0.10.0)
|
47
|
+
simplecov-html (0.10.2)
|
48
|
+
thread_safe (0.3.6)
|
49
|
+
tzinfo (1.2.5)
|
50
|
+
thread_safe (~> 0.1)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
bundler (~> 2.0)
|
57
|
+
faker (>= 1.9)
|
58
|
+
faker_maker!
|
59
|
+
pry
|
60
|
+
rake (~> 10.0)
|
61
|
+
rspec (>= 3.8)
|
62
|
+
simplecov (>= 0.16)
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
2.0.1
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Nigel Brookes-Thomas
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
# FakerMaker
|
2
|
+
|
3
|
+
FakerMaker is a simple fixture generator with a concise and straightforward syntax.
|
4
|
+
|
5
|
+
It is designed to resemble the [FactoryBot](https://github.com/thoughtbot/factory_bot) gem but without needing an existing class definition to back its fixtures 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).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'faker_maker'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install faker_maker
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
FakerMaker generates factories that build disposable objects for testing. Each factory has a name and a set of attributes.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
FakerMaker.factory :user do
|
29
|
+
name {'Patsy Stone'}
|
30
|
+
email {'patsy@fabulous.co.uk'}
|
31
|
+
admin {false}
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
This will generate a `User` class with the attributes `name`, `email` and `admin` which will always return the same value.
|
36
|
+
|
37
|
+
It is possible to explicitly set the name of class which is particularly useful if there is a risk of redefining an existing one.
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
FakerMaker.factory :user, class: 'EmailUser' do
|
41
|
+
name {'Patsy Stone'}
|
42
|
+
email {'patsy@fabulous.co.uk'}
|
43
|
+
admin {false}
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
The class name will always be turned into a Ruby-style class name so `email_user` would become `EmailUser`.
|
48
|
+
|
49
|
+
Because of the block syntax in Ruby, defining attributes as `Hash`es requires two sets of curly brackets:
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
FakerMaker.factory :response do
|
53
|
+
body { { title: 'First Post', content: 'This is part of a hash' } }
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
### Inheritance
|
58
|
+
|
59
|
+
FakerMaker can exploit the Ruby class hierarchy to provide additional specialisation or to override some behaviours:
|
60
|
+
|
61
|
+
```ruby
|
62
|
+
FakerMaker.factory :vehicle do
|
63
|
+
wheels { 4 }
|
64
|
+
colour { Faker::Color.color_name }
|
65
|
+
engine_capacity { rand( 600..2500 ) }
|
66
|
+
end
|
67
|
+
|
68
|
+
FakerMaker.factory :motorbike, parent: :vehicle do
|
69
|
+
wheels { 2 }
|
70
|
+
sidecar { [true, false].sample }
|
71
|
+
end
|
72
|
+
```
|
73
|
+
|
74
|
+
This is the equivalent of:
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
class Vehicle < Object
|
78
|
+
# ...
|
79
|
+
end
|
80
|
+
|
81
|
+
class Motorbike < Vehicle
|
82
|
+
# ...
|
83
|
+
end
|
84
|
+
```
|
85
|
+
|
86
|
+
so a motorbike will still have a colour and engine capacity between 600 and 2500.
|
87
|
+
|
88
|
+
### Arrays
|
89
|
+
|
90
|
+
It is possible to declare an attribute as having multiple values.
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
FakerMaker.factory :basket do
|
94
|
+
items( has: 10 ) { Faker::Commerce.product_name }
|
95
|
+
end
|
96
|
+
```
|
97
|
+
|
98
|
+
or to pick random number of attributes from a range:
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
FakerMaker.factory :basket do
|
102
|
+
items( has: 5..20 ) { Faker::Commerce.product_name }
|
103
|
+
end
|
104
|
+
```
|
105
|
+
|
106
|
+
A range always generates an array, even if the range produces 1 items or the range is `0..1`.
|
107
|
+
|
108
|
+
It is possible to force an attribute to always be an array, even if only produces one item.
|
109
|
+
|
110
|
+
```ruby
|
111
|
+
FakerMaker.factory :basket do
|
112
|
+
items( array: true ) { Faker::Commerce.product_name }
|
113
|
+
end
|
114
|
+
```
|
115
|
+
|
116
|
+
You can always use long-form block syntax...
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
FakerMaker.factory :basket do
|
120
|
+
items has: 5..20 do
|
121
|
+
Faker::Commerce.product_name
|
122
|
+
end
|
123
|
+
end
|
124
|
+
```
|
125
|
+
|
126
|
+
### Building instances
|
127
|
+
|
128
|
+
Instances are Plain Ol' Ruby Objects and the attributes are attached with getters and setters with their values assigned to the value return from their block at build time.
|
129
|
+
|
130
|
+
To build an object:
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
result = FakerMaker[:basket].build
|
134
|
+
```
|
135
|
+
|
136
|
+
will generate a new instance using the Basket factory. Because an actual class is defined, you can instantiate an object directly through `Basket.new` but that will not populate any of the attributes.
|
137
|
+
|
138
|
+
As a convenience, you can request a JSON representation directly:
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
result = FakerMaker[:basket].to_json
|
142
|
+
```
|
143
|
+
|
144
|
+
As another convenience, `FakerMaker` is also assign to the variable `FM` to it is possible to write just:
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
result = FM[:basket].build
|
148
|
+
```
|
149
|
+
|
150
|
+
### Embedding factories
|
151
|
+
|
152
|
+
To use factories with factories, the following pattern is recommended:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
FakerMaker.factory :item do
|
156
|
+
name { Faker::Commerce.product_name }
|
157
|
+
price { Faker::Commerce.price }
|
158
|
+
end
|
159
|
+
|
160
|
+
FakerMaker.factory :basket do
|
161
|
+
items( has: 10 ) { FakerMaker[:item].build }
|
162
|
+
end
|
163
|
+
```
|
164
|
+
|
165
|
+
## Contributing
|
166
|
+
|
167
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/BillyRuffian/faker_maker.
|
168
|
+
|
169
|
+
## License
|
170
|
+
|
171
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "faker_maker"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/faker_maker.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "faker_maker/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "faker_maker"
|
8
|
+
spec.version = FakerMaker::VERSION
|
9
|
+
spec.authors = ["Nigel Brookes-Thomas"]
|
10
|
+
spec.email = ["nigel@brookes-thomas.co.uk"]
|
11
|
+
|
12
|
+
spec.summary = %q{FakerMaker bakes fakes.}
|
13
|
+
spec.description = %q{FakerMaker is a simple fixture generator with a concise and straightforward syntax.}
|
14
|
+
spec.homepage = "https://github.com/BillyRuffian/faker_maker"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
21
|
+
|
22
|
+
#spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/BillyRuffian/faker_maker"
|
24
|
+
#spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
25
|
+
else
|
26
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
"public gem pushes."
|
28
|
+
end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
spec.require_paths = ["lib"]
|
38
|
+
|
39
|
+
spec.add_dependency "activesupport", ">= 5.2"
|
40
|
+
|
41
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
42
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
43
|
+
spec.add_development_dependency "faker", ">= 1.9"
|
44
|
+
spec.add_development_dependency "rspec", ">= 3.8"
|
45
|
+
spec.add_development_dependency "simplecov", ">= 0.16"
|
46
|
+
spec.add_development_dependency "pry"
|
47
|
+
end
|
data/lib/.DS_Store
ADDED
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module FakerMaker
|
2
|
+
class Attribute
|
3
|
+
attr_reader :name, :block
|
4
|
+
|
5
|
+
def initialize name, options={}, block
|
6
|
+
assert_valid_options options
|
7
|
+
@name = name
|
8
|
+
@block = block
|
9
|
+
@cardinality = options[:has] || 1
|
10
|
+
@array = options[:array] == true
|
11
|
+
end
|
12
|
+
|
13
|
+
def array?
|
14
|
+
forced_array? || @array
|
15
|
+
end
|
16
|
+
|
17
|
+
def cardinality
|
18
|
+
if @cardinality.is_a? Range
|
19
|
+
rand( @cardinality )
|
20
|
+
else
|
21
|
+
@cardinality
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def forced_array?
|
28
|
+
@cardinality.is_a?( Range ) || @cardinality > 1
|
29
|
+
end
|
30
|
+
|
31
|
+
def assert_valid_options options
|
32
|
+
options.assert_valid_keys :has, :array
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module FakerMaker
|
2
|
+
module Base
|
3
|
+
|
4
|
+
def factory name, options={}, &block
|
5
|
+
factory = FakerMaker::Factory.new name, options
|
6
|
+
proxy = DefinitionProxy.new factory
|
7
|
+
proxy.instance_eval &block if block_given?
|
8
|
+
FakerMaker.register_factory factory
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module FakerMaker
|
2
|
+
class DefinitionProxy
|
3
|
+
|
4
|
+
def initialize factory
|
5
|
+
@factory = factory
|
6
|
+
end
|
7
|
+
|
8
|
+
def method_missing name, *args, &block
|
9
|
+
attribute = FakerMaker::Attribute.new name, *args, block
|
10
|
+
@factory.attach_attribute attribute
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module FakerMaker
|
2
|
+
class Factory
|
3
|
+
attr_reader :name, :attributes, :class_name, :parent_class, :parent
|
4
|
+
|
5
|
+
def initialize name, options={}
|
6
|
+
assert_valid_options options
|
7
|
+
@name = name.respond_to?(:to_sym) ? name.to_sym : name.to_s.underscore.to_sym
|
8
|
+
@class_name = (options[:class] || @name).to_s.camelcase
|
9
|
+
@attributes = []
|
10
|
+
@klass = nil
|
11
|
+
@parent = options[:parent]
|
12
|
+
@parent_class = if @parent
|
13
|
+
Object.const_get( FakerMaker[@parent].class_name )
|
14
|
+
else
|
15
|
+
Object
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def attach_attribute attribute
|
20
|
+
@attributes << attribute
|
21
|
+
end
|
22
|
+
|
23
|
+
def build
|
24
|
+
instance = instantiate
|
25
|
+
populate_instance instance
|
26
|
+
yield self if block_given?
|
27
|
+
instance
|
28
|
+
end
|
29
|
+
|
30
|
+
def assemble
|
31
|
+
if @klass.nil?
|
32
|
+
@klass = Class.new @parent_class
|
33
|
+
Object.const_set @class_name, @klass
|
34
|
+
attach_attributes_to_class
|
35
|
+
end
|
36
|
+
@klass
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_json
|
40
|
+
build.to_json
|
41
|
+
end
|
42
|
+
|
43
|
+
def parent?
|
44
|
+
! @parent.nil?
|
45
|
+
end
|
46
|
+
|
47
|
+
protected
|
48
|
+
|
49
|
+
def populate_instance instance
|
50
|
+
FakerMaker[parent].populate_instance instance if self.parent?
|
51
|
+
@attributes.each do |attr|
|
52
|
+
value = nil
|
53
|
+
|
54
|
+
if attr.array?
|
55
|
+
value = Array.new.tap{ |a| attr.cardinality.times{ a << attr.block.call } }
|
56
|
+
else
|
57
|
+
value = attr.block.call
|
58
|
+
end
|
59
|
+
|
60
|
+
instance.send "#{attr.name}=", value
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def instantiate
|
67
|
+
assemble.new
|
68
|
+
end
|
69
|
+
|
70
|
+
def attach_attributes_to_class
|
71
|
+
@attributes.each do |attr|
|
72
|
+
@klass.send( :attr_accessor, attr.name )
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def assert_valid_options options
|
77
|
+
options.assert_valid_keys :class, :parent
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/faker_maker.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext/string'
|
3
|
+
require 'active_support/core_ext/hash'
|
4
|
+
require 'active_support/core_ext/object/json'
|
5
|
+
require 'faker_maker/version'
|
6
|
+
require 'faker_maker/base'
|
7
|
+
require 'faker_maker/factory'
|
8
|
+
require 'faker_maker/definition_proxy'
|
9
|
+
require 'faker_maker/attribute'
|
10
|
+
|
11
|
+
module FakerMaker
|
12
|
+
extend FakerMaker::Base
|
13
|
+
|
14
|
+
class Error < StandardError; end
|
15
|
+
# Your code goes here...
|
16
|
+
|
17
|
+
module_function
|
18
|
+
|
19
|
+
def register_factory factory
|
20
|
+
factory.assemble
|
21
|
+
factories[factory.name] = factory
|
22
|
+
end
|
23
|
+
|
24
|
+
def factories
|
25
|
+
@factories ||= {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def build name
|
29
|
+
factory = factories[name]
|
30
|
+
raise "No such factory '#{name}'" if factory.nil?
|
31
|
+
factory.build
|
32
|
+
end
|
33
|
+
|
34
|
+
def [] name
|
35
|
+
factories[name]
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
FM = FakerMaker
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: faker_maker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nigel Brookes-Thomas
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faker
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.8'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.8'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.16'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.16'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: FakerMaker is a simple fixture generator with a concise and straightforward
|
112
|
+
syntax.
|
113
|
+
email:
|
114
|
+
- nigel@brookes-thomas.co.uk
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- ".gitignore"
|
120
|
+
- ".rspec"
|
121
|
+
- ".travis.yml"
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- bin/console
|
128
|
+
- bin/setup
|
129
|
+
- faker_maker.gemspec
|
130
|
+
- lib/.DS_Store
|
131
|
+
- lib/faker_maker.rb
|
132
|
+
- lib/faker_maker/attribute.rb
|
133
|
+
- lib/faker_maker/base.rb
|
134
|
+
- lib/faker_maker/definition_proxy.rb
|
135
|
+
- lib/faker_maker/factory.rb
|
136
|
+
- lib/faker_maker/version.rb
|
137
|
+
homepage: https://github.com/BillyRuffian/faker_maker
|
138
|
+
licenses:
|
139
|
+
- MIT
|
140
|
+
metadata:
|
141
|
+
source_code_uri: https://github.com/BillyRuffian/faker_maker
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubygems_version: 3.0.2
|
158
|
+
signing_key:
|
159
|
+
specification_version: 4
|
160
|
+
summary: FakerMaker bakes fakes.
|
161
|
+
test_files: []
|