|
25 | 25 | new_redis = Redis.new(:host => "localhost", :port => 9736) |
26 | 26 | new_namespace = Redis::Namespace.new("namespace", :redis => new_redis) |
27 | 27 | Resque.redis = new_namespace |
28 | | - assert_equal new_namespace, Resque.redis |
| 28 | + |
| 29 | + assert_equal new_namespace.namespace, Resque.redis.namespace |
| 30 | + [:db, :host, :port].each do |part| |
| 31 | + assert_equal new_namespace.redis.client.send(part), Resque.redis.client.send(part) |
| 32 | + end |
| 33 | + end |
| 34 | + |
| 35 | + describe "#create_connection" do |
| 36 | + it "always creates a new connection with a Redis::Namespace" do |
| 37 | + new_redis = Redis.new(:host => "localhost", :port => 9736) |
| 38 | + namespace = Redis::Namespace.new("namespace", :redis => new_redis) |
| 39 | + new_connection = Resque.create_connection(namespace) |
| 40 | + |
| 41 | + refute_equal namespace, new_connection |
| 42 | + assert_equal "namespace", new_connection.namespace |
| 43 | + [:db, :host, :port].each do |part| |
| 44 | + assert_equal namespace.redis.client.send(part), new_connection.redis.client.send(part) |
| 45 | + end |
| 46 | + end |
| 47 | + |
| 48 | + it "always creates a new connection with a Redis object" do |
| 49 | + new_redis = Redis.new(:host => "localhost", :port => 9736) |
| 50 | + new_connection = Resque.create_connection(new_redis) |
| 51 | + refute_equal new_connection.redis, new_redis |
| 52 | + [:db, :host, :port].each do |part| |
| 53 | + assert_equal new_redis.client.send(part), new_connection.redis.client.send(part) |
| 54 | + end |
| 55 | + end |
29 | 56 | end |
30 | 57 |
|
31 | 58 | it "can put jobs on a queue" do |
|
0 commit comments