From 1f313bfbaca0a5e20c42ef5508728dfa16b08393 Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Thu, 6 Jan 2022 21:42:08 -0800 Subject: [PATCH] Add Rails 7 to CI Adjust for process_action being private in Rails 7 --- .github/workflows/tests.yml | 9 +++++++++ spec/lib/logstasher/instrumentation_spec.rb | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0dbf399..c917ef5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -43,6 +43,15 @@ jobs: - ruby-version: 3.1 bundler-version: default rails-version: 6.1 + - ruby-version: 2.7 + bundler-version: default + rails-version: '7.0' + - ruby-version: '3.0' + bundler-version: default + rails-version: '7.0' + - ruby-version: '3.1' + bundler-version: default + rails-version: '7.0' steps: - uses: actions/checkout@v2 - name: Set up Ruby ${{ matrix.ruby-version }} diff --git a/spec/lib/logstasher/instrumentation_spec.rb b/spec/lib/logstasher/instrumentation_spec.rb index 328fa95..c3eb537 100644 --- a/spec/lib/logstasher/instrumentation_spec.rb +++ b/spec/lib/logstasher/instrumentation_spec.rb @@ -25,14 +25,14 @@ def subject.index(*_args) it 'adds default fields to payload' do expect(LogStasher).to receive(:add_default_fields_to_payload).once expect(LogStasher).to receive(:add_default_fields_to_request_context).once - subject.process_action(:index) + subject.send(:process_action, :index) end it 'creates the request context before processing' do LogStasher.request_context[:some_key] = 'value' expect(LogStasher).to receive(:clear_request_context).once.and_call_original expect do - subject.process_action(:index) + subject.send(:process_action, :index) end.to change { LogStasher.request_context } end @@ -41,7 +41,7 @@ def subject.index(*_args) anything).once expect(ActiveSupport::Notifications).to receive(:instrument).with('process_action.action_controller', anything).once - subject.process_action(:index) + subject.send(:process_action, :index) end context 'request context has custom fields defined' do @@ -56,7 +56,7 @@ def subject.index(*_args) end it 'should retain the value in the request context' do - subject.process_action(:index) + subject.send(:process_action, :index) end after :each do