test-prof 0.1.0.pre5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +16 -4
- data/assets/flamegraph.demo.html +173 -0
- data/assets/flamegraph.template.html +196 -0
- data/assets/src/d3-tip.js +352 -0
- data/assets/src/d3-tip.min.js +1 -0
- data/assets/src/d3.flameGraph.css +92 -0
- data/assets/src/d3.flameGraph.js +459 -0
- data/assets/src/d3.flameGraph.min.css +1 -0
- data/assets/src/d3.flameGraph.min.js +1 -0
- data/assets/src/d3.v4.min.js +8 -0
- data/guides/any_fixture.md +1 -1
- data/guides/event_prof.md +30 -0
- data/guides/factory_default.md +109 -0
- data/guides/factory_prof.md +85 -0
- data/guides/rubocop.md +48 -0
- data/guides/ruby_prof.md +2 -0
- data/guides/stack_prof.md +5 -1
- data/guides/tag_prof.md +52 -0
- data/guides/tests_sampling.md +24 -0
- data/lib/test_prof.rb +31 -7
- data/lib/test_prof/cops/rspec/aggregate_failures.rb +140 -0
- data/lib/test_prof/event_prof/custom_events.rb +3 -3
- data/lib/test_prof/event_prof/custom_events/factory_create.rb +10 -8
- data/lib/test_prof/event_prof/custom_events/sidekiq_inline.rb +10 -8
- data/lib/test_prof/event_prof/custom_events/sidekiq_jobs.rb +12 -10
- data/lib/test_prof/event_prof/rspec.rb +5 -1
- data/lib/test_prof/factory_default.rb +58 -0
- data/lib/test_prof/factory_default/factory_girl_patch.rb +22 -0
- data/lib/test_prof/factory_doctor.rb +11 -9
- data/lib/test_prof/factory_doctor/rspec.rb +5 -3
- data/lib/test_prof/factory_prof.rb +140 -0
- data/lib/test_prof/factory_prof/factory_girl_patch.rb +12 -0
- data/lib/test_prof/factory_prof/printers/flamegraph.rb +71 -0
- data/lib/test_prof/factory_prof/printers/simple.rb +28 -0
- data/lib/test_prof/recipes/minitest/sample.rb +29 -0
- data/lib/test_prof/recipes/rspec/factory_default.rb +9 -0
- data/lib/test_prof/recipes/rspec/sample.rb +13 -0
- data/lib/test_prof/rspec_stamp/rspec.rb +5 -1
- data/lib/test_prof/rubocop.rb +3 -0
- data/lib/test_prof/ruby_prof.rb +6 -12
- data/lib/test_prof/stack_prof.rb +14 -7
- data/lib/test_prof/tag_prof.rb +8 -0
- data/lib/test_prof/tag_prof/rspec.rb +84 -0
- data/lib/test_prof/version.rb +1 -1
- metadata +48 -41
- data/.gitignore +0 -10
- data/.rspec +0 -2
- data/.rubocop.yml +0 -69
- data/.travis.yml +0 -5
- data/Gemfile +0 -4
- data/Rakefile +0 -8
- data/bin/setup +0 -8
- data/circle.yml +0 -11
- data/spec/integrations/any_fixture_spec.rb +0 -11
- data/spec/integrations/before_all_spec.rb +0 -11
- data/spec/integrations/event_prof_spec.rb +0 -100
- data/spec/integrations/factory_doctor_spec.rb +0 -20
- data/spec/integrations/fixtures/rspec/any_fixture_fixture.rb +0 -37
- data/spec/integrations/fixtures/rspec/before_all_fixture.rb +0 -32
- data/spec/integrations/fixtures/rspec/event_prof_factory_create_fixture.rb +0 -23
- data/spec/integrations/fixtures/rspec/event_prof_fixture.rb +0 -51
- data/spec/integrations/fixtures/rspec/event_prof_sidekiq_fixture.rb +0 -53
- data/spec/integrations/fixtures/rspec/factory_doctor_fixture.rb +0 -33
- data/spec/integrations/fixtures/rspec/rspec_stamp_fixture_tmpl.rb +0 -33
- data/spec/integrations/rspec_stamp_spec.rb +0 -53
- data/spec/spec_helper.rb +0 -38
- data/spec/support/ar_models.rb +0 -43
- data/spec/support/instrumenter_stub.rb +0 -19
- data/spec/support/integration_helpers.rb +0 -13
- data/spec/support/transactional_context.rb +0 -11
- data/spec/test_prof/any_fixture_spec.rb +0 -66
- data/spec/test_prof/event_prof_spec.rb +0 -138
- data/spec/test_prof/ext/float_duration_spec.rb +0 -12
- data/spec/test_prof/factory_doctor_spec.rb +0 -84
- data/spec/test_prof/rspec_stamp/parser_spec.rb +0 -58
- data/spec/test_prof/rspec_stamp_spec.rb +0 -281
- data/spec/test_prof/ruby_prof_spec.rb +0 -109
- data/spec/test_prof/stack_prof_spec.rb +0 -73
- data/spec/test_prof_spec.rb +0 -23
- data/test-prof.gemspec +0 -35
@@ -1,73 +0,0 @@
|
|
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
|
data/spec/test_prof_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
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
DELETED
@@ -1,35 +0,0 @@
|
|
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
|