Skip to content

Instantly share code, notes, and snippets.

@roman
Created March 20, 2009 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roman/82256 to your computer and use it in GitHub Desktop.
Save roman/82256 to your computer and use it in GitHub Desktop.
require "ruby_openid_test_server"
class TestHelper < Test::Unit
include RubyOpenIdTestServer::ServerSpecHelper
# The identity on the rots server (must be the same as the one executing)
self.rots_config = YAML.load(<<-CONFIG
identity: john.doe
sreg:
nickname: jdoe
fullname: John Doe
email: jhon@doe.com
dob: 1985-09-21
gender: M
CONFIG
)
# The storage of the OpenID Server (must be the same as the one executing)
self.rots_server_options = {
:storage => File.join('tmp', 'rots')
}
end
class OpenIDTest < TestHelper
def test_openid_success
# The rots server must be up in order to make this work
response = get('/', :openid_url => 'http://localhost:1123/john.doe?openid.success=true')
# this is the redirection to the OpenID server
check_id_qs = response.headers['Location']
# openid_request is declared on the file lib/ruby_openid_test_server/server_spec_helper.rb
app_response = openid_request(check_id_qs)
# We do the asserts on the app_response
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment