spec/memory_spec.rb in fakeredis-0.6.0 vs spec/memory_spec.rb in fakeredis-0.7.0
- old
+ new
@@ -7,10 +7,16 @@
num.times do |count|
redis.set("key#{count}", count)
end
end
+ describe '#write' do
+ it 'should not send unexpected arguments' do
+ expect { redis.write(['info', 'server']) }.not_to raise_error
+ end
+ end
+
describe '#scan' do
def result
returned_keys = []
cursor = 0
@@ -74,8 +80,26 @@
end
it 'has the current leftover microseconds' do
expect(redis.time.last).to eql 513946
end
+ end
+ end
+
+ describe '#client' do
+ it 'returns 1 when command is :setname' do
+ expect(redis.write([:client, :setname])).to eq 1
+ end
+
+ it 'returns nil when command is :getname' do
+ expect(redis.write([:client, :getname])).to eq nil
+ end
+
+ it 'returns true when the comment is :client with an argument' do
+ expect(redis.write([:client, :client, :list])).to eq 1
+ end
+
+ it 'raises error for other commands' do
+ expect { redis.write([:client, :wrong]) }.to raise_error(Redis::CommandError, "ERR unknown command 'wrong'")
end
end
end