stepford 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -7
- data/lib/stepford/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
Stepford
|
2
2
|
=====
|
3
3
|
|
4
|
-
Stepford is a wrapper and generator for FactoryGirl to automate stuff and make it easier to use.
|
4
|
+
Stepford is a wrapper and generator for [FactoryGirl][factory_girl] and [FactoryGirl Cache][factory_girl-cache] to automate stuff and make it easier to use.
|
5
5
|
|
6
|
-
Stepford::FactoryGirl automatically recursively creates/builds/stubbed factories for null=false and/or presence validated associations. It also lets you specify method name and arguments/options to
|
6
|
+
`Stepford::FactoryGirl` (and there is a short rspec helper) automatically recursively creates/builds/stubbed factories for null=false and/or presence validated associations. It also lets you specify method name and arguments/options to FactoryGirl for associations.
|
7
7
|
|
8
8
|
e.g. if the following is required:
|
9
9
|
* Bar has a required association called house_special which uses the :beer factory, and we have a block we want to send into it
|
10
10
|
* Beer has specials that you want to build as a list of 3 using the :tuesday_special_offer factory
|
11
11
|
|
12
|
-
|
12
|
+
you could set that up like this:
|
13
13
|
|
14
14
|
Stepford::FactoryGirl.create_list(:bar, with_factory_options: {
|
15
15
|
house_special: [:create, :beer, {blk: ->(beer) do; beer.bubbles.create(attributes_for(:bubbles)); end}],
|
@@ -18,7 +18,7 @@ then you could set that up like this:
|
|
18
18
|
# any block you would send to FactoryGirl.create_list(:foo) would go here
|
19
19
|
end
|
20
20
|
|
21
|
-
The
|
21
|
+
The Stepford CLI command will generate your factories.rb or multiple factory files for you.
|
22
22
|
|
23
23
|
e.g. maybe one of your models is called post, then you could generate a factory for post and all of the other models with a one-liner, maybe with the following in the `some/path/factories/post.rb` file:
|
24
24
|
|
@@ -42,8 +42,6 @@ e.g. maybe one of your models is called post, then you could generate a factory
|
|
42
42
|
|
43
43
|
end
|
44
44
|
|
45
|
-
and also let
|
46
|
-
|
47
45
|
### Setup
|
48
46
|
|
49
47
|
In your Rails 3+ project, add this to your Gemfile:
|
@@ -117,7 +115,7 @@ Then you can just use `cache_create`, `cache_create_list`, `cache_build`, `cache
|
|
117
115
|
|
118
116
|
#### CLI
|
119
117
|
|
120
|
-
Stepford has a CLI to automatically create your factories file(s).
|
118
|
+
Stepford has a CLI generator to automatically create your factories file(s).
|
121
119
|
|
122
120
|
##### Creating Factories
|
123
121
|
|
data/lib/stepford/version.rb
CHANGED