C0 code coverage information

Generated on Fri Jul 11 15:55:31 -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/kvpost.rb 58 48
93.1% 
91.7% 
 1 require "openid/message"
 2 require "openid/fetchers"
 3 
 4 module OpenID
 5   # Exception that is raised when the server returns a 400 response
 6   # code to a direct request.
 7   class ServerError < OpenIDError
 8     attr_reader :error_text, :error_code, :message
 9 
10     def initialize(error_text, error_code, message)
11       super(error_text)
12       @error_text = error_text
13       @error_code = error_code
14       @message = message
15     end
16 
17     def self.from_message(msg)
18       error_text = msg.get_arg(OPENID_NS, 'error',
19                                '<no error message supplied>')
20       error_code = msg.get_arg(OPENID_NS, 'error_code')
21       return self.new(error_text, error_code, msg)
22     end
23   end
24 
25   class KVPostNetworkError < OpenIDError
26   end
27   class HTTPStatusError < OpenIDError
28   end
29 
30   class Message
31     def self.from_http_response(response, server_url)
32       msg = self.from_kvform(response.body)
33       case response.code.to_i
34       when 200
35         return msg
36       when 206
37         return msg
38       when 400
39         raise ServerError.from_message(msg)
40       else
41         error_message = "bad status code from server #{server_url}: "\
42         "#{response.code}"
43         raise HTTPStatusError.new(error_message)
44       end
45     end
46   end
47 
48   # Send the message to the server via HTTP POST and receive and parse
49   # a response in KV Form
50   def self.make_kv_post(request_message, server_url)
51     begin
52       http_response = self.fetch(server_url, request_message.to_url_encoded)
53     rescue Exception
54       raise KVPostNetworkError.new("Unable to contact OpenID server: #{$!.to_s}")
55     end
56     return Message.from_http_response(http_response, server_url)
57   end
58 end

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

Valid XHTML 1.0! Valid CSS!