/
memcachequeue_client_test.rb
33 lines (26 loc) · 1.6 KB
/
memcachequeue_client_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require File.dirname(__FILE__) + '/test_helper'
context "The memcachequeue client" do
specify "should be able to connect to multiple queue instances" do
Workling.send :class_variable_set, "@@config", { :listens_on => "localhost:12345, 127.0.0.1:12346", :memcache_options => { :namespace => "myapp_development" } }
client = Workling::Clients::MemcacheQueue.new
client.queueserver_urls.should.equal ["localhost:12345", "127.0.0.1:12346"]
client.connection.servers.first.host.should == "localhost"
client.connection.servers.first.port.should == 12345
client.connection.servers[1].host.should == "127.0.0.1"
client.connection.servers[1].port.should == 12346
client.connection.namespace.should.equal "myapp_development"
end
specify "should load it's config as well as any given MemCache options from RAILS_ENV/config/workling.yml" do
Workling.send :class_variable_set, "@@config", { :listens_on => "localhost:12345", :memcache_options => { :namespace => "myapp_development" } }
client = Workling::Clients::MemcacheQueue.new
client.queueserver_urls.should.equal ["localhost:12345"]
client.connection.servers.first.host.should == "localhost"
client.connection.servers.first.port.should == 12345
client.connection.namespace.should.equal "myapp_development"
end
specify "should load it's config correctly if no memcache options are given" do
Workling.send :class_variable_set, "@@config", { :listens_on => "localhost:12345" }
client = Workling::Clients::MemcacheQueue.new
client.queueserver_urls.should.equal ["localhost:12345"]
end
end