Sha256: 077557762e3c214f6fa30e91e0d8a2672e002de242c3c8308d8f449c6b588139
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe PulseMeter::CommandAggregator::UDP do let(:host){'127.0.0.1'} let(:port){33333} let(:udp_sock){double(:socket)} before do UDPSocket.stub(:new).and_return(udp_sock) udp_sock.stub(:fcntl).and_return(nil) @ca = described_class.new([[host, port]]) end describe "#multi" do it "should accumulate redis commands and send them in a bulk" do data = [ ["set", "xxxx", "zzzz"], ["set", "yyyy", "zzzz"] ].to_json udp_sock.should_receive(:send).with(data, 0, host, port).and_return(0) @ca.multi do @ca.set("xxxx", "zzzz") @ca.set("yyyy", "zzzz") end end it "should ignore standard exceptions" do udp_sock.should_receive(:send).and_raise(StandardError) @ca.multi do @ca.set("xxxx", "zzzz") end end end describe "any other redis instance method" do it "should send data imediately" do data = [ ["set", "xxxx", "zzzz"] ].to_json udp_sock.should_receive(:send).with(data, 0, host, port).and_return(0) @ca.set("xxxx", "zzzz") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pulse_meter_core-0.5.3 | spec/pulse_meter/command_aggregator/udp_spec.rb |