Skip to content
This repository was archived by the owner on Dec 2, 2018. It is now read-only.

Commit 2a60afb

Browse files
committed
Switch to minitest, plus other test cleanup.
1 parent 9f76d66 commit 2a60afb

File tree

5 files changed

+22
-34
lines changed

5 files changed

+22
-34
lines changed

test/functional/cgi_test.rb

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
require 'test/unit'
1+
require 'minitest/autorun'
22
require 'mechanize'
3-
require 'rack/legacy'
4-
require 'rack/legacy/cgi'
53

6-
class CgiTest < Test::Unit::TestCase
4+
class CgiTest < MiniTest::Unit::TestCase
75

86
def test_success
97
response = Mechanize.new.get 'http://localhost:4000/success.cgi'
@@ -67,13 +65,11 @@ def test_post
6765
end
6866

6967
def test_flushing
70-
assert_nothing_raised do
71-
# 5 seconds should be enough to know it didn't lock up
72-
timeout 5 do
73-
response = Mechanize.new.get 'http://localhost:4000/flush.cgi'
74-
assert_equal '200', response.code
75-
assert_equal 'text/html', response.header['content-type']
76-
end
68+
# 5 seconds should be enough to know it didn't lock up
69+
timeout 5 do
70+
response = Mechanize.new.get 'http://localhost:4000/flush.cgi'
71+
assert_equal '200', response.code
72+
assert_equal 'text/html', response.header['content-type']
7773
end
7874
end
7975

test/functional/php_test.rb

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
require 'test/unit'
2-
3-
require 'rubygems'
1+
require 'minitest/autorun'
42
require 'mechanize'
53

6-
require 'rack/legacy/php'
7-
8-
class PhpTest < Test::Unit::TestCase
4+
class PhpTest < MiniTest::Unit::TestCase
95

106
def test_success
117
response = Mechanize.new.get 'http://localhost:4000/success.php'
@@ -59,13 +55,11 @@ def test_post
5955
end
6056

6157
def test_flushing
62-
assert_nothing_raised do
63-
# 5 seconds should be enough to know it didn't lock up
64-
timeout 5 do
65-
response = Mechanize.new.get 'http://localhost:4000/flush.php'
66-
assert_equal '200', response.code
67-
assert_equal 'text/html', response.header['content-type']
68-
end
58+
# 5 seconds should be enough to know it didn't lock up
59+
timeout 5 do
60+
response = Mechanize.new.get 'http://localhost:4000/flush.php'
61+
assert_equal '200', response.code
62+
assert_equal 'text/html', response.header['content-type']
6963
end
7064
end
7165

test/test_server.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
# The unit tests do full end-to-end testing therefore a real server
2-
# needs to be run. Start this script before running the unit tests.
1+
# The functional tests do full end-to-end testing therefore a real
2+
# server needs to be run. Start this script before running the
3+
# functional tests. The Rakefile does this automatically.
34

4-
require 'rubygems'
55
require 'webrick'
66
require 'rack'
77
require 'rack/showexceptions'
88
require 'rack/legacy'
9-
require 'rack/legacy/cgi'
10-
require 'rack/legacy/php'
119

1210
# Keep WEBrick quiet for functional tests
1311
class ::WEBrick::HTTPServer; def access_log(config, req, res); end end

test/unit/cgi_test.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
require 'test/unit'
2-
require 'flexmock/test_unit'
1+
require 'minitest/autorun'
32
require 'rack/legacy'
43
require 'rack/legacy/cgi'
54

6-
class CgiTest < Test::Unit::TestCase
5+
class CgiTest < MiniTest::Unit::TestCase
76

87
def test_valid?
98
assert app.valid?(fixture_file('success.cgi')) # Valid file

test/unit/php_test.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
require 'test/unit'
1+
require 'minitest/autorun'
2+
require 'rack/legacy'
23
require 'rack/legacy/php'
34

4-
class PhpTest < Test::Unit::TestCase
5+
class PhpTest < MiniTest::Unit::TestCase
56

67
def test_valid?
78
assert app.valid?('success.php') # Valid file

0 commit comments

Comments
 (0)