test/system/queue_tests.rb in qs-0.8.0 vs test/system/queue_tests.rb in qs-0.8.1
- old
+ new
@@ -16,11 +16,11 @@
@event = Qs::Event.new('qs-app', 'basic')
@other_queue = Qs::Queue.new{ name(Factory.string) }
@other_queue.event(@event.channel, @event.name, Factory.string)
end
teardown do
- Qs.redis.with do |c|
+ Qs.redis.connection do |c|
keys = c.keys('*qs-app*')
c.pipelined{ keys.each{ |k| c.del(k) } }
end
Qs.reset!
ENV['QS_TEST_MODE'] = @qs_test_mode
@@ -35,19 +35,19 @@
end
should "store subscriptions for the queue in redis" do
AppQueue.event_route_names.each do |route_name|
redis_key = Qs::Event::SubscribersRedisKey.new(route_name)
- smembers = Qs.redis.with{ |c| c.smembers(redis_key) }
+ smembers = Qs.redis.connection{ |c| c.smembers(redis_key) }
assert_includes AppQueue.name, smembers
end
end
should "allow adding a new queues subscriptions but preserve the existing" do
@other_queue.sync_subscriptions
- smembers = Qs.redis.with{ |c| c.smembers(@event.subscribers_redis_key) }
+ smembers = Qs.redis.connection{ |c| c.smembers(@event.subscribers_redis_key) }
assert_equal 2, smembers.size
assert_includes AppQueue.name, smembers
assert_includes @other_queue.name, smembers
end
@@ -55,11 +55,11 @@
route_names = AppQueue.event_route_names.reject{ |n| n == @event.route_name }
Assert.stub(AppQueue, :event_route_names){ route_names }
AppQueue.sync_subscriptions
redis_key = Qs::Event.new('qs-app', 'basic').subscribers_redis_key
- smembers = Qs.redis.with{ |c| c.smembers(redis_key) }
+ smembers = Qs.redis.connection{ |c| c.smembers(redis_key) }
assert_not_includes AppQueue.name, smembers
end
end
@@ -72,14 +72,14 @@
end
should "remove the queue from all of its events subscribers" do
AppQueue.event_route_names.each do |route_name|
redis_key = Qs::Event::SubscribersRedisKey.new(route_name)
- smembers = Qs.redis.with{ |c| c.smembers(redis_key) }
+ smembers = Qs.redis.connection{ |c| c.smembers(redis_key) }
assert_not_includes AppQueue.name, smembers
end
- smembers = Qs.redis.with{ |c| c.smembers(@event.subscribers_redis_key) }
+ smembers = Qs.redis.connection{ |c| c.smembers(@event.subscribers_redis_key) }
assert_equal [@other_queue.name], smembers
end
end