Sha256: 4728641e4ebe8f2eabc712d56b6814f2f0a4613f0ef122caedc8ade7382e3d7e
Contents?: true
Size: 1.43 KB
Versions: 5
Compression:
Stored size: 1.43 KB
Contents
describe('spec server', function() { describe('more tests', function() { it('should have a version', function() { expect(server.version).toMatch(/^\d+\.\d+\.\d+$/) }); it('should respond to gets on 8000', function() { server.server.listen(8000); setTimeout(function() { var connection = http.createClient(8000, "127.0.0.1"); var request = connection.request("GET","/", {"host" : "127.0.0.1"}); var response_body = ""; request.addListener("response", function (response) { expect(response.statusCode).toEqual(200); response.addListener("data", function(chunk) { response_body += chunk; }); response.addListener("end", function() { expect(response_body).toEqual("hi!"); response_body = ""; jasmine.async_spec_done(); }); }); request.close(); }, 1); jasmine.async_spec_wait(); }); it('should respond to puts on 8000', function() { runs(function() { var connection = http.createClient(8000, "127.0.0.1"); var request = connection.request("POST","/", {"host" : "127.0.0.1"}); request.write("howdy!", encoding="ascii"); request.close(); }, 20); waits(100); runs(function() { expect(server.results).toEqual("POST / /: howdy!") server.server.close(); }); }); }); });
Version data entries
5 entries across 5 versions & 1 rubygems