Sha256: 99400992ab5ff0611dfbef8182214f6be365bf3d4c4b7d7a40e145c91be0c5f9

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require 'spec_helper'

describe FakeRedis do
  after { described_class.disable }

  describe '.enable' do
    it 'in memory connection' do
      described_class.enable
      expect(described_class.enabled?).to be_truthy
    end
  end

  describe '.disable' do
    before { described_class.enable }

    it 'in memory connection' do
      described_class.disable
      expect(described_class.enabled?).to be_falsy
    end
  end

  describe '.disabling' do
    context 'FakeRedis is enabled' do
      before { described_class.enable }

      it 'in memory connection' do
        described_class.disabling do
          expect(described_class.enabled?).to be_falsy
        end

        expect(described_class.enabled?).to be_truthy
      end
    end

    context 'FakeRedis is disabled' do
      before { described_class.disable }

      it 'in memory connection' do
        described_class.disabling do
          expect(described_class.enabled?).to be_falsy
        end

        expect(described_class.enabled?).to be_falsy
      end
    end
  end

  describe '.enabling' do
    context 'FakeRedis is enabled' do
      before { described_class.enable }

      it 'in memory connection' do
        described_class.enabling do
          expect(described_class.enabled?).to be_truthy
        end

        expect(described_class.enabled?).to be_truthy
      end
    end

    context 'FakeRedis is disabled' do
      before { described_class.disable }

      it 'in memory connection' do
        described_class.enabling do
          expect(described_class.enabled?).to be_truthy
        end

        expect(described_class.enabled?).to be_falsy
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fakeredis-0.9.2 spec/fakeredis_spec.rb
fakeredis-0.9.1 spec/fakeredis_spec.rb
fakeredis-0.9.0 spec/fakeredis_spec.rb
fakeredis-0.8.0 spec/fakeredis_spec.rb