File: test_basic.rb

package info (click to toggle)
ruby-curb 1.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 860 kB
  • sloc: ansic: 5,798; ruby: 4,466; makefile: 4
file content (29 lines) | stat: -rw-r--r-- 784 bytes parent folder | download
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
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))

class TestBasic < Test::Unit::TestCase
  include TestServerMethods
  
  def setup
    server_setup
  end
  
  def test_basic_request
    puts "\n=== Testing basic request ==="
    easy = Curl::Easy.new(TestServlet.url)
    easy.perform
    puts "Response code: #{easy.response_code}"
    puts "Body (first 100 chars): #{easy.body_str[0..100]}"
    assert_equal 200, easy.response_code
  end
  
  def test_slow_request
    puts "\n=== Testing slow request ==="
    url = TestServlet.url_to("/slow?seconds=0.1")
    puts "URL: #{url}"
    easy = Curl::Easy.new(url)
    easy.perform
    puts "Response code: #{easy.response_code}"
    puts "Body: #{easy.body_str}"
    assert_equal 200, easy.response_code
  end
end