Sha256: d5641a7b73c4da7663207c2eb75e1062d9894d2101ad6ae4d0bb7785b8a766c3

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

require 'spec_helper'

describe Sinatra::MemcachedConnection do
  let(:klass) { Class.new.extend(Sinatra::MemcachedConnection) }

  context "#setup_memcached" do
    before { klass.setup_memcached 'localhost', '1337' }
    it { expect(klass).to have_instance_variable(:memcached) }
  end

  context "#close_memcached" do
    before(:each) { klass.setup_memcached 'localhost', '1337' }

    # There isn't an Dalli api that tells if the connection is closed
    it { klass.respond_to? :close_memcached }
  end

  context "#memcached_connection" do
    before { klass.setup_memcached 'localhost', '1337' }

    it "should be the instance variable of memcached" do
      expect(klass.instance_variable_get(:"@memcached")).to eq klass.memcached_connection
    end
  end

  context '#memcached_connected?', wip: true do
    it { expect(klass.memcached_connected?('localhost', '11211')).to be_truthy }
    it { expect(klass.memcached_connected?('localhost', '1121')).to be_falsy }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
memcached-manager-1.0.0 spec/lib/extensions/memcached_connection_spec.rb