ry / ebb fork watch download tarball
public
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
ryah (author)
Mon Apr 07 16:28:09 -0700 2008
commit  dc4a7e28337306378a008aa9d7e205a306e79934
tree    dbdebfdd3e23c2b01b4ab4134ebb8e64c97f7d68
parent  38185f36847ca1315f9241302d6bab7f2f7b1495
ebb / test / basic_test.rb
100644 46 lines (38 sloc) 0.966 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require File.dirname(__FILE__) + '/helper'
 
module BasicTests
  def test_get_bytes
    [1,10,1000].each do |i|
      response = get("/bytes/#{i}")
      assert_equal "#{'C'*i.to_i}", response['output']
    end
  end
  
  def test_get_unknown
    response = get('/blah')
    assert_equal "Undefined url", response['output']
  end
  
  def test_small_posts
    [1,10,321,123,1000].each do |i|
      response = post("/test_post_length", 'C'*i)
      assert_equal 200, response['status']
    end
  end
  
  def test_large_post
    [50,60,100].each do |i|
      response = post("/test_post_length", 'C'*1024*i)
      assert_equal 200, response['status']
    end
  end
end
 
class BasicTest < ServerTest
  include BasicTests
end
 
class BasicTestFD < ServerTestFD
  include BasicTests
end
 
class BasicTestUnixSocket < ServerTestSocket
  include BasicTests
  
  def test_socket_file_exists
    assert File.exists?(@socketfile)
    assert File.readable?(@socketfile)
  end
end