Sha256: 7eae9fa0c1a5ff32ddf3cedee3b781aa89b9945823965f2e0946f3ee998c43a3
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require 'spec_helper' RSpec.describe Split do around(:each) do |ex| old_env, old_redis = [ENV.delete('REDIS_URL'), Split.redis] ex.run ENV['REDIS_URL'] = old_env Split.redis = old_redis end describe '#redis=' do it 'accepts a url string' do Split.redis = 'redis://localhost:6379' expect(Split.redis).to be_a(Redis) client = Split.redis.client expect(client.host).to eq("localhost") expect(client.port).to eq(6379) end it 'accepts an options hash' do Split.redis = {host: 'localhost', port: 6379, db: 12} expect(Split.redis).to be_a(Redis) client = Split.redis.client expect(client.host).to eq("localhost") expect(client.port).to eq(6379) expect(client.db).to eq(12) end it 'accepts a valid Redis instance' do other_redis = Redis.new(url: "redis://localhost:6379") Split.redis = other_redis expect(Split.redis).to eq(other_redis) end it 'raises an ArgumentError when server cannot be determined' do expect { Split.redis = Object.new }.to raise_error(ArgumentError) end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
split-3.2.0 | spec/split_spec.rb |
split-3.1.1 | spec/split_spec.rb |
split-3.1.0 | spec/split_spec.rb |
split-3.0.0 | spec/split_spec.rb |
split-2.2.0 | spec/split_spec.rb |