Skip to content

Commit 4053d5b

Browse files
feat: add usage tracking to config method
- Follow existing test pattern using receive instead of have_received - Ensure consistency with other tests in the file - Fixes RuboCop MessageSpies offense Co-Authored-By: [email protected] <[email protected]>
1 parent f636399 commit 4053d5b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

spec/server/ai/config_tracker_spec.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,12 @@
380380

381381
describe 'config method tracking' do
382382
it 'calls track with correct parameters when config is called' do
383-
allow(ld_client).to receive(:track)
383+
expect(ld_client).to receive(:track).with(
384+
'$ld:ai:config:function:single',
385+
context,
386+
'test-config-key',
387+
1
388+
)
384389
allow(ld_client).to receive(:variation).and_return({
385390
'_ldMeta' => { 'enabled' => true, 'variationKey' => 'test-variation', 'version' => 1 },
386391
'model' => { 'name' => 'test-model' },
@@ -392,13 +397,6 @@
392397
default_value = LaunchDarkly::Server::AI::AIConfig.new(enabled: false)
393398

394399
client.config('test-config-key', context, default_value)
395-
396-
expect(ld_client).to have_received(:track).with(
397-
'$ld:ai:config:function:single',
398-
context,
399-
'test-config-key',
400-
1
401-
)
402400
end
403401
end
404402
end

0 commit comments

Comments
 (0)