C0 code coverage information

Generated on Fri Jul 11 15:55:30 -0700 2008 with rcov 0.7.0


Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
Name Total lines Lines of code Total coverage Code coverage
lib/openid/consumer/responses.rb 148 86
92.6% 
87.2% 
  1 module OpenID
  2   class Consumer
  3     # Code returned when either the of the
  4     # OpenID::OpenIDConsumer.begin_auth or OpenID::OpenIDConsumer.complete_auth
  5     # methods return successfully.
  6     SUCCESS = :success
  7 
  8     # Code OpenID::OpenIDConsumer.complete_auth
  9     # returns when the value it received indicated an invalid login.
 10     FAILURE = :failure
 11 
 12     # Code returned by OpenIDConsumer.complete_auth when the user
 13     # cancels the operation from the server.
 14     CANCEL = :cancel
 15 
 16     # Code returned by OpenID::OpenIDConsumer.complete_auth when the
 17     # OpenIDConsumer instance is in immediate mode and ther server sends back a
 18     # URL for the user to login with.
 19     SETUP_NEEDED = :setup_needed
 20 
 21 
 22     module Response
 23       attr_reader :endpoint
 24 
 25       def status
 26         self.class::STATUS
 27       end
 28 
 29       # The identity URL that has been authenticated; the Claimed Identifier.
 30       # See also display_identifier.
 31       def identity_url
 32         @endpoint ? @endpoint.claimed_id : nil
 33       end
 34 
 35       # The display identifier is related to the Claimed Identifier, but the
 36       # two are not always identical.  The display identifier is something the
 37       # user should recognize as what they entered, whereas the response's
 38       # claimed identifier (in the identity_url attribute) may have extra
 39       # information for better persistence.
 40       #
 41       # URLs will be stripped of their fragments for display.  XRIs will
 42       # display the human-readable identifier (i-name) instead of the
 43       # persistent identifier (i-number).
 44       #
 45       # Use the display identifier in your user interface.  Use identity_url
 46       # for querying your database or authorization server, or other
 47       # identifier equality comparisons.
 48       def display_identifier
 49         @endpoint ? @endpoint.display_identifier : nil
 50       end
 51     end
 52 
 53     # A successful acknowledgement from the OpenID server that the
 54     # supplied URL is, indeed controlled by the requesting agent.
 55     class SuccessResponse
 56       include Response
 57 
 58       STATUS = SUCCESS
 59 
 60       attr_reader :message, :signed_fields
 61 
 62       def initialize(endpoint, message, signed_fields)
 63         # Don't use :endpoint=, because endpoint should never be nil
 64         # for a successfull transaction.
 65         @endpoint = endpoint
 66         @identity_url = endpoint.claimed_id
 67         @message = message
 68         @signed_fields = signed_fields
 69       end
 70 
 71       # Was this authentication response an OpenID 1 authentication
 72       # response?
 73       def is_openid1
 74         @message.is_openid1
 75       end
 76 
 77       # Return whether a particular key is signed, regardless of its
 78       # namespace alias
 79       def signed?(ns_uri, ns_key)
 80         @signed_fields.member?(@message.get_key(ns_uri, ns_key))
 81       end
 82 
 83       # Return the specified signed field if available, otherwise
 84       # return default
 85       def get_signed(ns_uri, ns_key, default=nil)
 86         if singed?(ns_uri, ns_key)
 87           return @message.get_arg(ns_uri, ns_key, default)
 88         else
 89           return default
 90         end
 91       end
 92 
 93       # Get signed arguments from the response message.  Return a dict
 94       # of all arguments in the specified namespace.  If any of the
 95       # arguments are not signed, return nil.
 96       def get_signed_ns(ns_uri)
 97         msg_args = @message.get_args(ns_uri)
 98         msg_args.each_key do |key|
 99           if !signed?(ns_uri, key)
100             return nil
101           end
102         end
103         return msg_args
104       end
105 
106       # Return response arguments in the specified namespace.
107       # If require_signed is true and the arguments are not signed,
108       # return nil.
109       def extension_response(namespace_uri, require_signed)
110         if require_signed
111           get_signed_ns(namespace_uri)
112         else
113           @message.get_args(namespace_uri)
114         end
115       end
116     end
117 
118     class FailureResponse
119       include Response
120       STATUS = FAILURE
121 
122       attr_reader :message, :contact, :reference
123       def initialize(endpoint, message, contact=nil, reference=nil)
124         @endpoint = endpoint
125         @message = message
126         @contact = contact
127         @reference = reference
128       end
129     end
130 
131     class CancelResponse
132       include Response
133       STATUS = CANCEL
134       def initialize(endpoint)
135         @endpoint = endpoint
136       end
137     end
138 
139     class SetupNeededResponse
140       include Response
141       STATUS = SETUP_NEEDED
142       def initialize(endpoint, setup_url)
143         @endpoint = endpoint
144         @setup_url = setup_url
145       end
146     end
147   end
148 end

Generated using the rcov code coverage analysis tool for Ruby version 0.7.0.

Valid XHTML 1.0! Valid CSS!