spec/lib/logstasher/device/redis_spec.rb in logstasher-0.5.3 vs spec/lib/logstasher/device/redis_spec.rb in logstasher-0.6.0
- old
+ new
@@ -11,68 +11,68 @@
data_type: 'list'
}}
it 'has default options' do
device = LogStasher::Device::Redis.new
- device.options.should eq(default_options)
+ expect(device.options).to eq(default_options)
end
it 'creates a redis instance' do
- ::Redis.should_receive(:new).with({})
+ expect(::Redis).to receive(:new).with({})
LogStasher::Device::Redis.new()
end
it 'assumes unknown options are for redis' do
- ::Redis.should_receive(:new).with(hash_including(db: '0'))
+ expect(::Redis).to receive(:new).with(hash_including(db: '0'))
device = LogStasher::Device::Redis.new(db: '0')
- device.redis_options.should eq(db: '0')
+ expect(device.redis_options).to eq(db: '0')
end
it 'has a key' do
device = LogStasher::Device::Redis.new(key: 'the_key')
- device.key.should eq 'the_key'
+ expect(device.key).to eq('the_key')
end
it 'has a data_type' do
device = LogStasher::Device::Redis.new(data_type: 'channel')
- device.data_type.should eq 'channel'
+ expect(device.data_type).to eq('channel')
end
it 'does not allow unsupported data types' do
expect {
device = LogStasher::Device::Redis.new(data_type: 'blargh')
}.to raise_error()
end
it 'quits the redis connection on #close' do
device = LogStasher::Device::Redis.new
- device.redis.should_receive(:quit)
+ expect(device.redis).to receive(:quit)
device.close
end
it 'works as a logger device' do
device = LogStasher::Device::Redis.new
- device.should_receive(:write).with('blargh')
+ expect(device).to receive(:write).with('blargh')
logger = Logger.new(device)
logger << 'blargh'
end
describe '#write' do
it "rpushes logs onto a list" do
device = LogStasher::Device::Redis.new(data_type: 'list')
- device.redis.should_receive(:rpush).with('logstash', 'the log')
+ expect(device.redis).to receive(:rpush).with('logstash', 'the log')
device.write('the log')
end
it "rpushes logs onto a custom key" do
device = LogStasher::Device::Redis.new(data_type: 'list', key: 'custom')
- device.redis.should_receive(:rpush).with('custom', 'the log')
+ expect(device.redis).to receive(:rpush).with('custom', 'the log')
device.write('the log')
end
it "publishes logs onto a channel" do
device = LogStasher::Device::Redis.new(data_type: 'channel', key: 'custom')
- device.redis.should_receive(:publish).with('custom', 'the log')
+ expect(device.redis).to receive(:publish).with('custom', 'the log')
device.write('the log')
end
end
end