Sha256: 130199945a22e237c6d3471d3920c1004a7673cd29b52ba81b287d0f2a5014ce

Contents?: true

Size: 622 Bytes

Versions: 4

Compression:

Stored size: 622 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

4 entries across 4 versions & 1 rubygems

Version Path
mock_redis-0.27.3 spec/commands/xlen_spec.rb
mock_redis-0.27.2 spec/commands/xlen_spec.rb
mock_redis-0.27.1 spec/commands/xlen_spec.rb
mock_redis-0.27.0 spec/commands/xlen_spec.rb