Skip to content

Commit

Permalink
Fix undefined method for nil spec with ruby-head
Browse files Browse the repository at this point in the history
  • Loading branch information
bliof-fc committed Feb 28, 2024
1 parent 942a2e6 commit 1c011f4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spec/integration/sinatra_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ 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")
exception_line =
if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('3.4.0dev')
"E, #{time_pid_tags} GET /error 500 in 0ms type=request #{data_as_text} exception=undefined method 'name' for nil"
else
"E, #{time_pid_tags} GET /error 500 in 0ms type=request #{data_as_text} exception=undefined method `name' for nil"
end

expect(last_log_entry).to start_with(exception_line)
end
end
end
Expand Down

0 comments on commit 1c011f4

Please sign in to comment.