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.
- checksums.yaml +4 -4
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.rubocop.yml +69 -0
- data/.travis.yml +5 -0
- data/Gemfile +4 -0
- data/README.md +2 -6
- data/Rakefile +8 -0
- data/bin/setup +8 -0
- data/circle.yml +11 -0
- data/guides/any_fixture.md +1 -1
- data/guides/stack_prof.md +1 -1
- data/lib/test_prof/factory_doctor.rb +9 -11
- data/lib/test_prof/ruby_prof.rb +5 -2
- data/lib/test_prof/stack_prof.rb +5 -2
- data/lib/test_prof/version.rb +1 -1
- data/lib/test_prof.rb +1 -19
- data/spec/integrations/any_fixture_spec.rb +11 -0
- data/spec/integrations/before_all_spec.rb +11 -0
- data/spec/integrations/event_prof_spec.rb +100 -0
- data/spec/integrations/factory_doctor_spec.rb +20 -0
- data/spec/integrations/fixtures/rspec/any_fixture_fixture.rb +37 -0
- data/spec/integrations/fixtures/rspec/before_all_fixture.rb +32 -0
- data/spec/integrations/fixtures/rspec/event_prof_factory_create_fixture.rb +23 -0
- data/spec/integrations/fixtures/rspec/event_prof_fixture.rb +51 -0
- data/spec/integrations/fixtures/rspec/event_prof_sidekiq_fixture.rb +53 -0
- data/spec/integrations/fixtures/rspec/factory_doctor_fixture.rb +33 -0
- data/spec/integrations/fixtures/rspec/rspec_stamp_fixture_tmpl.rb +33 -0
- data/spec/integrations/rspec_stamp_spec.rb +53 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/ar_models.rb +43 -0
- data/spec/support/instrumenter_stub.rb +19 -0
- data/spec/support/integration_helpers.rb +13 -0
- data/spec/support/transactional_context.rb +11 -0
- data/spec/test_prof/any_fixture_spec.rb +66 -0
- data/spec/test_prof/event_prof_spec.rb +138 -0
- data/spec/test_prof/ext/float_duration_spec.rb +12 -0
- data/spec/test_prof/factory_doctor_spec.rb +84 -0
- data/spec/test_prof/rspec_stamp/parser_spec.rb +58 -0
- data/spec/test_prof/rspec_stamp_spec.rb +281 -0
- data/spec/test_prof/ruby_prof_spec.rb +109 -0
- data/spec/test_prof/stack_prof_spec.rb +73 -0
- data/spec/test_prof_spec.rb +23 -0
- data/test-prof.gemspec +35 -0
- metadata +38 -21
- data/CHANGELOG.md +0 -7
- data/assets/flamegraph.demo.html +0 -173
- data/assets/flamegraph.template.html +0 -196
- data/assets/src/d3-tip.js +0 -352
- data/assets/src/d3-tip.min.js +0 -1
- data/assets/src/d3.flameGraph.css +0 -92
- data/assets/src/d3.flameGraph.js +0 -459
- data/assets/src/d3.flameGraph.min.css +0 -1
- data/assets/src/d3.flameGraph.min.js +0 -1
- data/assets/src/d3.v4.min.js +0 -8
- data/guides/factory_prof.md +0 -85
- data/guides/rubocop.md +0 -48
- data/lib/test_prof/cops/rspec/aggregate_failures.rb +0 -140
- data/lib/test_prof/factory_prof/factory_girl_patch.rb +0 -12
- data/lib/test_prof/factory_prof/printers/flamegraph.rb +0 -71
- data/lib/test_prof/factory_prof/printers/simple.rb +0 -28
- data/lib/test_prof/factory_prof.rb +0 -140
- data/lib/test_prof/rubocop.rb +0 -3
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
require "test_prof/rspec_stamp"
|
|
5
|
+
|
|
6
|
+
describe TestProf::RSpecStamp do
|
|
7
|
+
subject { described_class }
|
|
8
|
+
|
|
9
|
+
describe "#config" do
|
|
10
|
+
after { described_class.remove_instance_variable(:@config) }
|
|
11
|
+
|
|
12
|
+
subject { described_class.config }
|
|
13
|
+
|
|
14
|
+
it "handles array tags" do
|
|
15
|
+
subject.tags = [:todo]
|
|
16
|
+
expect(subject.tags).to eq([:todo])
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it "handles string tags" do
|
|
20
|
+
subject.tags = "todo"
|
|
21
|
+
expect(subject.tags).to eq([:todo])
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
it "handle string hash tags" do
|
|
25
|
+
subject.tags = "fix:me"
|
|
26
|
+
expect(subject.tags).to eq([{ fix: :me }])
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "handle several tags" do
|
|
30
|
+
subject.tags = "todo,fix:me"
|
|
31
|
+
expect(subject.tags).to eq([:todo, { fix: :me }])
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
describe ".apply_tags" do
|
|
36
|
+
let(:code) { source.split("\n") }
|
|
37
|
+
|
|
38
|
+
let(:lines) { [1] }
|
|
39
|
+
|
|
40
|
+
let(:tags) { [:todo] }
|
|
41
|
+
|
|
42
|
+
subject { described_class.apply_tags(code, lines, tags) }
|
|
43
|
+
|
|
44
|
+
let(:source) do
|
|
45
|
+
<<~CODE
|
|
46
|
+
it "doesn't do what it should do" do
|
|
47
|
+
expect(subject.body).to eq("OK")
|
|
48
|
+
end
|
|
49
|
+
CODE
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
let(:expected) do
|
|
53
|
+
<<~CODE
|
|
54
|
+
it "doesn't do what it should do", :todo do
|
|
55
|
+
expect(subject.body).to eq("OK")
|
|
56
|
+
end
|
|
57
|
+
CODE
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
specify do
|
|
61
|
+
is_expected.to eq 0
|
|
62
|
+
expect(code.join("\n")).to eq expected.strip
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context "with several examples" do
|
|
66
|
+
let(:source) do
|
|
67
|
+
<<~CODE
|
|
68
|
+
it 'succeeds' do
|
|
69
|
+
expect(subject.body).to eq("OK")
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context "not found" do
|
|
73
|
+
let(:post) { draft_post }
|
|
74
|
+
|
|
75
|
+
it 'fails' do
|
|
76
|
+
expect(subject.body).to eq("Not Found")
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
CODE
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
let(:expected) do
|
|
83
|
+
<<~CODE
|
|
84
|
+
it 'succeeds' do
|
|
85
|
+
expect(subject.body).to eq("OK")
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
context "not found" do
|
|
89
|
+
let(:post) { draft_post }
|
|
90
|
+
|
|
91
|
+
it 'fails', :todo do
|
|
92
|
+
expect(subject.body).to eq("Not Found")
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
CODE
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
let(:lines) { [8] }
|
|
99
|
+
|
|
100
|
+
specify do
|
|
101
|
+
is_expected.to eq 0
|
|
102
|
+
expect(code.join("\n")).to eq expected.strip
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
context "patch all" do
|
|
106
|
+
let(:expected) do
|
|
107
|
+
<<~CODE
|
|
108
|
+
it 'succeeds', :todo do
|
|
109
|
+
expect(subject.body).to eq("OK")
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
context "not found" do
|
|
113
|
+
let(:post) { draft_post }
|
|
114
|
+
|
|
115
|
+
it 'fails', :todo do
|
|
116
|
+
expect(subject.body).to eq("Not Found")
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
CODE
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
let(:lines) { [1, 8] }
|
|
123
|
+
|
|
124
|
+
specify do
|
|
125
|
+
is_expected.to eq 0
|
|
126
|
+
expect(code.join("\n")).to eq expected.strip
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
context "without description" do
|
|
132
|
+
let(:source) do
|
|
133
|
+
<<~CODE
|
|
134
|
+
specify do
|
|
135
|
+
expect(subject.body).to eq("Not Found")
|
|
136
|
+
end
|
|
137
|
+
CODE
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
let(:expected) do
|
|
141
|
+
<<~CODE
|
|
142
|
+
specify 'works', :todo do
|
|
143
|
+
expect(subject.body).to eq("Not Found")
|
|
144
|
+
end
|
|
145
|
+
CODE
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
specify do
|
|
149
|
+
is_expected.to eq 0
|
|
150
|
+
expect(code.join("\n")).to eq expected.strip
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
context "one-liner" do
|
|
155
|
+
let(:source) do
|
|
156
|
+
<<~CODE
|
|
157
|
+
it("is") { expect(subject.body).to eq("Not Found") }
|
|
158
|
+
CODE
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
let(:expected) do
|
|
162
|
+
<<~CODE
|
|
163
|
+
it('is', :todo) { expect(subject.body).to eq("Not Found") }
|
|
164
|
+
CODE
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
specify do
|
|
168
|
+
is_expected.to eq 0
|
|
169
|
+
expect(code.join("\n")).to eq expected.strip
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
context "one-liner without description" do
|
|
174
|
+
let(:source) do
|
|
175
|
+
<<~CODE
|
|
176
|
+
it { expect(subject.body).to eq("Not Found") }
|
|
177
|
+
CODE
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
let(:expected) do
|
|
181
|
+
<<~CODE
|
|
182
|
+
it('works', :todo) { expect(subject.body).to eq("Not Found") }
|
|
183
|
+
CODE
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
specify do
|
|
187
|
+
is_expected.to eq 0
|
|
188
|
+
expect(code.join("\n")).to eq expected.strip
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
context "with existing tags" do
|
|
193
|
+
let(:source) do
|
|
194
|
+
<<~CODE
|
|
195
|
+
it 'is "KOI"', :log do
|
|
196
|
+
expect(subject.body).to eq("Not Found")
|
|
197
|
+
end
|
|
198
|
+
CODE
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
let(:expected) do
|
|
202
|
+
<<~CODE
|
|
203
|
+
it 'is "KOI"', :log, :todo do
|
|
204
|
+
expect(subject.body).to eq("Not Found")
|
|
205
|
+
end
|
|
206
|
+
CODE
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
specify do
|
|
210
|
+
is_expected.to eq 0
|
|
211
|
+
expect(code.join("\n")).to eq expected.strip
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
context "with several tags" do
|
|
216
|
+
let(:source) do
|
|
217
|
+
<<~CODE
|
|
218
|
+
specify do
|
|
219
|
+
expect(subject.body).to eq("Not Found")
|
|
220
|
+
end
|
|
221
|
+
CODE
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
let(:expected) do
|
|
225
|
+
<<~CODE
|
|
226
|
+
specify 'works', :todo, a: :b, c: 'd' do
|
|
227
|
+
expect(subject.body).to eq("Not Found")
|
|
228
|
+
end
|
|
229
|
+
CODE
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
let(:tags) { [{ a: :b }, :todo, { c: 'd' }] }
|
|
233
|
+
|
|
234
|
+
specify do
|
|
235
|
+
is_expected.to eq 0
|
|
236
|
+
expect(code.join("\n")).to eq expected.strip
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
context "with existing tags" do
|
|
240
|
+
let(:source) do
|
|
241
|
+
<<~CODE
|
|
242
|
+
it 'is', :log, level: :debug do
|
|
243
|
+
expect(subject.body).to eq("Not Found")
|
|
244
|
+
end
|
|
245
|
+
CODE
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
let(:expected) do
|
|
249
|
+
<<~CODE
|
|
250
|
+
it 'is', :log, :todo, level: :debug, a: :b, c: 'd' do
|
|
251
|
+
expect(subject.body).to eq("Not Found")
|
|
252
|
+
end
|
|
253
|
+
CODE
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
specify do
|
|
257
|
+
is_expected.to eq 0
|
|
258
|
+
expect(code.join("\n")).to eq expected.strip
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
context "with multiline description" do
|
|
264
|
+
let(:source) do
|
|
265
|
+
<<~CODE
|
|
266
|
+
it %q{
|
|
267
|
+
succeeds
|
|
268
|
+
this time
|
|
269
|
+
} do
|
|
270
|
+
expect(subject.body).to eq("OK")
|
|
271
|
+
end
|
|
272
|
+
CODE
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
specify do
|
|
276
|
+
is_expected.to eq 1
|
|
277
|
+
expect(code.join("\n")).to eq source.strip
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
describe TestProf::RubyProf do
|
|
6
|
+
# Use fresh config all for every example
|
|
7
|
+
after { described_class.remove_instance_variable(:@config) }
|
|
8
|
+
|
|
9
|
+
describe ".config" do
|
|
10
|
+
subject { described_class.config }
|
|
11
|
+
|
|
12
|
+
specify "defaults", :aggregate_failiures do
|
|
13
|
+
expect(subject.printer).to eq :call_stack
|
|
14
|
+
expect(subject.mode).to eq :wall
|
|
15
|
+
expect(subject.min_percent).to eq 1
|
|
16
|
+
expect(subject.include_threads).to eq false
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "#resolve_printer" do
|
|
20
|
+
it "works with custom class" do
|
|
21
|
+
subject.printer = TestProf
|
|
22
|
+
expect(subject.resolve_printer).to eq(['custom', TestProf])
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it "raises when unknown printer" do
|
|
26
|
+
subject.printer = 'unknown'
|
|
27
|
+
expect { subject.resolve_printer }.to raise_error(ArgumentError)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe "#profile" do
|
|
33
|
+
let(:ruby_prof) { double("ruby_prof") }
|
|
34
|
+
let(:profile) { double("profile") }
|
|
35
|
+
|
|
36
|
+
before do
|
|
37
|
+
stub_const("RubyProf::Profile", ruby_prof)
|
|
38
|
+
expect(profile).to receive(:start)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
specify "with default config" do
|
|
42
|
+
expect(ruby_prof).to receive(:new).with(
|
|
43
|
+
merge_fibers: true,
|
|
44
|
+
include_threads: [Thread.current]
|
|
45
|
+
).and_return(profile)
|
|
46
|
+
|
|
47
|
+
expect(described_class.profile).to be_a(described_class::Report)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
specify "with custom config" do
|
|
51
|
+
described_class.config.include_threads = true
|
|
52
|
+
|
|
53
|
+
expect(ruby_prof).to receive(:new).with(
|
|
54
|
+
merge_fibers: true
|
|
55
|
+
).and_return(profile)
|
|
56
|
+
|
|
57
|
+
described_class.profile
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "Report#dump" do
|
|
62
|
+
let(:ruby_prof) { double("ruby_prof") }
|
|
63
|
+
let(:profile) { double("profile") }
|
|
64
|
+
let(:result) { double("result") }
|
|
65
|
+
let(:printer_class) { double("printer_class") }
|
|
66
|
+
let(:printer) { double("printer") }
|
|
67
|
+
|
|
68
|
+
before do
|
|
69
|
+
stub_const("::RubyProf::Profile", ruby_prof)
|
|
70
|
+
expect(ruby_prof).to receive(:new).and_return(profile)
|
|
71
|
+
expect(profile).to receive(:start)
|
|
72
|
+
expect(profile).to receive(:stop).and_return(result)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
subject { described_class.profile }
|
|
76
|
+
|
|
77
|
+
specify "with default config" do
|
|
78
|
+
expect(result).to receive(:eliminate_methods!)
|
|
79
|
+
|
|
80
|
+
stub_const("::RubyProf::CallStackPrinter", printer_class)
|
|
81
|
+
expect(printer_class).to receive(:new).with(result).and_return(printer)
|
|
82
|
+
expect(printer).to receive(:print).with(anything, min_percent: 1).and_return("")
|
|
83
|
+
|
|
84
|
+
subject.dump("stub")
|
|
85
|
+
|
|
86
|
+
expect(File.exist?("tmp/ruby-prof-report-call_stack-wall-stub.html")).to eq true
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
specify "with custom config" do
|
|
90
|
+
described_class.config.printer = :flat
|
|
91
|
+
described_class.config.eliminate_methods = []
|
|
92
|
+
described_class.config.min_percent = 2
|
|
93
|
+
described_class.config.mode = :cpu
|
|
94
|
+
|
|
95
|
+
TestProf.config.timestamps = true
|
|
96
|
+
|
|
97
|
+
expect(result).not_to receive(:eliminate_methods!)
|
|
98
|
+
|
|
99
|
+
stub_const("RubyProf::FlatPrinter", printer_class)
|
|
100
|
+
expect(printer_class).to receive(:new).with(result).and_return(printer)
|
|
101
|
+
expect(printer).to receive(:print).with(anything, min_percent: 2).and_return("")
|
|
102
|
+
expect(Time).to receive(:now).and_return(double("now", to_i: 123_454_321))
|
|
103
|
+
|
|
104
|
+
subject.dump("stub")
|
|
105
|
+
|
|
106
|
+
expect(File.exist?("tmp/ruby-prof-report-flat-cpu-stub-123454321.html")).to eq true
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
describe TestProf::StackProf do
|
|
6
|
+
# Use fresh config all for every example
|
|
7
|
+
after { described_class.remove_instance_variable(:@config) }
|
|
8
|
+
|
|
9
|
+
describe ".config" do
|
|
10
|
+
subject { described_class.config }
|
|
11
|
+
|
|
12
|
+
specify "defaults", :aggregate_failiures do
|
|
13
|
+
expect(subject.mode).to eq :wall
|
|
14
|
+
expect(subject.interval).to be_nil
|
|
15
|
+
expect(subject.raw).to eq false
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
describe "#profile" do
|
|
20
|
+
let(:stack_prof) { double("stack_prof") }
|
|
21
|
+
|
|
22
|
+
before do
|
|
23
|
+
stub_const("StackProf", stack_prof)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
specify "with default config" do
|
|
27
|
+
expect(stack_prof).to receive(:start).with(
|
|
28
|
+
mode: :wall,
|
|
29
|
+
raw: false
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
described_class.profile
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
specify "with custom config" do
|
|
36
|
+
described_class.config.raw = true
|
|
37
|
+
described_class.config.mode = :cpu
|
|
38
|
+
|
|
39
|
+
expect(stack_prof).to receive(:start).with(
|
|
40
|
+
mode: :cpu,
|
|
41
|
+
raw: true
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
described_class.profile
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
specify "when block is given" do
|
|
48
|
+
expect(stack_prof).to receive(:run).with(
|
|
49
|
+
out: "tmp/stack-prof-report-wall-stub.dump",
|
|
50
|
+
mode: :wall,
|
|
51
|
+
raw: false
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
described_class.profile("stub") { 0 == 1 }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "#dump" do
|
|
59
|
+
let(:stack_prof) { double("stack_prof") }
|
|
60
|
+
|
|
61
|
+
before do
|
|
62
|
+
stub_const("StackProf", stack_prof)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "stops profiling and stores results" do
|
|
66
|
+
expect(stack_prof).to receive(:results).with(
|
|
67
|
+
"tmp/stack-prof-report-wall-stub.dump"
|
|
68
|
+
)
|
|
69
|
+
expect(stack_prof).to receive(:stop)
|
|
70
|
+
described_class.dump("stub")
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
describe TestProf do
|
|
6
|
+
describe "#with_timestamps" do
|
|
7
|
+
context "when enabled" do
|
|
8
|
+
before { described_class.config.timestamps = false }
|
|
9
|
+
|
|
10
|
+
it { expect(described_class.with_timestamps("a/b/c.html")).to eq 'a/b/c.html' }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context "when enabled" do
|
|
14
|
+
before do
|
|
15
|
+
described_class.config.timestamps = true
|
|
16
|
+
expect(Time).to receive(:now).and_return(double("now", to_i: 123_454_321))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it { expect(described_class.with_timestamps("a/b/c.html")).to eq 'a/b/c-123454321.html' }
|
|
20
|
+
it { expect(described_class.with_timestamps("a/b/c")).to eq 'a/b/c-123454321' }
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/test-prof.gemspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'test_prof/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "test-prof"
|
|
8
|
+
spec.version = TestProf::VERSION
|
|
9
|
+
spec.authors = ["Vladimir Dementyev"]
|
|
10
|
+
spec.email = ["dementiev.vm@gmail.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = "Ruby applications tests profiling tools"
|
|
13
|
+
spec.description = %{
|
|
14
|
+
Ruby applications tests profiling tools.
|
|
15
|
+
|
|
16
|
+
Contains tools to anylyze factories usage, integrate with Ruby profilers,
|
|
17
|
+
profile your examples using ActiveSupport notifications (if any) and
|
|
18
|
+
statically analyze your code with custom Rubocop cops.
|
|
19
|
+
}
|
|
20
|
+
spec.homepage = "http://github.com/palkan/test-prof"
|
|
21
|
+
spec.license = "MIT"
|
|
22
|
+
|
|
23
|
+
spec.files = `git ls-files`.split($/)
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.5"
|
|
29
|
+
spec.add_development_dependency "activerecord", "~> 5.0"
|
|
30
|
+
spec.add_development_dependency "factory_girl", "~> 4.8.0"
|
|
31
|
+
spec.add_development_dependency "rubocop", "~> 0.49"
|
|
32
|
+
spec.add_development_dependency "pry-byebug"
|
|
33
|
+
spec.add_development_dependency "sqlite3"
|
|
34
|
+
spec.add_development_dependency "sidekiq", "~> 4.0"
|
|
35
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: test-prof
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.0.
|
|
4
|
+
version: 0.1.0.pre5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Vladimir Dementyev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -146,31 +146,26 @@ executables: []
|
|
|
146
146
|
extensions: []
|
|
147
147
|
extra_rdoc_files: []
|
|
148
148
|
files:
|
|
149
|
-
-
|
|
149
|
+
- ".gitignore"
|
|
150
|
+
- ".rspec"
|
|
151
|
+
- ".rubocop.yml"
|
|
152
|
+
- ".travis.yml"
|
|
153
|
+
- Gemfile
|
|
150
154
|
- LICENSE.txt
|
|
151
155
|
- README.md
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
- assets/src/d3-tip.min.js
|
|
156
|
-
- assets/src/d3.flameGraph.css
|
|
157
|
-
- assets/src/d3.flameGraph.js
|
|
158
|
-
- assets/src/d3.flameGraph.min.css
|
|
159
|
-
- assets/src/d3.flameGraph.min.js
|
|
160
|
-
- assets/src/d3.v4.min.js
|
|
156
|
+
- Rakefile
|
|
157
|
+
- bin/setup
|
|
158
|
+
- circle.yml
|
|
161
159
|
- guides/any_fixture.md
|
|
162
160
|
- guides/before_all.md
|
|
163
161
|
- guides/event_prof.md
|
|
164
162
|
- guides/factory_doctor.md
|
|
165
|
-
- guides/factory_prof.md
|
|
166
163
|
- guides/rspec_stamp.md
|
|
167
|
-
- guides/rubocop.md
|
|
168
164
|
- guides/ruby_prof.md
|
|
169
165
|
- guides/stack_prof.md
|
|
170
166
|
- lib/test-prof.rb
|
|
171
167
|
- lib/test_prof.rb
|
|
172
168
|
- lib/test_prof/any_fixture.rb
|
|
173
|
-
- lib/test_prof/cops/rspec/aggregate_failures.rb
|
|
174
169
|
- lib/test_prof/event_prof.rb
|
|
175
170
|
- lib/test_prof/event_prof/custom_events.rb
|
|
176
171
|
- lib/test_prof/event_prof/custom_events/factory_create.rb
|
|
@@ -184,22 +179,44 @@ files:
|
|
|
184
179
|
- lib/test_prof/factory_doctor/factory_girl_patch.rb
|
|
185
180
|
- lib/test_prof/factory_doctor/minitest.rb
|
|
186
181
|
- lib/test_prof/factory_doctor/rspec.rb
|
|
187
|
-
- lib/test_prof/factory_prof.rb
|
|
188
|
-
- lib/test_prof/factory_prof/factory_girl_patch.rb
|
|
189
|
-
- lib/test_prof/factory_prof/printers/flamegraph.rb
|
|
190
|
-
- lib/test_prof/factory_prof/printers/simple.rb
|
|
191
182
|
- lib/test_prof/logging.rb
|
|
192
183
|
- lib/test_prof/recipes/rspec/any_fixture.rb
|
|
193
184
|
- lib/test_prof/recipes/rspec/before_all.rb
|
|
194
185
|
- lib/test_prof/rspec_stamp.rb
|
|
195
186
|
- lib/test_prof/rspec_stamp/parser.rb
|
|
196
187
|
- lib/test_prof/rspec_stamp/rspec.rb
|
|
197
|
-
- lib/test_prof/rubocop.rb
|
|
198
188
|
- lib/test_prof/ruby_prof.rb
|
|
199
189
|
- lib/test_prof/ruby_prof/rspec.rb
|
|
200
190
|
- lib/test_prof/stack_prof.rb
|
|
201
191
|
- lib/test_prof/stack_prof/rspec.rb
|
|
202
192
|
- lib/test_prof/version.rb
|
|
193
|
+
- spec/integrations/any_fixture_spec.rb
|
|
194
|
+
- spec/integrations/before_all_spec.rb
|
|
195
|
+
- spec/integrations/event_prof_spec.rb
|
|
196
|
+
- spec/integrations/factory_doctor_spec.rb
|
|
197
|
+
- spec/integrations/fixtures/rspec/any_fixture_fixture.rb
|
|
198
|
+
- spec/integrations/fixtures/rspec/before_all_fixture.rb
|
|
199
|
+
- spec/integrations/fixtures/rspec/event_prof_factory_create_fixture.rb
|
|
200
|
+
- spec/integrations/fixtures/rspec/event_prof_fixture.rb
|
|
201
|
+
- spec/integrations/fixtures/rspec/event_prof_sidekiq_fixture.rb
|
|
202
|
+
- spec/integrations/fixtures/rspec/factory_doctor_fixture.rb
|
|
203
|
+
- spec/integrations/fixtures/rspec/rspec_stamp_fixture_tmpl.rb
|
|
204
|
+
- spec/integrations/rspec_stamp_spec.rb
|
|
205
|
+
- spec/spec_helper.rb
|
|
206
|
+
- spec/support/ar_models.rb
|
|
207
|
+
- spec/support/instrumenter_stub.rb
|
|
208
|
+
- spec/support/integration_helpers.rb
|
|
209
|
+
- spec/support/transactional_context.rb
|
|
210
|
+
- spec/test_prof/any_fixture_spec.rb
|
|
211
|
+
- spec/test_prof/event_prof_spec.rb
|
|
212
|
+
- spec/test_prof/ext/float_duration_spec.rb
|
|
213
|
+
- spec/test_prof/factory_doctor_spec.rb
|
|
214
|
+
- spec/test_prof/rspec_stamp/parser_spec.rb
|
|
215
|
+
- spec/test_prof/rspec_stamp_spec.rb
|
|
216
|
+
- spec/test_prof/ruby_prof_spec.rb
|
|
217
|
+
- spec/test_prof/stack_prof_spec.rb
|
|
218
|
+
- spec/test_prof_spec.rb
|
|
219
|
+
- test-prof.gemspec
|
|
203
220
|
homepage: http://github.com/palkan/test-prof
|
|
204
221
|
licenses:
|
|
205
222
|
- MIT
|
|
@@ -220,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
220
237
|
version: 1.3.1
|
|
221
238
|
requirements: []
|
|
222
239
|
rubyforge_project:
|
|
223
|
-
rubygems_version: 2.6.
|
|
240
|
+
rubygems_version: 2.6.4
|
|
224
241
|
signing_key:
|
|
225
242
|
specification_version: 4
|
|
226
243
|
summary: Ruby applications tests profiling tools
|