Skip to content

Commit

Permalink
Ruby 3.1.4 test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Aug 11, 2023
1 parent 138176b commit b344bb4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/multiverse/suites/roda/roda_instrumentation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def test_transaction_name_error
# pass in {} to produce an error, because {} doesn't support #path and
# confirm that the desired error handling took place
result = NewRelic::Agent::Instrumentation::Roda::TransactionNamer.transaction_name({})

# binding.irb
assert_equal NewRelic::Agent::UNKNOWN_METRIC, result
assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/)
assert_logged(/NoMethodError.*Error encountered trying to identify Roda transaction name/m)
end
end

Expand All @@ -128,7 +128,10 @@ def test_rack_request_params_error
end

def assert_logged(expected)
found = NewRelic::Agent.logger.messages.flatten.any? { |m| m.match?(expected) }
# Example logger array:
# [[:debug, ["NoMethodError : undefined method `path' for \
# {}:Hash - Error encountered trying to identify Roda transaction name"], nil]]
found = NewRelic::Agent.logger.messages.any? { |m| m[1][0].match?(expected) }

assert(found, "Didn't see log message: '#{expected}'")
end
Expand Down

0 comments on commit b344bb4

Please sign in to comment.