Skip to content

Commit

Permalink
Test ordered set attribute with ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
heka1024 committed Mar 4, 2024
1 parent b835839 commit 35e9276
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/attributes_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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?

Expand Down

0 comments on commit 35e9276

Please sign in to comment.