test/storage/redis_storage_test.rb in verdict-0.9.0 vs test/storage/redis_storage_test.rb in verdict-0.10.0
- old
+ new
@@ -14,14 +14,10 @@
def teardown
@redis.del('experiments/redis_storage')
end
- def experiment_key
- 'experiments/redis_storage'
- end
-
def test_store_and_retrieve_qualified_assignment
refute @redis.hexists(experiment_key, 'assignment_subject_1')
new_assignment = @experiment.assign('subject_1')
assert new_assignment.qualified?
@@ -71,7 +67,24 @@
def test_started_at
refute @redis.hexists(experiment_key, "started_at")
a = @experiment.send(:ensure_experiment_has_started)
assert @redis.hexists(experiment_key, "started_at")
assert_equal a, @experiment.started_at
+ end
+
+ def test_cleanup
+ 1000.times do |n|
+ @experiment.assign("something_#{n}")
+ end
+
+ assert_operator @redis, :exists, experiment_key
+
+ @storage.cleanup(:redis_storage)
+ refute_operator @redis, :exists, experiment_key
+ end
+
+ private
+
+ def experiment_key
+ "experiments/redis_storage"
end
end