Skip to content

Commit cd0a5a9

Browse files
author
Tobias Schoknecht
committed
Add test cases for script eval
1 parent 83f79a3 commit cd0a5a9

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

spec/lib/gcra/redis_store_spec.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,4 +330,21 @@ def cleanup_redis
330330
end
331331
end
332332
end
333+
334+
describe 'SCRIPT_NOT_IN_CACHE_RESPONSE_PATTERN' do
335+
it 'matches Redis NOSCRIPT error' do
336+
msg = 'NOSCRIPT No matching script. Please use EVAL.'
337+
expect(GCRA::RedisStore::SCRIPT_NOT_IN_CACHE_RESPONSE_PATTERN).to match(msg)
338+
end
339+
340+
it 'matches Valkey 8.0 NOSCRIPT error' do
341+
msg = 'NOSCRIPT No matching script'
342+
expect(GCRA::RedisStore::SCRIPT_NOT_IN_CACHE_RESPONSE_PATTERN).to match(msg)
343+
end
344+
345+
it 'does not match unrelated error' do
346+
msg = 'SOME OTHER ERROR'
347+
expect(GCRA::RedisStore::SCRIPT_NOT_IN_CACHE_RESPONSE_PATTERN).not_to match(msg)
348+
end
349+
end
333350
end

0 commit comments

Comments
 (0)