Sha256: dd0dd39fc95b9ab1b4cef14f3d4d2817faef2401bd03f806344253f465572e72

Contents?: true

Size: 681 Bytes

Versions: 26

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 be_true
  end

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

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

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

  it_should_behave_like "a hash-only command"
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
mock_redis-0.13.2 spec/commands/hexists_spec.rb
mock_redis-0.13.1 spec/commands/hexists_spec.rb
mock_redis-0.13.0 spec/commands/hexists_spec.rb
mock_redis-0.12.1 spec/commands/hexists_spec.rb
mock_redis-0.12.0 spec/commands/hexists_spec.rb
mock_redis-0.11.0 spec/commands/hexists_spec.rb
mock_redis-0.10.0 spec/commands/hexists_spec.rb
mock_redis-0.9.0 spec/commands/hexists_spec.rb
mock_redis-0.8.2 spec/commands/hexists_spec.rb
mock_redis-0.8.1 spec/commands/hexists_spec.rb
mock_redis-0.8.0 spec/commands/hexists_spec.rb
mock_redis-0.7.0 spec/commands/hexists_spec.rb
mock_redis-0.6.6 spec/commands/hexists_spec.rb
mock_redis-0.6.5 spec/commands/hexists_spec.rb
mock_redis-0.6.4 spec/commands/hexists_spec.rb
mock_redis-0.6.3 spec/commands/hexists_spec.rb
mock_redis-0.6.2 spec/commands/hexists_spec.rb
mock_redis-0.6.1 spec/commands/hexists_spec.rb
mock_redis-0.6.0 spec/commands/hexists_spec.rb
mock_redis-0.5.5 spec/commands/hexists_spec.rb