From 35e9276d46c13306b84a897c07354870dfd57354 Mon Sep 17 00:00:00 2001 From: Miller Date: Mon, 4 Mar 2024 17:47:11 +0900 Subject: [PATCH] Test ordered set attribute with ttl --- test/attributes_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/attributes_test.rb b/test/attributes_test.rb index 33a0e5d..2eed8b7 100644 --- a/test/attributes_test.rb +++ b/test/attributes_test.rb @@ -18,6 +18,7 @@ class Person kredis_unique_list :skills_with_default_via_lambda, default: ->(p) { [ "Random", "Random", p.name ] } kredis_unique_list :skills_with_ttl, expires_in: 1.second kredis_ordered_set :reading_list, limit: 2 + kredis_ordered_set :reading_list_with_ttl, expires_in: 1.second kredis_flag :special kredis_flag :temporary_special, expires_in: 1.second kredis_string :address @@ -184,6 +185,14 @@ class AttributesTest < ActiveSupport::TestCase assert_equal %w[ remote shapeup ], @person.reading_list.elements end + test "ordered set with ttl" do + @person.reading_list_with_ttl.prepend(%w[ rework ]) + assert_equal %w[ rework ], @person.reading_list_with_ttl.elements + + sleep 1.1 + assert_equal [], @person.reading_list_with_ttl.elements + end + test "flag" do assert_not @person.special?