Sha256: 1bd86b193dc75185b422bc9569e90041b55781d65ca953bddbb5e470326d5a70

Contents?: true

Size: 681 Bytes

Versions: 33

Compression:

Stored size: 681 Bytes

Contents

require 'spec_helper'

describe '#hexists(key, field)' do
  before do
    @key = 'mock-redis-test:hexists'
    @redises.hset(@key, 'field', 'value')
  end

  it 'returns true if the hash has that field' do
    @redises.hexists(@key, 'field').should == true
  end

  it 'returns false if the hash lacks that field' do
    @redises.hexists(@key, 'nonesuch').should == false
  end

  it 'treats the field as a string' do
    @redises.hset(@key, 1, 'one')
    @redises.hexists(@key, 1).should == true
  end

  it 'returns nil when there is no such key' do
    @redises.hexists('mock-redis-test:nonesuch', 'key').should == false
  end

  it_should_behave_like 'a hash-only command'
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
mock_redis-0.36.0 spec/commands/hexists_spec.rb
mock_redis-0.35.0 spec/commands/hexists_spec.rb
mock_redis-0.34.0 spec/commands/hexists_spec.rb
mock_redis-0.33.0 spec/commands/hexists_spec.rb
mock_redis-0.32.0 spec/commands/hexists_spec.rb
mock_redis-0.31.0 spec/commands/hexists_spec.rb
mock_redis-0.30.0 spec/commands/hexists_spec.rb
mock_redis-0.29.0 spec/commands/hexists_spec.rb
mock_redis-0.28.0 spec/commands/hexists_spec.rb
mock_redis-0.27.3 spec/commands/hexists_spec.rb
mock_redis-0.27.2 spec/commands/hexists_spec.rb
mock_redis-0.27.1 spec/commands/hexists_spec.rb
mock_redis-0.27.0 spec/commands/hexists_spec.rb
mock_redis-0.26.0 spec/commands/hexists_spec.rb
mock_redis-0.25.0 spec/commands/hexists_spec.rb
mock_redis-0.24.0 spec/commands/hexists_spec.rb
mock_redis-0.23.0 spec/commands/hexists_spec.rb
mock_redis-0.22.0 spec/commands/hexists_spec.rb
mock_redis-0.21.0 spec/commands/hexists_spec.rb
mock_redis-0.20.0 spec/commands/hexists_spec.rb