Sha256: 9ff739a00b57f50bccb43bf1f0a31da9a806598fd796018b2997ab9ab7492db0

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

require 'spec_helper'

describe Hari::Keys::Key do

  let(:node) { Hari.node user: 10 }
  subject    { node.list :friends }

  specify { subject.instance_of? Hari::Keys::Key }

  before { subject.add 1 }

  specify '#exists? + #delete!' do
    subject.exists?.should be_true

    subject.delete!

    subject.exists?.should be_false
  end

  specify '#type' do
    subject.type.should eq('list')
  end

  specify '#expire + #persist + #ttl' do
    subject.expire 80 # ms
    (subject.ttl.to_i < 80).should be_true

    sleep 0.1

    subject.exists?.should be_false

    subject.add 12
    subject.expire 100
    subject.persist

    sleep 0.2

    subject.exists?.should be_true
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hari-0.0.5 spec/hari/keys/key_spec.rb
hari-0.0.4 spec/hari/keys/key_spec.rb