Return to Snippet

Revision: 5416
at March 7, 2008 05:57 by sou


Updated Code
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

Revision: 5415
at March 7, 2008 05:51 by sou


Initial Code
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

Initial URL

                                

Initial Description

                                

Initial Title
Spec For Requesting Myopenid.com

Initial Tags
textmate, ruby

Initial Language
Ruby