From e35d19108a3f14e8a54a6ffe856b11967d907ff3 Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:48:08 +0900 Subject: [PATCH 1/6] Update the rubocop config --- .rubocop.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 5b59c0c5..2f723737 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,5 @@ plugins: - rubocop-performance - -require: - rubocop-rake - rubocop-rspec - rubocop-rspec_rails From 62b2e5a9877af1618c44885645d937edd0f8bac9 Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:48:55 +0900 Subject: [PATCH 2/6] Stubs instance_reader and instance_writer on the class_attribute --- lib/my_api_client/rspec/stub.rb | 3 ++- spec/lib/my_api_client/rspec/stub_spec.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/my_api_client/rspec/stub.rb b/lib/my_api_client/rspec/stub.rb index a789a3b7..3991195a 100644 --- a/lib/my_api_client/rspec/stub.rb +++ b/lib/my_api_client/rspec/stub.rb @@ -68,7 +68,8 @@ def stub_api_client_all(klass, **actions_and_options) # @return [InstanceDouble] # Returns a spy object of the stubbed ApiClient. def stub_api_client(klass, **actions_and_options) - instance = instance_double(klass) + instance = instance_double(klass, logger: klass.logger, 'logger=': nil, + error_handlers: klass.error_handlers) actions_and_options.each { |action, options| stubbing(instance, action, options) } instance end diff --git a/spec/lib/my_api_client/rspec/stub_spec.rb b/spec/lib/my_api_client/rspec/stub_spec.rb index 3c694de8..72ade2ea 100644 --- a/spec/lib/my_api_client/rspec/stub_spec.rb +++ b/spec/lib/my_api_client/rspec/stub_spec.rb @@ -59,6 +59,22 @@ def request_all end describe '#stub_api_client' do + describe 'class_attribute' do + let(:api_client) { stub_api_client(example_api_client) } + + it 'stubs #logger' do + expect(api_client.logger).to eq example_api_client.logger + end + + it 'stubs #logger=' do + expect { api_client.logger = Logger.new($stdout) }.not_to raise_error + end + + it 'stubs #error_handlers' do + expect(api_client.error_handlers).to eq example_api_client.error_handlers + end + end + context 'when use Proc' do let(:api_client) do stub_api_client( From 76c4cef859f832c8e9fd9313ece5e86fc113a557 Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:51:18 +0900 Subject: [PATCH 3/6] :comet: Update CHANGELOG.md --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 672d4b71..d2e07b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Change log +## v1.3.1 (Jun 10, 2025) + +### Feature +### Bugfix +### Security +### Breaking Change +### Rubocop Challenge +### Dependabot +### Misc + +* [#1096](https://github.com/ryz310/my_api_client/pull/1096) Stubs `instance_reader` and `instance_writer` on the `class_attribute` ([@ryz310](https://github.com/ryz310)) + ## v1.3.0 (Jun 10, 2025) ### Feature From 5942115b735b6351bc0e41ac048ac9a95b702c8d Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:51:18 +0900 Subject: [PATCH 4/6] :comet: Update version number --- lib/my_api_client/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/my_api_client/version.rb b/lib/my_api_client/version.rb index ab609a8c..e9fcb3a9 100644 --- a/lib/my_api_client/version.rb +++ b/lib/my_api_client/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module MyApiClient - VERSION = '1.3.0' + VERSION = '1.3.1' end From 15591ed11c99942051781a47771ff29cb12377ef Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:51:20 +0900 Subject: [PATCH 5/6] :comet: $ bundle update --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2ba9bbc0..8caf5564 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - my_api_client (1.3.0) + my_api_client (1.3.1) activesupport (>= 6.1.0) faraday (>= 0.17.1) jsonpath From a0b138ca683fbe491e057ca6d878b325a002c0d5 Mon Sep 17 00:00:00 2001 From: Ryosuke Sato Date: Tue, 10 Jun 2025 22:52:07 +0900 Subject: [PATCH 6/6] Update the rubocop config --- CHANGELOG.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2e07b0b..d457625d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,9 @@ ## v1.3.1 (Jun 10, 2025) -### Feature -### Bugfix -### Security -### Breaking Change -### Rubocop Challenge -### Dependabot ### Misc -* [#1096](https://github.com/ryz310/my_api_client/pull/1096) Stubs `instance_reader` and `instance_writer` on the `class_attribute` ([@ryz310](https://github.com/ryz310)) +- [#1096](https://github.com/ryz310/my_api_client/pull/1096) Stubs `instance_reader` and `instance_writer` on the `class_attribute` ([@ryz310](https://github.com/ryz310)) ## v1.3.0 (Jun 10, 2025)