ry / ebb fork watch download tarball
public
Description: web server
Homepage: http://ebb.rubyforge.org
Clone URL: git://github.com/ry/ebb.git
Search Repo:
ryah (author)
Tue Apr 08 07:50:50 -0700 2008
commit  8f16a4f26257e8063b8aa82e6e2c0a11b7eb3f8a
tree    4c60de9a19fdfb349ef60bef7364ae1a483b55b0
parent  330364ac2933ad98948bd1a9089fa06174a13033
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