Sha256: bbff7285c8e5ca5108dc70ef6b1a04bae32d9a91d3c0cdff28dd4093dd0de28e

Contents?: true

Size: 630 Bytes

Versions: 9

Compression:

Stored size: 630 Bytes

Contents

require 'spec_helper'

describe '#xlen(key)' do
  before :all do
    sleep 1 - (Time.now.to_f % 1)
    @key = 'mock-redis-test:xlen'
  end

  before :each do
    # TODO: Redis appears to be returning a timestamp a few seconds in the future
    # so we're ignoring the last 5 digits (time in milliseconds)
    @redises._gsub(/\d{5}-\d/, '...-.')
  end

  it 'returns the number of items in the stream' do
    expect(@redises.xlen(@key)).to eq 0
    @redises.xadd(@key, { key: 'value' })
    expect(@redises.xlen(@key)).to eq 1
    3.times { @redises.xadd(@key, { key: 'value' }) }
    expect(@redises.xlen(@key)).to eq 4
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mock_redis-0.36.0 spec/commands/xlen_spec.rb
mock_redis-0.35.0 spec/commands/xlen_spec.rb
mock_redis-0.34.0 spec/commands/xlen_spec.rb
mock_redis-0.33.0 spec/commands/xlen_spec.rb
mock_redis-0.32.0 spec/commands/xlen_spec.rb
mock_redis-0.31.0 spec/commands/xlen_spec.rb
mock_redis-0.30.0 spec/commands/xlen_spec.rb
mock_redis-0.29.0 spec/commands/xlen_spec.rb
mock_redis-0.28.0 spec/commands/xlen_spec.rb