/ Published in: Ruby
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
require 'open-uri' require 'rubygems' require 'openid' # require 'openid/extensions/sreg' # require 'openid/extensions/pape' # require 'openid/store/filesystem' require 'spec' describe "OpenID Request" do before(:each) do @claimed_identifier = "http://sou.myopenid.com/" @op_endpoint = "http://www.myopenid.com/server" @local_id = "http://sou.myopenid.com/" end def do_request(uri) open(uri) do |response| yield response if block_given? end end it "should discover XRDS document" do do_request(@claimed_identifier) do |response| response.meta.should be_has_key('x-xrds-location') xrds_location = response.meta['x-xrds-location'] do_request(xrds_location) do |response| # xrds = OpenID::Yadis::parseXRDS(response.read) xrds = response.read xrds.should =~ Regexp.new(@op_endpoint) xrds.should =~ Regexp.new(@local_id) end end end end