Sha256: 29c5b9c2933ac330a967cca4d3f4e2231444a423f75af66fe42b3277148ea05f
Contents?: true
Size: 1.81 KB
Versions: 1
Compression:
Stored size: 1.81 KB
Contents
require 'test_helper.rb' module ActiveRecordProfiler class CollectorTest < ActiveSupport::TestCase def setup @test_log = StringIO.new ActiveRecord::Base.logger = ActiveSupport::Logger.new(@test_log) end def test_template_path_removes_app_root stack_locations = [ "/var/deploy/current/app/views/users/_row.html.erb:34:in `_app_views_users__row_html_erb___3709568271919910637_70125680359900'", "/var/deploy/current/app/views/users/index.html.erb:34:in `_app_views_users_index_html_erb__1553888856029099377_70230900703660'", "/var/deploy/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionview-5.1.4/lib/action_view/template.rb:352:in `instrument_render_template'", ] location = app_collector.call_location_name(stack_locations) assert_match(%r{\A/app/views/users/_row.html.erb:34:in `}, location) end def test_template_path_includes_only_real_path_components stack_locations = [ "/var/deploy/current/app/views/users/_row.html.erb:34:in `_app_views_users__row_html_erb___3709568271919910637_70125680359900'", "/var/deploy/current/app/views/users/index.html.erb:34:in `_app_views_users_index_html_erb__1553888856029099377_70230900703660'", "/var/deploy/rbenv/versions/2.2.4/lib/ruby/gems/2.2.0/gems/actionview-5.1.4/lib/action_view/template.rb:352:in `instrument_render_template'", ] location = app_collector.call_location_name(stack_locations) assert_match(/in `.*app.*views.*users.*row.*html.*erb'\z/, location) end private def app_collector(app_root: "/var/deploy/current") @app_collector ||= Collector.new.tap do |collector| collector.app_path_pattern = Regexp.new(Regexp.quote("/var/deploy/current")) collector.trim_root_path = "/var/deploy/current" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active-record-profiler-2.0.0 | test/active_record_profiler/collector_test.rb |