From f494b4f7e669f43df2a393912c7001b846a40e23 Mon Sep 17 00:00:00 2001 From: Chedli Bourguiba Date: Thu, 15 Aug 2024 10:35:23 +0200 Subject: [PATCH] Fix CI [ part 2 ] (#645) * Fix CI * Restrict ruby version 3.1 only * Fix rails 6 deprecation warnings --- .github/workflows/rspec.yml | 11 +++++++---- best_in_place.gemspec | 2 ++ lib/best_in_place/engine.rb | 4 ++-- lib/best_in_place/railtie.rb | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index 95ad2d62..22c882a5 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -8,15 +8,18 @@ on: branches: - master +permissions: + contents: read + jobs: test: - name: Ruby ${{ matrix.ruby }} - Gemfile ${{ matrix.gemfile }} + name: Ruby ${{ matrix.ruby }} - ${{ matrix.rails }} runs-on: ubuntu-latest strategy: matrix: ruby: [3.1, 3.2, 3.3] - gemfile: + rails: - rails_7.0 - rails_7.1 - rails_7.2 @@ -24,15 +27,15 @@ jobs: env: RAILS_ENV: test DISPLAY: ":99.0" + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails }}.gemfile steps: + - uses: actions/checkout@v4 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - env: - BUNDLE_GEMFILE: gemfiles/${{ matrix.rails }}.gemfile - name: Set up PhantomJS run: | diff --git a/best_in_place.gemspec b/best_in_place.gemspec index 610a8b88..39dc5df0 100644 --- a/best_in_place.gemspec +++ b/best_in_place.gemspec @@ -24,6 +24,8 @@ DESC s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } s.require_paths = ["lib"] + s.required_ruby_version = '>= 3.1.0' + s.add_runtime_dependency 'actionpack', '>= 7.0' s.add_runtime_dependency 'railties', '>= 7.0' end diff --git a/lib/best_in_place/engine.rb b/lib/best_in_place/engine.rb index 1f1c5b5c..9df6895c 100644 --- a/lib/best_in_place/engine.rb +++ b/lib/best_in_place/engine.rb @@ -1,8 +1,8 @@ module BestInPlace class Engine < Rails::Engine initializer 'best_in_place' do - ActionView::Base.send(:include, BestInPlace::Helper) - ActionController::Base.send(:include, BestInPlace::ControllerExtensions) + ActiveSupport.on_load(:action_view) { include BestInPlace::Helper } + ActiveSupport.on_load(:action_controller_base) { include BestInPlace::ControllerExtensions } end end end diff --git a/lib/best_in_place/railtie.rb b/lib/best_in_place/railtie.rb index 0af81763..629f3513 100644 --- a/lib/best_in_place/railtie.rb +++ b/lib/best_in_place/railtie.rb @@ -4,7 +4,7 @@ module BestInPlace class Railtie < ::Rails::Railtie #:nodoc: config.after_initialize do - BestInPlace::ViewHelpers = ActionView::Base.new({}, {}, "") + BestInPlace::ViewHelpers = ActionView::Base.empty end end end