Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/configcat/configcatclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# Closes all ConfigCatClient instances.
def self.close_all
@@lock.synchronize do
@@instances.each do |key, value|

Check warning on line 48 in lib/configcat/configcatclient.rb

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefix unused parameter 'key' with an underscore (e.g., '_key'), or remove it if it is not needed.

See more on https://sonarcloud.io/project/issues?id=configcat_ruby-sdk&issues=AaCq-VmkF3hoNjfLlvY0&open=AaCq-VmkF3hoNjfLlvY0&pullRequest=43
value.send(:_close_resources)
end
@@instances.clear
Expand Down Expand Up @@ -98,7 +98,7 @@
read_timeout: options.read_timeout_seconds,
data_governance: options.data_governance)

@_config_service = ConfigService.new(@sdk_key,
@_config_service = ConfigService.new(@_sdk_key,
options.polling_mode,
@hooks,
@_config_fetcher,
Expand Down
2 changes: 1 addition & 1 deletion lib/configcat/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ConfigCat
VERSION = "9.0.0"
VERSION = "9.0.1"
end
23 changes: 23 additions & 0 deletions spec/configcat/configcatclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@
}.to raise_error(ConfigCatClientException)
end

it "test_config_service_reads_cache_with_expected_cache_key" do
mock_cache = instance_double(ConfigCache)
expected_cache_key = ConfigService.get_cache_key(TEST_SDK_KEY)

expect(mock_cache).to receive(:get).with(expected_cache_key).and_return(nil)
allow(mock_cache).to receive(:set)

WebMock.stub_request(:get, Regexp.new('https://.*')).to_return(
status: 200,
body: TEST_OBJECT_JSON,
headers: { 'ETag' => 'test-etag' }
)

ConfigCatClient.close_all
client = ConfigCatClient.get(
TEST_SDK_KEY,
ConfigCatOptions.new(polling_mode: PollingMode.manual_poll, config_cache: mock_cache)
)

client.force_refresh
client.close
end

[
["sdk-key-90123456789012", false, false],
["sdk-key-9012345678901/1234567890123456789012", false, false],
Expand Down
Loading