Skip to content

Instantly share code, notes, and snippets.

@dbrady
Created January 18, 2011 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrady/783742 to your computer and use it in GitHub Desktop.
Save dbrady/783742 to your computer and use it in GitHub Desktop.
describe "Server" do
describe "methods" do
let(:put) { "put foobar beans 5\nhowdy" }
it "should be valid for a valid put method" do
# before all
@pid = spawn("bin/server")
# before each
@sock = TCPSocket.new "127.0.0.1", 3000
# spec guts
@sock.send(put, 0).should == put.length
response = @sock.recv(1000)
response.should == "OK\n"
# after each
@sock.close
# after all
Process.kill("HUP", @pid)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment