Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

even more robustter tests

  • Loading branch information...
commit 5e8a3a17d7102a8e8c667c0544351e9b4df1a315 1 parent ffa77ac
@josh authored
Showing with 27 additions and 9 deletions.
  1. +27 −9 test/test_openid.rb
View
36 test/test_openid.rb
@@ -6,6 +6,10 @@
require 'rack/session/pool'
require 'rack/openid'
+log = Logger.new(STDOUT)
+log.level = Logger::WARN
+OpenID::Util.logger = log
+
class TestHeader < Test::Unit::TestCase
def test_build_header
assert_equal 'OpenID identity="http://example.com/"',
@@ -33,12 +37,31 @@ def test_parse_header
class TestOpenID < Test::Unit::TestCase
RotsServer = 'http://localhost:9292'
- def setup
- @pid = fork {
- exec "rackup -E none test/openid_server.ru"
+ @server_started = false
+
+ def self.start_server!
+ return if @server_started
+
+ pid = fork {
+ STDIN.reopen "/dev/null"
+ STDOUT.reopen "/dev/null", "a"
+ STDERR.reopen "/dev/null", "a"
+
+ exec "rackup test/openid_server.ru"
+ }
+
+ at_exit {
+ Process.kill 9, pid
+ Process.wait(pid)
}
- sleep 0.5
+ sleep 0.75
+
+ @server_started = true
+ end
+
+ def setup
+ self.class.start_server!
assert_nothing_raised(Errno::ECONNREFUSED) {
uri = URI.parse(RotsServer)
@@ -46,11 +69,6 @@ def setup
}
end
- def teardown
- Process.kill 9, @pid
- Process.wait(@pid)
- end
-
def test_with_get
@app = app
process('/', :method => 'GET')
Please sign in to comment.
Something went wrong with that request. Please try again.