From 31f7c9d4a042d6923771350b96f58e17b20c3bf4 Mon Sep 17 00:00:00 2001 From: John Bolliger Date: Thu, 6 Jun 2024 12:15:57 -0700 Subject: [PATCH 1/2] added ruby-3.1 compatability --- lib/active_remote/association.rb | 6 +++--- spec/lib/active_remote/persistence_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/active_remote/association.rb b/lib/active_remote/association.rb index 6493b31..d01511d 100644 --- a/lib/active_remote/association.rb +++ b/lib/active_remote/association.rb @@ -39,7 +39,7 @@ def belongs_to(belongs_to_klass, options = {}) search_hash[:guid] = object.send(foreign_key) search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope) - search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first + search_hash.values.any?(&:nil?) ? nil : klass.search(**search_hash).first end end @@ -80,7 +80,7 @@ def has_many(has_many_class, options = {}) search_hash[foreign_key] = object.guid search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope) - search_hash.values.any?(&:nil?) ? [] : klass.search(search_hash) + search_hash.values.any?(&:nil?) ? [] : klass.search(**search_hash) end options[:has_many] = true @@ -120,7 +120,7 @@ def has_one(has_one_klass, options = {}) search_hash[foreign_key] = object.guid search_hash[options[:scope]] = object.send(options[:scope]) if options.key?(:scope) - search_hash.values.any?(&:nil?) ? nil : klass.search(search_hash).first + search_hash.values.any?(&:nil?) ? nil : klass.search(**search_hash).first end end diff --git a/spec/lib/active_remote/persistence_spec.rb b/spec/lib/active_remote/persistence_spec.rb index bfd6212..a4fdeda 100644 --- a/spec/lib/active_remote/persistence_spec.rb +++ b/spec/lib/active_remote/persistence_spec.rb @@ -351,7 +351,7 @@ end it "updates a remote record" do - expect(rpc).to receive(:execute).with(:update, "name" => "foo", "guid" => "123") + expect(rpc).to receive(:execute).with(:update, {"name" => "foo", "guid" => "123"}) tag.update_attribute(:name, "foo") end From 8eed22ada3f131f6d230997dacff7a62e8a2e912 Mon Sep 17 00:00:00 2001 From: John Bolliger Date: Fri, 7 Jun 2024 15:14:29 -0700 Subject: [PATCH 2/2] Added ruby matrix testing --- .github/workflows/ruby.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..3eef37c --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,32 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +# GitHub recommends pinning actions to a commit SHA. +# To get a newer version, you will need to update the SHA. +# You can also reference a tag or branch, but the action may change without warning. + +name: Ruby CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: [2.5, 2.6, 2.7, head, debug, jruby-9.3, jruby-9.4, jruby-head, truffleruby, truffleruby-head] + continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1 + with: + ruby-version: ${{ matrix.ruby }} + - run: bundle install + - run: bundle rspec