Skip to content

Commit

Permalink
#
Browse files Browse the repository at this point in the history
Signed-off-by: Theo Truong <[email protected]>
  • Loading branch information
nhtruong committed Dec 12, 2024
1 parent ef4afa5 commit 0d15851
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,27 +99,28 @@ class NotFound < StandardError; end

module HelperModule
def self.included(context)
context.let(:client_double) do
Class.new { include OpenSearch::API }.new.tap do |client|
expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
end
end

context.let(:client) do
Class.new { include OpenSearch::API }.new.tap do |client|
expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
end
end

context.let(:response_double) do
double('response', status: 200, body: {}, headers: {})
end
# context.let(:client_double) do
# Class.new { include OpenSearch::API }.new.tap do |client|
# expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
# end
# end
#
# context.let(:client) do
# Class.new { include OpenSearch::API }.new.tap do |client|
# expect(client).to receive(:perform_request).with(*expected_args).and_return(response_double)
# end
# end
#
# context.let(:response_double) do
# double('response', status: 200, body: {}, headers: {})
# end

context.let(:hosts) { OPENSEARCH_HOSTS }
end
end

RSpec.configure do |config|
config.include(HelperModule)
config.formatter = 'documentation'
config.color = true
end

0 comments on commit 0d15851

Please sign in to comment.