From 4bb36f4e6415b5b523df343afc26d4bd1e950e83 Mon Sep 17 00:00:00 2001 From: Pavel Kalashnikov Date: Wed, 18 Feb 2026 16:30:56 +0400 Subject: [PATCH] Add child client inheritance coverage --- spec/purple/client_inheritance_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/purple/client_inheritance_spec.rb b/spec/purple/client_inheritance_spec.rb index d692915..0164ed2 100644 --- a/spec/purple/client_inheritance_spec.rb +++ b/spec/purple/client_inheritance_spec.rb @@ -19,6 +19,9 @@ class BaseClient < Purple::Client class InheritedClient < BaseClient end + class ChildClient < InheritedClient + end + class OverriddenClient < BaseClient domain 'https://other.example.com' authorization :custom_headers, 'Authorization' => 'Bearer different-token' @@ -54,6 +57,17 @@ class OverriddenClient < BaseClient expect(InheritanceSpec::InheritedClient.authorization).to eq(InheritanceSpec::BaseClient.authorization) end + it 'inherits domain and authorization in child class' do + response = instance_double(Faraday::Response, status: 200, body: { ok: true }.to_json) + expect(connection).to receive(:get).with('https://example.com/status', {}).and_return(response) + + InheritanceSpec::ChildClient.status + + expect(headers).to include('Authorization' => 'Bearer token') + expect(InheritanceSpec::ChildClient.domain).to eq('https://example.com') + expect(InheritanceSpec::ChildClient.authorization).to eq(InheritanceSpec::BaseClient.authorization) + end + it 'allows overriding inherited domain and authorization' do response = instance_double(Faraday::Response, status: 200, body: { ok: true }.to_json) expect(connection).to receive(:get).with('https://other.example.com/status', {}).and_return(response)