Sha256: ff90abe9f995f549ce9f5bf40270b91d856597d8780d6d8ae34c4b0d81970145
Contents?: true
Size: 1.42 KB
Versions: 5
Compression:
Stored size: 1.42 KB
Contents
require "test_helper" describe Vanity::Connection do describe "#new" do it "establishes connection with default specification" do Vanity::Adapters.expects(:establish_connection).with(adapter: "redis") Vanity::Connection.new end it "establishes connection given a connection specification" do Vanity::Adapters.expects(:establish_connection).with(adapter: "mock") Vanity::Connection.new(adapter: "mock") end it "can skip connection" do Vanity::Autoconnect.stubs(:playground_should_autoconnect?).returns(false) connection = Vanity::Connection.new(adapter: "mock") assert !connection.connected? end it "parses from a string" do Vanity::Adapters.expects(:establish_connection).with( adapter: 'redis', username: 'user', password: 'secrets', host: 'redis.local', port: 6379, path: '/5', params: nil ) Vanity::Connection.new("redis://user:secrets@redis.local:6379/5") end it "raises an error for invalid specification hashes" do assert_raises(Vanity::Connection::InvalidSpecification) do Vanity::Connection.new("adapter" => "mock") end end it "allows a redis connection to be specified" do redis = stub("Redis") Vanity::Adapters.expects(:establish_connection).with(adapter: :redis, redis: redis) Vanity::Connection.new(redis: redis) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
vanity-4.0.4 | test/connection_test.rb |
vanity-4.0.3 | test/connection_test.rb |
vanity-4.0.2 | test/connection_test.rb |
vanity-4.0.1 | test/connection_test.rb |
vanity-4.0.0 | test/connection_test.rb |