Sha256: 17ea9af3459e9e25e78cd82aaea7ff4816c7f64dcadeccbee9fdc22982b8b600
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# -*- coding: utf-8 -*- require 'spec_helper' describe Redisable::Connection do let(:server) {:application} let(:conf) { { host: "localhost", port: "6379", db: "1", } } describe ".conn" do before do Redisable::Config.stub(:conf) { conf } Redis.any_instance.stub(:ping) { "PONG" } end after do Redisable::Connection.instance_variable_set("@pool", {}) end subject { Redisable::Connection.conn(server) } context "in access ':application' first time" do it "create connection" do subject Redisable::Connection.instance_variable_get("@pool").size.should == 1 end end context "sharding conf" do let(:conf) { [ { host: "localhost", port: "6379", db: "1", }, { host: "localhost", port: "6379", db: "2", }, ] } it "create sharding connection" do expect(subject).to be_a(Redis::Distributed) end end context "in request timeout" do before do Redisable::Config.stub(:conf) { conf } Redis.any_instance.stub(:ping) { "" } end it "raise RuntimeError" do expect {subject}.to raise_error(RuntimeError) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redisable-0.2.0 | spec/connection_spec.rb |