factory_girl_instruments 1.0.0 → 1.0.1
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 +4 -4
- data/README.md +30 -2
- data/lib/factory_girl_instruments/version.rb +1 -1
- metadata +2 -3
- data/factory_girl_instruments_test.db +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 879c33a8388c6c44c438c4e7df09d4d3b591071e
|
4
|
+
data.tar.gz: b9484cc6cb157939d0a7f9e16e60c1aad07e3e8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bbe25d0736d0c3a37fb8dfeec06d67be84134a7e13d77d3d2ab619909b1b20ba58a3b57abe048f78f8527ce59530f95635110af1289510c82367cd78d3c9205a
|
7
|
+
data.tar.gz: 7275eed01ca7c4b87bfae5a89a55f3ae3a050140b67c7ae2d920eb0ff889e9b34b7427202f40d7626aeda9528927e9ba9be0de0181d4f93ab9b56eddb7d9071f
|
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Factory Girl Instruments
|
2
2
|
|
3
3
|
[](https://semaphoreci.com/shiroyasha/factory_girl_instruments)
|
4
|
+
[](https://badge.fury.io/rb/factory_girl_instruments)
|
4
5
|
|
5
|
-
Instruments for benchmarking, tracing, and debugging
|
6
|
+
Instruments for benchmarking, tracing, and debugging
|
7
|
+
[Factory Girl](https://github.com/thoughtbot/factory_girl) models.
|
6
8
|
|
7
9
|
Table of content:
|
8
10
|
|
@@ -11,6 +13,32 @@ Table of content:
|
|
11
13
|
- [Benchmark all Factories](#benchmarking-all-factory-girl-models)
|
12
14
|
- [Trace Factory Girl calls](#tracing-factory-girl-calls)
|
13
15
|
|
16
|
+
## Purpose of this gem
|
17
|
+
|
18
|
+
Factory Girl is probably the base of your Rails test suite, but how deeply you
|
19
|
+
understand the models and the associations that are created in your tests?
|
20
|
+
|
21
|
+
Factory Girl Instruments help in these three aspects:
|
22
|
+
|
23
|
+
1. Slow test suites: Factory Girl is used for the bulk of tests in Rails. Even a
|
24
|
+
small performance improvement in one of your factories can dramatically
|
25
|
+
improve the speed of your overall test suite.
|
26
|
+
|
27
|
+
Hint: Run `FactoryGirl.benchmark_all`.
|
28
|
+
|
29
|
+
2. Deeper understanding of the database state: By tracing factory girl and SQL
|
30
|
+
calls you can get a deeper understanding of what is actually created in your
|
31
|
+
tests, helping you to debug the issues faster.
|
32
|
+
|
33
|
+
Hint: Run `FactoryGirl.trace { FactoryGirl.create(:user) }`.
|
34
|
+
|
35
|
+
3. Find issues with missconfigured factories: When a factory is properly set up
|
36
|
+
it is a bliss to work with it. However, if there is a hidden deep in the
|
37
|
+
association chain debugging the created model can be a hellish experience.
|
38
|
+
|
39
|
+
Hint: Run `FactoryGirl.trace { FactoryGirl.create(:user) }` and observe the
|
40
|
+
chain of calls.
|
41
|
+
|
14
42
|
## Install
|
15
43
|
|
16
44
|
Add the following to your Gemfile:
|
@@ -37,7 +65,7 @@ If you have a `user` factory, you can benchmark it with:
|
|
37
65
|
FactoryGirl.benchmark(:user)
|
38
66
|
```
|
39
67
|
|
40
|
-
By default, the `FactoryGirl.
|
68
|
+
By default, the `FactoryGirl.create(<model>)` is called. You can pass `:method`
|
41
69
|
to override this:
|
42
70
|
|
43
71
|
``` ruby
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl_instruments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factory_girl
|
@@ -111,7 +111,6 @@ files:
|
|
111
111
|
- bin/console
|
112
112
|
- bin/setup
|
113
113
|
- factory_girl_instruments.gemspec
|
114
|
-
- factory_girl_instruments_test.db
|
115
114
|
- lib/factory_girl_instruments.rb
|
116
115
|
- lib/factory_girl_instruments/benchmarking.rb
|
117
116
|
- lib/factory_girl_instruments/tracing.rb
|
Binary file
|