Skip to content

Commit

Permalink
Update tests and version test
Browse files Browse the repository at this point in the history
Version fix
  • Loading branch information
hannahramadan committed Jan 8, 2024
1 parent 70c3c77 commit a0e188c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion test/multiverse/suites/view_component/Envfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
instrumentation_methods :chain, :prepend

VIEW_COMPONENT_VERSIONS = [
[nil, 2.7]
[nil, 2.7],
['2.53.0', 2.4]
]

def gem_list(view_component_version = nil)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ def index
end
end

class DummyViewComponentInstrumentationClass
include NewRelic::Agent::Instrumentation::ViewComponent
end

class ViewComponentInstrumentationTest < ActionDispatch::IntegrationTest
include MultiverseHelpers
setup_and_teardown_agent

FAKE_CLASS = DummyViewComponentInstrumentationClass.new

def test_metric_recorded
get('/view_components')

Expand All @@ -37,4 +43,12 @@ def test_records_nothing_if_tracing_disabled

assert_metrics_not_recorded('View/view_component/view_component_instrumentation_test.rb/ExampleComponent')
end

def test_metric_path_falsey
assert(FAKE_CLASS.metric_path(nil), 'component')
end

def test_metric_path_unknown_file_pattern
assert(FAKE_CLASS.metric_path('nothing_to_see_here'), 'unknown')
end
end

0 comments on commit a0e188c

Please sign in to comment.