factory_factory_girl 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +22 -14
- data/lib/factory_factory_girl/generators/model_generator.rb +1 -1
- data/lib/factory_factory_girl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f26bd9110b27b0ee92b3a805dc45cd591f9f75e
|
4
|
+
data.tar.gz: cec9e3f0416b9113ad849ec1503d77939e7561d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7081e89e55836a554614af7b0d4b49c233ffa60b5091df57ad6ff234a5b945ae0e8afeaf2d8760253fd3e1958bbe25dc780024b2e5c1f79c9dbc3604cb4d743
|
7
|
+
data.tar.gz: abdc25871cc8b91dec6447390bbf163ca9255ca0a1d8a259b3735f20f58f8375c12bb474ac106089c68af5722e5739ee8faa4f67216c9b22a77067ae2630258e
|
data/README.md
CHANGED
@@ -3,36 +3,33 @@
|
|
3
3
|
|
4
4
|
# FactoryFactoryGirl
|
5
5
|
|
6
|
-
## Notice!!! This gem is still under development, it's very buggy!!!!!
|
7
|
-
|
8
6
|
## Mission
|
9
7
|
|
10
|
-
FactoryGirl is a very useful gem, which lets us generate test data more efficiently. However, if you start new projects very frequently, you will feel painful writing every project's factory, especially when most of them have some common attributes.
|
8
|
+
[FactoryGirl](https://github.com/thoughtbot/factory_girl/) is a very useful gem, which lets us generate test data more efficiently. However, if you start new projects very frequently, you will feel painful writing every project's factory, especially when most of them have some common attributes.
|
11
9
|
|
12
|
-
For example, you use `FFaker::Job.title` to generate all your `name` or `title`'s value, and use `FFaker::Lorem.paragraph` to generate
|
10
|
+
For example, you use `FFaker::Job.title` to generate all your `name` or `title`'s value, and use `FFaker::Lorem.paragraph` to generate `description` or `content`'s value. Then you just need to cope & paste those methods to serveral columns in serveral factories, or even in serveral project's factories.
|
13
11
|
|
14
|
-
So
|
12
|
+
So I created [FactoryFactoryGirl](https://github.com/st0012/factory_factory_girl). The mission of this gem is helping people generate their factory more quickly, with some pre-defined rules like:
|
15
13
|
|
16
|
-
```
|
14
|
+
```
|
17
15
|
FactoryFactoryGirl.configure do |config|
|
18
16
|
config.match(/name|title/, function: "FFaker::Job.title")
|
19
17
|
config.match(/content|descripton/, function: "FFaker::Lorem.paragraph")
|
20
18
|
end
|
21
19
|
```
|
22
|
-
|
23
20
|
And type:
|
24
21
|
|
25
22
|
```
|
26
23
|
$ rails g factory_factory_girl:model post
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
```
|
25
|
+
or
|
26
|
+
```
|
30
27
|
$ rails g factory_factory_girl:model job
|
31
28
|
```
|
32
29
|
|
33
30
|
Then you will see you factory file have some pre-defined value.
|
34
31
|
|
35
|
-
```
|
32
|
+
```
|
36
33
|
FactoryGirl.define do
|
37
34
|
........
|
38
35
|
name { FFaker::Job.title }
|
@@ -41,7 +38,9 @@ FactoryGirl.define do
|
|
41
38
|
end
|
42
39
|
```
|
43
40
|
|
44
|
-
|
41
|
+
And the rule you defined in this project, can be use in any other projects. You won't need to copy & paste the setting of those frequently seen column's.
|
42
|
+
|
43
|
+
I think this gem could be helpful, but also needs a lot work. So if you find any bug or want any feature, please open an issue or email me , thanks 😄.
|
45
44
|
|
46
45
|
|
47
46
|
## Installation
|
@@ -78,7 +77,7 @@ And run
|
|
78
77
|
$ rails g factory_factory_girl:model YOUR_MODEL
|
79
78
|
```
|
80
79
|
|
81
|
-
Notice that the default directory is `test/factories
|
80
|
+
**Notice that the default directory is `test/factories`** (this is inherit from `factory_girl_rails`), so if you put your factories somewhere else, you need to specify it like
|
82
81
|
|
83
82
|
```
|
84
83
|
$ rails g factory_factory_girl:model YOUR_MODEL --dir=spec/factories
|
@@ -92,5 +91,14 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
92
91
|
|
93
92
|
## Contributing
|
94
93
|
|
95
|
-
|
94
|
+
- [Fork it](https://github.com/st0012/factory_factory_girl/fork)
|
95
|
+
- Create your feature branch (git checkout -b my-new-feature)
|
96
|
+
- Commit your changes (git commit -am 'Add some feature')
|
97
|
+
- Push to the branch (git push origin my-new-feature)
|
98
|
+
- Create a new Pull Request
|
99
|
+
|
100
|
+
## Wanted contribution topic
|
96
101
|
|
102
|
+
- More specs
|
103
|
+
- New feature
|
104
|
+
- Bug report/fix
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_factory_girl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stan Low
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_girl_rails
|