From 033b46b61d8e74836ce325e717aa4f7a00fe7249 Mon Sep 17 00:00:00 2001 From: Matt Larraz Date: Tue, 16 Apr 2024 19:06:09 -0400 Subject: [PATCH 1/4] Fix incorrect variable name Signed-off-by: Matt Larraz --- lib/opensearch.rb | 2 +- lib/opensearch/dsl/search.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/opensearch.rb b/lib/opensearch.rb index 7f97f2daa..3ea553b16 100644 --- a/lib/opensearch.rb +++ b/lib/opensearch.rb @@ -49,7 +49,7 @@ def method_missing(name, *args, &block) end def respond_to_missing?(method_name, include_private = false) - name == :perform_request || super + method_name == :perform_request || super end private diff --git a/lib/opensearch/dsl/search.rb b/lib/opensearch/dsl/search.rb index 19c05e7ce..987820582 100644 --- a/lib/opensearch/dsl/search.rb +++ b/lib/opensearch/dsl/search.rb @@ -250,7 +250,7 @@ def method_missing(name, *args, &block) end def respond_to_missing?(method_name, include_private = false) - @options.respond_to?(name) || super + @options.respond_to?(method_name) || super end # Converts the search definition to a Hash From 44e4de72deedd8b7c8998b5b4be8641ac702fcda Mon Sep 17 00:00:00 2001 From: Theo Truong Date: Tue, 23 Apr 2024 16:51:16 -0700 Subject: [PATCH 2/4] # Added tests Signed-off-by: Theo Truong --- spec/opensearch/client/unit/opensearch_client_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 spec/opensearch/client/unit/opensearch_client_spec.rb diff --git a/spec/opensearch/client/unit/opensearch_client_spec.rb b/spec/opensearch/client/unit/opensearch_client_spec.rb new file mode 100644 index 000000000..635185e51 --- /dev/null +++ b/spec/opensearch/client/unit/opensearch_client_spec.rb @@ -0,0 +1,9 @@ +require_relative '../../../spec_helper' + +describe 'OpenSearch::Client#respond_to_missing?' do + it 'returns to correct results' do + client = OpenSearch::Client.new + expect(client.send(:respond_to_missing?, :perform_request)).to be true + expect(client.send(:respond_to_missing?, :something_else)).to be false + end +end From d621601aeb787c52c534e15186090a373157b375 Mon Sep 17 00:00:00 2001 From: Theo Truong Date: Tue, 23 Apr 2024 16:52:49 -0700 Subject: [PATCH 3/4] # Updated CHANGELOG.md Signed-off-by: Theo Truong --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b38bc6d2..c0bf4b0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Deprecated ### Removed ### Fixed +- Fixed variable name in `OpenSearch::Client#respond_to_missing?` ([#247](https://github.com/opensearch-project/opensearch-ruby/pull/247)) ### Security ## [3.2.0] From 9071c998817f43c9170da14160cf369fd17086b1 Mon Sep 17 00:00:00 2001 From: Theo Truong Date: Wed, 24 Apr 2024 11:23:41 -0600 Subject: [PATCH 4/4] # Added License header Signed-off-by: Theo Truong --- spec/opensearch/client/unit/opensearch_client_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/opensearch/client/unit/opensearch_client_spec.rb b/spec/opensearch/client/unit/opensearch_client_spec.rb index 635185e51..c43290714 100644 --- a/spec/opensearch/client/unit/opensearch_client_spec.rb +++ b/spec/opensearch/client/unit/opensearch_client_spec.rb @@ -1,3 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# The OpenSearch Contributors require contributions made to +# this file be licensed under the Apache-2.0 license or a +# compatible open source license. +# +# Modifications Copyright OpenSearch Contributors. See +# GitHub history for details. + require_relative '../../../spec_helper' describe 'OpenSearch::Client#respond_to_missing?' do