From 942a2e6a8084b7e7c241e7bd527e4e157addfb0f Mon Sep 17 00:00:00 2001 From: Aleksandar Ivanov Date: Tue, 27 Feb 2024 12:18:15 +0200 Subject: [PATCH 1/2] Run the build for PR-s The build will now run when a PR is opened For external contributors it will require a manual approval --- .github/workflows/build-and-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 2b862fc..b36f6ad 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -3,8 +3,8 @@ run-name: Build & Test - ${{ github.ref_name }} on: push: - branches: - - '**' + branches: [ master ] + pull_request: jobs: version-check: From 8b9c918b99fcd46a140144490f9af267ec6519f5 Mon Sep 17 00:00:00 2001 From: Aleksandar Ivanov Date: Tue, 27 Feb 2024 12:36:12 +0200 Subject: [PATCH 2/2] Fix undefined method for nil spec with ruby-head --- spec/integration/sinatra_spec.rb | 9 ++++++++- spec/support/request_spec.rb | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/spec/integration/sinatra_spec.rb b/spec/integration/sinatra_spec.rb index 091f0a9..0b067b4 100644 --- a/spec/integration/sinatra_spec.rb +++ b/spec/integration/sinatra_spec.rb @@ -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 diff --git a/spec/support/request_spec.rb b/spec/support/request_spec.rb index 1cdba1f..6c651d8 100644 --- a/spec/support/request_spec.rb +++ b/spec/support/request_spec.rb @@ -97,6 +97,13 @@ { username: 'yoshi' }, 'HTTP_USER_AGENT' => 'Chrome', 'HTTP_X_REQUEST_ID' => '471a34dc' + method_missing_exception = + if Gem::Version.new(RUBY_VERSION) > Gem::Version.new('3.4.0dev') + "undefined method 'name' for nil" + else + "undefined method `name' for nil" + end + expect(last_log_entry).to include( 'version' => '1.1', 'host' => 'bird.example.com', @@ -115,7 +122,7 @@ '_request.request_id' => '471a34dc', '_request.duration' => 0, '_exception.klass' => 'NoMethodError', - '_exception.message' => start_with("undefined method `name' for nil"), + '_exception.message' => start_with(method_missing_exception), '_exception.backtrace' => be_a(String), '_tags' => '471a34dc TEST_TAG', )