Sha256: cf3da162e746ac530a0a3cf4f8957a8b29633bb86e0a937482662901f3bb78ad

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Lemondrop::Plugin::Service do
  subject { Lemondrop::Plugin::Service }

  describe '#start' do
    it 'should allow specifying a URI for the connection information' do
      config = {uri: 'redis://redisuser:redispass@foo.bar.com:9530/'}
      expected_params = {
        username: 'redisuser',
        password: 'redispass',
        hostname: 'foo.bar.com',
        port: 9530
      }
      subject.should_receive(:establish_connection).once.with(expected_params)
      subject.start config
    end

    it 'should default to the correct port if the URI does not specify one' do
      config = {uri: 'redis://redisuser:redispass@foo.bar.com/', port: 6379}
      expected_params = {
        username: 'redisuser',
        password: 'redispass',
        hostname: 'foo.bar.com',
        port: 6379
      }
      subject.should_receive(:establish_connection).once.with(expected_params)
      subject.start config
    end
  end

  describe '#establish_connection' do
    let(:params) { {} }

    it "returns a Redis instance" do
      subject.establish_connection(params).should be_a Redis
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lemondrop-0.1.2 spec/lemondrop/plugin/service_spec.rb