Skip to content

Commit

Permalink
Fix test for exceptions
Browse files Browse the repository at this point in the history
In ruby 3.3 it is just `undefined method 'name' for nil`
In the others, it is nil:NilClass
  • Loading branch information
bliof-fc committed Feb 9, 2024
1 parent 127420d commit b284a41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/integration/sinatra_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class MySinatraApp < Sinatra::Base
it 'logs the request with the exception' do
get '/error', {}, 'HTTP_X_REQUEST_ID' => '700a6a01'

expect(last_log_entry).to start_with("E, #{time_pid_tags} GET /error 500 in 0ms type=request #{data_as_text} exception=undefined method `name' for nil:NilClass\n")
expect(last_log_entry).to start_with("E, #{time_pid_tags} GET /error 500 in 0ms type=request #{data_as_text} exception=undefined method `name' for nil")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
'_request.request_id' => '471a34dc',
'_request.duration' => 0,
'_exception.klass' => 'NoMethodError',
'_exception.message' => start_with("undefined method `name' for nil:NilClass"),
'_exception.message' => start_with("undefined method `name' for nil"),
'_exception.backtrace' => be_a(String),
'_tags' => '471a34dc TEST_TAG',
)
Expand Down

0 comments on commit b284a41

Please sign in to comment.