-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/DEX-2306/fix--producer-mock' into 'master'
[DEX-2306] feat: remove mock and new fake class Closes DEX-2306 See merge request nstmrt/rubygems/sbmt-kafka_producer!34
- Loading branch information
Showing
4 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 19 additions & 9 deletions
28
lib/sbmt/kafka_producer/testing/configure_producer_client.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.configure do |config| | ||
config.before(:each) do | ||
allow(Sbmt::KafkaProducer::KafkaClientFactory) | ||
.to receive(:default_client) | ||
.and_return(instance_double(WaterDrop::Producer, {produce_sync: true, produce_async: true})) | ||
|
||
allow(Sbmt::KafkaProducer::KafkaClientFactory) | ||
.to receive(:build) | ||
.and_return(instance_double(WaterDrop::Producer, {produce_sync: true, produce_async: true})) | ||
class FakeWaterDropClient | ||
def produce_sync(*) | ||
# no op | ||
end | ||
|
||
def produce_async(*) | ||
# no op | ||
end | ||
end | ||
|
||
Sbmt::KafkaProducer::KafkaClientFactory.singleton_class.prepend( | ||
Module.new do | ||
def default_client | ||
@default_client ||= FakeWaterDropClient.new | ||
end | ||
|
||
def build(*) | ||
@default_client ||= FakeWaterDropClient.new | ||
end | ||
end | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Sbmt | ||
module KafkaProducer | ||
VERSION = "2.2.2" | ||
VERSION = "2.2.3" | ||
end | ||
end |