spec/unit/connection_adapters_spec.rb in websocket-rails-0.1.5 vs spec/unit/connection_adapters_spec.rb in websocket-rails-0.1.6
- old
+ new
@@ -95,18 +95,35 @@
subject.queue.queue.should == ['event']
end
end
describe "#trigger" do
+=begin
it "should add the event to the queue" do
+ pending
subject.stub(:flush)
subject.should_receive(:enqueue).with('event')
subject.trigger 'event'
end
it "should flush the queue" do
subject.should_receive(:flush)
subject.trigger 'event'
+ end
+=end
+ end
+
+ describe "#flush" do
+ before do
+ event = double('event')
+ event.stub!(:serialize).and_return("['event']")
+ 3.times { subject.enqueue event }
+ end
+
+ it "should serialize all events into one array" do
+ serialized_array = "[['event'],['event'],['event']]"
+ subject.should_receive(:send).with(serialized_array)
+ subject.flush
end
end
end
end
end