Sha256: cedb70a944a218e6c77c3de1fcf3fcccd3d2002bf5ca49cb3d7da204e4046e52
Contents?: true
Size: 813 Bytes
Versions: 10
Compression:
Stored size: 813 Bytes
Contents
require 'spec_helper' require 'timeout' require 'stringio' require 'grocer/server' require 'grocer/notification' describe Grocer::Server do let(:ssl_server) { stub_everything } let(:mock_client) { StringIO.new } subject { described_class.new(ssl_server) } before do ssl_server.stubs(:accept).yields(mock_client) mock_client.stubs(:close) end after do subject.close end it "accepts client connections and reads notifications into a queue" do mock_client.write(Grocer::Notification.new(alert: "Hi!").to_bytes) mock_client.rewind subject.accept Timeout.timeout(5) { notification = subject.notifications.pop notification.alert.should == "Hi!" } end it "closes the socket" do ssl_server.expects(:close).at_least(1) subject.close end end
Version data entries
10 entries across 10 versions & 1 rubygems