Module: TestProf
- Extended by:
- Logging
- Defined in:
- lib/test_prof.rb,
lib/test_prof/utils.rb,
lib/test_prof/logging.rb,
lib/test_prof/version.rb,
lib/test_prof/tag_prof.rb,
lib/test_prof/ruby_prof.rb,
lib/test_prof/event_prof.rb,
lib/test_prof/stack_prof.rb,
lib/test_prof/any_fixture.rb,
lib/test_prof/factory_bot.rb,
lib/test_prof/rspec_stamp.rb,
lib/test_prof/factory_prof.rb,
lib/test_prof/rspec_dissect.rb,
lib/test_prof/factory_doctor.rb,
lib/test_prof/tag_prof/rspec.rb,
lib/test_prof/factory_default.rb,
lib/test_prof/event_prof/rspec.rb,
lib/test_prof/rspec_stamp/rspec.rb,
lib/test_prof/ext/float_duration.rb,
lib/test_prof/rspec_stamp/parser.rb,
lib/test_prof/ext/string_truncate.rb,
lib/test_prof/rspec_dissect/rspec.rb,
lib/test_prof/factory_doctor/rspec.rb,
lib/test_prof/recipes/rspec/sample.rb,
lib/test_prof/ext/array_bsearch_index.rb,
lib/test_prof/recipes/minitest/sample.rb,
lib/test_prof/recipes/rspec/let_it_be.rb,
lib/test_prof/utils/sized_ordered_set.rb,
lib/test_prof/ext/string_strip_heredoc.rb,
lib/test_prof/recipes/rspec/before_all.rb,
lib/test_prof/factory_prof/fabrication_patch.rb,
lib/test_prof/factory_prof/factory_bot_patch.rb,
lib/test_prof/factory_doctor/factory_bot_patch.rb,
lib/test_prof/factory_default/factory_bot_patch.rb,
lib/test_prof/factory_prof/factory_builders/fabrication.rb,
lib/test_prof/factory_prof/factory_builders/factory_bot.rb
Overview
:nodoc: all
Defined Under Namespace
Modules: AnyFixture, ArrayBSearchIndex, BeforeAll, EventProf, FactoryDefault, FactoryDoctor, FactoryProf, FloatDuration, LetItBe, Logging, MinitestSample, RSpecDissect, RSpecSample, RSpecStamp, RubyProf, StackProf, StringStripHeredoc, StringTruncate, TagProf, Utils Classes: Configuration
Constant Summary collapse
- VERSION =
"0.4.6".freeze
- FACTORY_GIRL_NAMES =
{ 'factory_bot' => '::FactoryBot', 'factory_girl' => '::FactoryGirl' }.freeze
Constants included from Logging
Class Method Summary collapse
-
.activate(env_var, val = nil) ⇒ Object
Run block only if provided env var is present and equal to the provided value (if any).
-
.artifact_path(filename) ⇒ Object
Return a path to store artifact.
-
.asset_path(filename) ⇒ Object
Return absolute path to asset.
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
-
.require(gem_name, msg = nil) ⇒ Object
Require gem and shows a custom message if it fails to load.
Methods included from Logging
Class Method Details
.activate(env_var, val = nil) ⇒ Object
Run block only if provided env var is present and equal to the provided value (if any). Contains workaround for applications using Spring.
61 62 63 64 65 66 67 |
# File 'lib/test_prof.rb', line 61 def activate(env_var, val = nil) if defined?(::Spring) ::Spring.after_fork { activate!(env_var, val) { yield } } else activate!(env_var, val) { yield } end end |
.artifact_path(filename) ⇒ Object
Return a path to store artifact
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/test_prof.rb', line 75 def artifact_path(filename) FileUtils.mkdir_p(config.output_dir) ( ::File.join( config.output_dir, filename ) ) end |
.asset_path(filename) ⇒ Object
Return absolute path to asset
70 71 72 |
# File 'lib/test_prof.rb', line 70 def asset_path(filename) ::File.(filename, ::File.join(::File.dirname(__FILE__), "..", "assets")) end |
.config ⇒ Object
29 30 31 |
# File 'lib/test_prof.rb', line 29 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
33 34 35 |
# File 'lib/test_prof.rb', line 33 def configure yield config end |
.require(gem_name, msg = nil) ⇒ Object
Require gem and shows a custom message if it fails to load
50 51 52 53 54 55 56 |
# File 'lib/test_prof.rb', line 50 def require(gem_name, msg = nil) Kernel.require gem_name block_given? ? yield : true rescue LoadError log(:error, msg) if msg false end |