Sha256: 0e97ffefa713cd9dea551cf5be9bcc20a6d6f54d36f82ba4e94f9c651048409f
Contents?: true
Size: 708 Bytes
Versions: 20
Compression:
Stored size: 708 Bytes
Contents
require File.join(File.dirname(__FILE__), "test_helper") class ConnectionTest < Test::Unit::TestCase setup do @options = Ohm.options end test "connects lazily" do assert_nothing_raised do Ohm.connect(:port => 9876) end assert_raises(Errno::ECONNREFUSED) do Ohm.redis.get "foo" end end test "provides a separate connection for each thread" do assert Ohm.redis == Ohm.redis conn1, conn2 = nil threads = [] threads << Thread.new do conn1 = Ohm.redis end threads << Thread.new do conn2 = Ohm.redis end threads.each { |t| t.join } assert (conn1 != conn2) end teardown do Ohm.connect(*@options) end end
Version data entries
20 entries across 20 versions & 1 rubygems