Sha256: b3a5be55e7a49ab3f76a0774fdebfdf21b755ec31a86e091856ea7b14f76428a

Contents?: true

Size: 798 Bytes

Versions: 11

Compression:

Stored size: 798 Bytes

Contents

require "spec_helper"

module Twitchus

  describe Storage do

    it "will add things to the given key" do
      client = mock(:redis)
      client.should_receive(:lpush).with(:key, :item)

      Redis.should_receive(:new) { client }

      storage = Storage.new(1, 1, :key)
      storage.push :item
    end

    it "won't add empty items to the list" do
      client = mock(:redis)
      client.should_not_receive(:lpush).with(:key, nil)

      Redis.should_receive(:new) { client }

      storage = Storage.new(1, 1, :key)
      storage.push nil
    end

    it "can empty the storage" do
      client = mock(:redis)
      client.should_receive(:expire).with(:key, -1)

      Redis.should_receive(:new) { client }

      storage = Storage.new(1, 1, :key)
      storage.clear
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
twitchus-0.1.6 spec/twitchus/storage_spec.rb
twitchus-0.1.5 spec/twitchus/storage_spec.rb
twitchus-0.1.4 spec/twitchus/storage_spec.rb
twitchus-0.1.3 spec/twitchus/storage_spec.rb
twitchus-0.1.2 spec/twitchus/storage_spec.rb
twitchus-0.1.1 spec/twitchus/storage_spec.rb
twitchus-0.1.0 spec/twitchus/storage_spec.rb
twitchus-0.0.4 spec/twitchus/storage_spec.rb
twitchus-0.0.3 spec/twitchus/storage_spec.rb
twitchus-0.0.2 spec/twitchus/storage_spec.rb
twitchus-0.0.1 spec/twitchus/storage_spec.rb