test-prof 0.1.0.beta1 → 0.1.0.pre5

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/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +69 -0
  5. data/.travis.yml +5 -0
  6. data/Gemfile +4 -0
  7. data/README.md +2 -6
  8. data/Rakefile +8 -0
  9. data/bin/setup +8 -0
  10. data/circle.yml +11 -0
  11. data/guides/any_fixture.md +1 -1
  12. data/guides/stack_prof.md +1 -1
  13. data/lib/test_prof/factory_doctor.rb +9 -11
  14. data/lib/test_prof/ruby_prof.rb +5 -2
  15. data/lib/test_prof/stack_prof.rb +5 -2
  16. data/lib/test_prof/version.rb +1 -1
  17. data/lib/test_prof.rb +1 -19
  18. data/spec/integrations/any_fixture_spec.rb +11 -0
  19. data/spec/integrations/before_all_spec.rb +11 -0
  20. data/spec/integrations/event_prof_spec.rb +100 -0
  21. data/spec/integrations/factory_doctor_spec.rb +20 -0
  22. data/spec/integrations/fixtures/rspec/any_fixture_fixture.rb +37 -0
  23. data/spec/integrations/fixtures/rspec/before_all_fixture.rb +32 -0
  24. data/spec/integrations/fixtures/rspec/event_prof_factory_create_fixture.rb +23 -0
  25. data/spec/integrations/fixtures/rspec/event_prof_fixture.rb +51 -0
  26. data/spec/integrations/fixtures/rspec/event_prof_sidekiq_fixture.rb +53 -0
  27. data/spec/integrations/fixtures/rspec/factory_doctor_fixture.rb +33 -0
  28. data/spec/integrations/fixtures/rspec/rspec_stamp_fixture_tmpl.rb +33 -0
  29. data/spec/integrations/rspec_stamp_spec.rb +53 -0
  30. data/spec/spec_helper.rb +38 -0
  31. data/spec/support/ar_models.rb +43 -0
  32. data/spec/support/instrumenter_stub.rb +19 -0
  33. data/spec/support/integration_helpers.rb +13 -0
  34. data/spec/support/transactional_context.rb +11 -0
  35. data/spec/test_prof/any_fixture_spec.rb +66 -0
  36. data/spec/test_prof/event_prof_spec.rb +138 -0
  37. data/spec/test_prof/ext/float_duration_spec.rb +12 -0
  38. data/spec/test_prof/factory_doctor_spec.rb +84 -0
  39. data/spec/test_prof/rspec_stamp/parser_spec.rb +58 -0
  40. data/spec/test_prof/rspec_stamp_spec.rb +281 -0
  41. data/spec/test_prof/ruby_prof_spec.rb +109 -0
  42. data/spec/test_prof/stack_prof_spec.rb +73 -0
  43. data/spec/test_prof_spec.rb +23 -0
  44. data/test-prof.gemspec +35 -0
  45. metadata +38 -21
  46. data/CHANGELOG.md +0 -7
  47. data/assets/flamegraph.demo.html +0 -173
  48. data/assets/flamegraph.template.html +0 -196
  49. data/assets/src/d3-tip.js +0 -352
  50. data/assets/src/d3-tip.min.js +0 -1
  51. data/assets/src/d3.flameGraph.css +0 -92
  52. data/assets/src/d3.flameGraph.js +0 -459
  53. data/assets/src/d3.flameGraph.min.css +0 -1
  54. data/assets/src/d3.flameGraph.min.js +0 -1
  55. data/assets/src/d3.v4.min.js +0 -8
  56. data/guides/factory_prof.md +0 -85
  57. data/guides/rubocop.md +0 -48
  58. data/lib/test_prof/cops/rspec/aggregate_failures.rb +0 -140
  59. data/lib/test_prof/factory_prof/factory_girl_patch.rb +0 -12
  60. data/lib/test_prof/factory_prof/printers/flamegraph.rb +0 -71
  61. data/lib/test_prof/factory_prof/printers/simple.rb +0 -28
  62. data/lib/test_prof/factory_prof.rb +0 -140
  63. data/lib/test_prof/rubocop.rb +0 -3
@@ -1,173 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>TestProf: FactoryFlame</title>
5
- <meta name="viewport" content="width=device-width">
6
- <meta charset="UTF-8">
7
- <link rel="stylesheet" type="text/css" href="src/d3.flameGraph.css">
8
- <style>
9
- html, body {
10
- height: 100%;
11
- width: 100%;
12
- min-width: 300px;
13
- }
14
-
15
- body {
16
- background: #f9f9f9;
17
- color: #363636;
18
- font: 18px/30px "Arial",sans-serif;
19
- margin: 0;
20
- padding: 0;
21
- }
22
-
23
- a {
24
- text-decoration: none;
25
- color: #ff5e5e
26
- }
27
-
28
- a:visited, a:active{
29
- color: #ff5e5e;
30
- }
31
-
32
- a:hover{
33
- opacity: 0.8;
34
- }
35
-
36
- h1 {
37
- font-size: 30px;
38
- line-height: 32px;
39
- letter-spacing: 2px;
40
- font-weight: bold;
41
- padding: 30px 0 30px 0;
42
- margin: 0;
43
- }
44
-
45
- .main {
46
- height: 100%;
47
- width: 100%;
48
- margin: 0;
49
- padding: 0;
50
- }
51
-
52
- header {
53
- position: relative;
54
- text-align: center;
55
- background: #fff;
56
- overflow: hidden;
57
- display: flex;
58
- align-items: center;
59
- flex-direction: column;
60
- }
61
-
62
- .chart {
63
- display: flex;
64
- align-items: center;
65
- position: relative;
66
- box-sizing: border-box;
67
- flex-direction: column;
68
- }
69
-
70
- .humanoids__link {
71
- width: 130px;
72
- }
73
-
74
- .humanoids{
75
- position: absolute;
76
- bottom: -23px;
77
- width: 150px;
78
- height: 60px;
79
- margin: 0 auto 0 -10px;
80
- font-size: 0;
81
- transform: scale(0.6);
82
- }
83
- .humanoids circle{
84
- transform: scaleY(1);
85
- transform-origin: 50%;
86
- animation-duration: 8s;
87
- animation-name: humanoids-blink;
88
- animation-iteration-count: infinite;
89
- }
90
- .humanoids svg{
91
- height: 60px;
92
- }
93
- .humanoids__human, .humanoids__martian{
94
- position: absolute;
95
- width: 80px;
96
- height: 90px;
97
- transition: transform 300ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
98
- transform: translateY(0);
99
- }
100
- .humanoids__human:hover, .humanoids__martian:hover{
101
- transform: translateY(-12px);
102
- }
103
- .humanoids__martian{
104
- left: 0;
105
- }
106
- .humanoids__human{
107
- right: 0;
108
- }
109
- .humanoids__human circle{
110
- animation-delay: 0.5s;
111
- }
112
-
113
- [name="root"] .label {
114
- text-align: center;
115
- }
116
- </style>
117
- </head>
118
- <body>
119
- <div class="main">
120
- <header>
121
- <h1>FactoryFlame Report</h1>
122
- <a class="humanoids__link" href="https://evilmartians.com">
123
- <div class="humanoids">
124
- <div class="humanoids__martian"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 92"><path fill="#f64242" d="M26 88L8 78l18-10"/><path fill="#f64242" d="M94 92v-6H44c-5.5 0-10-4.5-10-10s4.5-10 10-10h50V32c0-14-7.9-22-22-22H48c-14.1 0-22 8-22 22v60h68z"/><circle fill="#FFF" cx="48" cy="50" r="8"/><circle fill="#FFF" cx="72" cy="50" r="8"/><circle fill="#BF6C35" cx="48" cy="50" r="4"/><circle fill="#BF6C35" cx="72" cy="50" r="4"/><g fill="#663F4C"><path d="M48 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6zM82 50c0 5.5-4.5 10-10 10s-10-4.5-10-10 4.5-10 10-10 10 4.5 10 10zm-16 0c0 3.3 2.7 6 6 6s6-2.7 6-6-2.7-6-6-6-6 2.7-6 6z"/><path d="M102 8c-3.8 0-6-2.2-6-6 0-1.1-.9-2-2-2s-2 .9-2 2c0 2.2.5 4.1 1.5 5.7L88.2 13c-4-3.3-9.5-5-16.2-5H48c-6.7 0-12.2 1.7-16.2 4.9l-5.3-5.3C27.5 6.1 28 4.2 28 2c0-1.1-.9-2-2-2s-2 .9-2 2c0 3.8-2.2 6-6 6-1.1 0-2 .9-2 2s.9 2 2 2c2.2 0 4.1-.5 5.7-1.5l5.3 5.3c-3.2 4-4.9 9.5-4.9 16.2v34.8L3.9 78 24 89v3h4V32c0-12.9 7.1-20 20-20h24c12.9 0 20 7.1 20 20v32H44c-6.6 0-12 5.4-12 12s5.4 12 12 12h48v4h4v-8h-2l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-4 8h-4l-4-8-3.1 6.2C37.1 80.7 36 78.5 36 76c0-4.4 3.6-8 8-8l4 8 4-8h4l4 8 4-8h4l4 8 4-8h4l4 8 4-8h8V32c0-6.7-1.7-12.2-4.9-16.2l5.3-5.3c1.6 1 3.5 1.5 5.7 1.5 1.1 0 2-.9 2-2s-1-2-2.1-2zM24 84.4L12.1 78 24 71.4v13z"/></g></svg></div>
125
- <div class="humanoids__human"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 92"><path fill="#FFFFFF" d="M14 62v30h68v-6H32c-5.5 0-10-4.5-10-10s4.5-10 10-10h50v-4c4 0 8-3.6 8-8s-4-8-8-8V32c0-14-7.9-22-22-22H36c-14.1 0-22 8-22 22v14c-4 0-8 3.6-8 8s4 8 8 8z"/><circle fill="#FFF" cx="36" cy="50" r="8"/><circle fill="#FFF" cx="60" cy="50" r="8"/><circle fill="#f64242" cx="36" cy="50" r="4"/><circle fill="#f64242" cx="60" cy="50" r="4"/><path fill="#f64242" d="M60 10H36c-14.1 0-22 8-22 22v2l4-4 6 6 6-6 6 6 6-6 6 6 6-6 6 6 6-6 6 6 6-6 4 4v-2c0-14-7.9-22-22-22z"/><g fill="#663F4C"><path d="M36 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6zM60 60c-5.5 0-10-4.5-10-10s4.5-10 10-10 10 4.5 10 10-4.5 10-10 10zm0-16c-3.3 0-6 2.7-6 6s2.7 6 6 6 6-2.7 6-6-2.7-6-6-6z"/><path d="M12 63.8V92h4V32c0-12.9 7.1-20 20-20h24c12.9 0 20 7.1 20 20v32H32c-6.6 0-12 5.4-12 12s5.4 12 12 12h48v4h4v-8H74v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1h-6v-1c0-1.7-1.3-3-3-3s-3 1.3-3 3v1c-4 0-8-3.6-8-8s3.6-8 8-8h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h6v1c0 1.7 1.3 3 3 3s3-1.3 3-3v-1h4v-4.2c5-.9 8-5 8-9.8s-3-8.9-8-9.8V32c0-15.3-8.7-24-24-24H36c-15.3 0-24 8.7-24 24v12.2c-5 .9-8 5-8 9.8s3 8.9 8 9.8zm72-15.5c2 .8 4 3 4 5.7s-2 4.8-4 5.7V48.3zm-72 0v11.3c-2-.8-4-3-4-5.7s2-4.7 4-5.6z"/></g></svg></div>
126
- </div>
127
- </a>
128
- </header>
129
- <div class="chart">
130
- <div id="chart">
131
- </div>
132
- <hr>
133
- <div id="details">
134
- </div>
135
- </div>
136
- </div>
137
-
138
- <script type="text/javascript" src="src/d3.v4.min.js"></script>
139
- <script type="text/javascript" src="src/d3-tip.js"></script>
140
- <script type="text/javascript" src="src/d3.flameGraph.js"></script>
141
-
142
- <script type="text/javascript">
143
- var flameGraph = d3.flameGraph()
144
- .height(360)
145
- .cellHeight(18)
146
- .transitionDuration(750)
147
- .transitionEase(d3.easeCubic)
148
- .title("");
149
-
150
- // Example on how to use custom tooltips using d3-tip.
151
- var tip = d3.tip()
152
- .direction("s")
153
- .offset([8, 0])
154
- .attr('class', 'd3-flame-graph-tip')
155
- .html(function(d) { return "name: " + d.data.name + ", total: " + d.data.value; });
156
-
157
- flameGraph.tooltip(tip);
158
-
159
- report_data = JSON.parse('{"total":27,"roots":[{"name":"user","value":21,"children":[{"name":"account","value":20}]},{"name":"post","value":1,"children":[{"name":"account","value":1,"children":[{"name":"user","value":1,"children":[{"name":"account","value":1}]}]}]},{"name":"comment","value":4,"children":[{"name":"post","value":1},{"name":"user","value":3,"children":[{"name":"account","value":3,"children":[{"name":"post","value":2,"children":[{"name":"account","value":2,"children":[{"name":"user","value":2,"children":[{"name":"account","value":2,"children":[{"name":"subscription","value":2,"children":[{"name":"order","value":2,"children":[{"name":"account","value":2,"children":[{"name":"user","value":2,"children":[{"name":"profile","value":2,"children":[{"name":"post","value":1,"children":[{"name":"account","value":1,"children":[{"name":"user","value":1,"children":[{"name":"account","value":1,"children":[{"name":"subscription","value":1}]}]}]}]}]}]}]}]}]}]}]}]}]},{"name":"user","value":1,"children":[{"name":"account","value":1,"children":[{"name":"subscription","value":1,"children":[{"name":"order","value":1,"children":[{"name":"account","value":1,"children":[{"name":"user","value":1,"children":[{"name":"profile","value":1}]}]}]}]}]}]}]}]}]},{"name":"account","value":1}]}');
160
-
161
- data = {
162
- name: "root",
163
- value: report_data.total,
164
- color: "#9e9e9e",
165
- children: report_data.roots
166
- };
167
-
168
- d3.select("#chart")
169
- .datum(data)
170
- .call(flameGraph);
171
- </script>
172
- </body>
173
- </html>