test/experiment_test.rb in verdict-0.11.0 vs test/experiment_test.rb in verdict-0.12.0

- old
+ new

@@ -422,11 +422,10 @@ assert_kind_of Verdict::Storage::MockStorage, e.storage end def test_cleanup - redis = ::Redis.new(host: REDIS_HOST, port: REDIS_PORT) storage = Verdict::Storage::RedisStorage.new(redis) experiment = Verdict::Experiment.new(:cleanup_test) do groups { group :all, 100 } storage storage, store_unqualified: true end @@ -438,16 +437,32 @@ refute_operator redis, :exists, "experiments/cleanup_test" ensure redis.del("experiments/cleanup_test") end + def test_cleanup_options + experiment = Verdict::Experiment.new(:cleanup_test) do + groups { group :all, 100 } + end + + experiment.storage.expects(:clear).with(experiment.handle, some: :thing) + experiment.assign("something") + experiment.cleanup(some: :thing) + end + def test_cleanup_without_redis experiment = Verdict::Experiment.new(:cleanup_test) do groups { group :all, 100 } end assert_raises(NotImplementedError) do experiment.assign("something") experiment.cleanup end + end + + private + + def redis + @redis ||= ::Redis.new(host: REDIS_HOST, port: REDIS_PORT) end end