From 1841623186ac1f7999b6b13f0ff65a52f8835ba6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Feb 2026 06:03:38 +0000 Subject: [PATCH 1/2] Bump rubocop from 1.84.2 to 1.85.0 Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.84.2 to 1.85.0. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.84.2...v1.85.0) --- updated-dependencies: - dependency-name: rubocop dependency-version: 1.85.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 90c0fe23..a68e3739 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -85,6 +85,9 @@ GEM rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.18.1) + json-schema (5.2.2) + addressable (~> 2.8) + bigdecimal (~> 3.1) jwt (3.1.2) base64 language_server-protocol (3.17.0.5) @@ -100,6 +103,8 @@ GEM net-imap net-pop net-smtp + mcp (0.7.1) + json-schema (>= 4.1) method_source (1.0.0) mini_mime (1.1.5) minitest (5.26.0) @@ -130,7 +135,7 @@ GEM version_gem (~> 1.1, >= 1.1.9) openssl (3.3.2) parallel (1.27.0) - parser (3.3.10.1) + parser (3.3.10.2) ast (~> 2.4.1) racc pp (0.6.3) @@ -172,10 +177,11 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.6) - rubocop (1.84.2) + rubocop (1.85.0) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) + mcp (~> 0.6) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) From cbb2d0afa1eb96c48e35a0c3e03d07b95a499ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serge=20H=C3=A4nni?= Date: Mon, 2 Mar 2026 11:06:56 +0100 Subject: [PATCH 2/2] Fix Rubocop issues --- lib/ioki/apis/endpoints/endpoints.rb | 4 +-- lib/open_api.rb | 6 +---- ..._helpers.rb => extended_client_helpers.rb} | 18 ------------- spec/helper/included_client_helpers.rb | 22 ++++++++++++++++ spec/ioki/faraday_retry_spec.rb | 26 ++++++++++--------- spec/ioki/open_api_spec.rb | 2 +- spec/spec_helper.rb | 3 ++- 7 files changed, 42 insertions(+), 39 deletions(-) rename spec/helper/{client_helpers.rb => extended_client_helpers.rb} (54%) create mode 100644 spec/helper/included_client_helpers.rb diff --git a/lib/ioki/apis/endpoints/endpoints.rb b/lib/ioki/apis/endpoints/endpoints.rb index 23113e6b..2076585a 100644 --- a/lib/ioki/apis/endpoints/endpoints.rb +++ b/lib/ioki/apis/endpoints/endpoints.rb @@ -67,11 +67,11 @@ def self.url_elements(path, *args) raise ArgumentError, 'path: must consist of Strings and Symbols only' end - unless path.select { |element| element.is_a?(Symbol) }.size <= args.size + unless path.grep(Symbol).size <= args.size raise ArgumentError, "args: must have an argument for every symbol in :path. path: #{path}, args: #{args}" end - interpolation_args = path.select { |inner_element| inner_element.is_a?(Symbol) }.zip(args).reverse + interpolation_args = path.grep(Symbol).zip(args).reverse interpolation_path = path.map { |element| element.is_a?(String) ? element : interpolation_args.pop } interpolation_path.map do |path_element, arg| next path_element if path_element.is_a?(String) diff --git a/lib/open_api.rb b/lib/open_api.rb index a2f2e7fd..5117984e 100644 --- a/lib/open_api.rb +++ b/lib/open_api.rb @@ -211,11 +211,7 @@ def schema_path end def file_lines - @file_lines ||= model_file.readlines.to_a - end - - def model_file - File.open file_path + @file_lines ||= File.read(file_path).lines end def file_path diff --git a/spec/helper/client_helpers.rb b/spec/helper/extended_client_helpers.rb similarity index 54% rename from spec/helper/client_helpers.rb rename to spec/helper/extended_client_helpers.rb index 49e63366..42bdba65 100644 --- a/spec/helper/client_helpers.rb +++ b/spec/helper/extended_client_helpers.rb @@ -18,24 +18,6 @@ def setup_driver_client(client_name) end end -module IncludedClientHelpers - def with_platform_client(&block) - platform_client = Ioki::PlatformClient.new - block.call(platform_client) - end - - def with_passenger_client(&block) - passenger_client = Ioki::PassengerClient.new - block.call(passenger_client) - end - - def with_driver_client(&block) - driver_client = Ioki::DriverClient.new - block.call(driver_client) - end -end - RSpec.configure do |c| c.extend ExtendedClientHelpers - c.include IncludedClientHelpers end diff --git a/spec/helper/included_client_helpers.rb b/spec/helper/included_client_helpers.rb new file mode 100644 index 00000000..61cc47aa --- /dev/null +++ b/spec/helper/included_client_helpers.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +module IncludedClientHelpers + def with_platform_client(&block) + platform_client = Ioki::PlatformClient.new + block.call(platform_client) + end + + def with_passenger_client(&block) + passenger_client = Ioki::PassengerClient.new + block.call(passenger_client) + end + + def with_driver_client(&block) + driver_client = Ioki::DriverClient.new + block.call(driver_client) + end +end + +RSpec.configure do |c| + c.include IncludedClientHelpers +end diff --git a/spec/ioki/faraday_retry_spec.rb b/spec/ioki/faraday_retry_spec.rb index 800bdc54..7192ad97 100644 --- a/spec/ioki/faraday_retry_spec.rb +++ b/spec/ioki/faraday_retry_spec.rb @@ -3,23 +3,25 @@ require 'spec_helper' require 'ioki/apis/endpoints/endpoints' -class DummyModel < Ioki::Model::Base - attribute :value, on: :read, type: :integer -end +RSpec.describe Faraday do + let(:dummy_model) do + Class.new(Ioki::Model::Base) do + attribute :value, on: :read, type: :integer + end + end + + let(:client) { Ioki::Client.new(Ioki::Configuration.new, DummyApi) } -class DummyApi - ENDPOINTS = - [ + before do + stub_const('DummyApi', Class.new) + stub_const('DummyApi::ENDPOINTS', [ Ioki::Endpoints::Index.new( :ping, base_path: ['driver'], - model_class: DummyModel + model_class: dummy_model ) - ].freeze -end - -RSpec.describe Faraday do - let(:client) { Ioki::Client.new(Ioki::Configuration.new, DummyApi) } + ].freeze) + end it 'does not retry on 404 errors' do ping_request = stub_request(:get, 'https://app.io.ki/api/driver/ping') diff --git a/spec/ioki/open_api_spec.rb b/spec/ioki/open_api_spec.rb index 1e7d17dd..3b658016 100644 --- a/spec/ioki/open_api_spec.rb +++ b/spec/ioki/open_api_spec.rb @@ -99,7 +99,7 @@ class Example < Base let(:model_file_path) { 'lib/ioki/model/platform/example.rb' } before do - allow(File).to receive(:open).with(model_file_path).and_return(StringIO.new(model_definition)) + allow(File).to receive(:read).with(model_file_path).and_return(StringIO.new(model_definition).string) allow(File).to receive(:write) allow(specification).to receive(:definition_json).and_return(specification_json) # unset Ioki::Model::Platform::Example constant: diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 034be63d..ee57f845 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,7 +12,8 @@ require 'vcr' require 'webmock/rspec' require 'helper/string_helper' -require 'helper/client_helpers' +require 'helper/included_client_helpers' +require 'helper/extended_client_helpers' require 'helper/define_attribute_matcher' RSpec.configure do |config|