Skip to content

Commit

Permalink
Fix incorrect variable name (#247)
Browse files Browse the repository at this point in the history
* Fix incorrect variable name

Signed-off-by: Matt Larraz <[email protected]>

* # Added tests

Signed-off-by: Theo Truong <[email protected]>

* # Updated CHANGELOG.md

Signed-off-by: Theo Truong <[email protected]>

* # Added License header

Signed-off-by: Theo Truong <[email protected]>

---------

Signed-off-by: Matt Larraz <[email protected]>
Signed-off-by: Theo Truong <[email protected]>
Co-authored-by: Theo Truong <[email protected]>
  • Loading branch information
mlarraz and nhtruong authored Apr 25, 2024
1 parent 6bafe83 commit 096fbde
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,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]
Expand Down
2 changes: 1 addition & 1 deletion lib/opensearch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/opensearch/dsl/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions spec/opensearch/client/unit/opensearch_client_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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
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

0 comments on commit 096fbde

Please sign in to comment.