diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76a2259..f293108 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.4, 2.7, '3.0', 3.1, 3.2, truffleruby-head] + ruby: [2.7, '3.0', 3.1, 3.2, 3.3, 3.4, head, truffleruby-head] steps: - uses: actions/checkout@v3 @@ -22,13 +22,13 @@ jobs: run: | sudo apt-get install libsqlite3-dev - - name: Install legacy bundler for Ruby 2.4 - if: ${{ matrix.ruby == 2.4 }} + - name: Install legacy bundler for Ruby 2.7 + if: ${{ matrix.ruby == 2.7 }} run: | - gem install -q bundler -v 2.3.26 + gem install -q bundler -v 2.4.22 - - name: Install bundler 2.4+ for modern Rubies - if: ${{ matrix.ruby != 2.4 }} + - name: Install bundler 2.7+ for modern Rubies + if: ${{ matrix.ruby != 2.7 }} run: | gem install -q bundler diff --git a/.rubocop.yml b/.rubocop.yml index 43747b4..2edc619 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,4 @@ -require: +plugins: - rubocop-performance - rubocop-rspec @@ -23,7 +23,10 @@ Lint/DuplicateMethods: Exclude: - 'spec/fixtures/*.rb' -RSpec/FilePath: +RSpec/SpecFilePathFormat: + Enabled: false + +RSpec/SpecFilePathSuffix: Enabled: false RSpec/DescribedClass: @@ -76,7 +79,7 @@ Layout/LineLength: Exclude: - 'lib/**/**.rb' -Naming/PredicateName: +Naming/PredicatePrefix: Exclude: - 'lib/**/**.rb' diff --git a/jsonapi-serializer.gemspec b/jsonapi-serializer.gemspec index d8ccb4a..22eb5ce 100644 --- a/jsonapi-serializer.gemspec +++ b/jsonapi-serializer.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |gem| gem.require_paths = ['lib'] gem.extra_rdoc_files = ['LICENSE.txt', 'README.md'] - gem.add_runtime_dependency('activesupport', '>= 4.2') + gem.add_dependency('activesupport', '>= 4.2') gem.add_development_dependency('activerecord') gem.add_development_dependency('bundler') diff --git a/lib/fast_jsonapi/object_serializer.rb b/lib/fast_jsonapi/object_serializer.rb index 04bd98d..417e3b8 100644 --- a/lib/fast_jsonapi/object_serializer.rb +++ b/lib/fast_jsonapi/object_serializer.rb @@ -117,7 +117,7 @@ def is_collection?(resource, force_is_collection = nil) end def inherited(subclass) - super(subclass) + super subclass.attributes_to_serialize = attributes_to_serialize.dup if attributes_to_serialize.present? subclass.relationships_to_serialize = relationships_to_serialize.dup if relationships_to_serialize.present? subclass.cachable_relationships_to_serialize = cachable_relationships_to_serialize.dup if cachable_relationships_to_serialize.present? @@ -271,7 +271,7 @@ def create_relationship(base_key, relationship_type, options, block) name: name, id_method_name: compute_id_method_name( options[:id_method_name], - "#{base_serialization_key}#{id_postfix}".to_sym, + :"#{base_serialization_key}#{id_postfix}", polymorphic, options[:serializer], block diff --git a/spec/fixtures/actor.rb b/spec/fixtures/actor.rb index f212de1..0ffd494 100644 --- a/spec/fixtures/actor.rb +++ b/spec/fixtures/actor.rb @@ -6,7 +6,7 @@ class Actor < User attr_accessor :movies, :movie_ids def self.fake(id = nil) - faked = super(id) + faked = super faked.movies = [] faked.movie_ids = [] faked diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4da35af..4e2ac77 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,6 +8,7 @@ end require 'active_support' +require 'active_support/core_ext/object' require 'active_support/core_ext/object/json' require 'jsonapi/serializer' require 'ffaker'