C0 code coverage information

Generated on Sat May 27 21:23:30 CEST 2006 with rcov 0.5.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
app/apis/meta_weblog_service.rb 209 165
98.6% 
98.2% 
  1 module MetaWeblogStructs
  2   class Article < ActionWebService::Struct
  3     member :description,        :string
  4     member :title,              :string
  5     member :postid,             :string
  6     member :url,                :string
  7     member :link,               :string
  8     member :permaLink,          :string
  9     member :categories,         [:string]
 10     member :mt_text_more,       :string
 11     member :mt_excerpt,         :string
 12     member :mt_keywords,        :string
 13     member :mt_allow_comments,  :int
 14     member :mt_allow_pings,     :int
 15     member :mt_convert_breaks,  :string
 16     member :mt_tb_ping_urls,    [:string]
 17     member :dateCreated,        :time
 18   end
 19 
 20   class MediaObject < ActionWebService::Struct
 21     member :bits, :string
 22     member :name, :string
 23     member :type, :string
 24   end
 25 
 26   class Url < ActionWebService::Struct
 27     member :url, :string
 28   end
 29 end
 30 
 31 
 32 class MetaWeblogApi < ActionWebService::API::Base
 33   inflect_names false
 34 
 35   api_method :getCategories,
 36     :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string} ],
 37     :returns => [[:string]]
 38 
 39   api_method :getPost,
 40     :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ],
 41     :returns => [MetaWeblogStructs::Article]
 42 
 43   api_method :getRecentPosts,
 44     :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:numberOfPosts => :int} ],
 45     :returns => [[MetaWeblogStructs::Article]]
 46 
 47   api_method :deletePost,
 48     :expects => [ {:appkey => :string}, {:postid => :string}, {:username => :string}, {:password => :string}, {:publish => :int} ],
 49     :returns => [:bool]
 50 
 51   api_method :editPost,
 52     :expects => [ {:postid => :string}, {:username => :string}, {:password => :string}, {:struct => MetaWeblogStructs::Article}, {:publish => :int} ],
 53     :returns => [:bool]
 54 
 55   api_method :newPost,
 56     :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:struct => MetaWeblogStructs::Article}, {:publish => :int} ],
 57     :returns => [:string]
 58 
 59   api_method :newMediaObject,
 60     :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:data => MetaWeblogStructs::MediaObject} ],
 61     :returns => [MetaWeblogStructs::Url]
 62 
 63 end
 64 
 65 
 66 class MetaWeblogService < TypoWebService
 67   web_service_api MetaWeblogApi
 68   
 69   before_invocation :authenticate  
 70   attr_reader :controller
 71 
 72   def initialize(controller)
This method was called by:

     24   app/controllers/backend_controller.rb: in ''
      1   test/functional/backend_controller_test.rb:123 in 'test_meta_weblog_edit_post'
      1   test/functional/backend_controller_test.rb:135 in 'test_meta_weblog_new_post'

 73     @controller = controller
 74   end
 75 
 76   def getCategories(blogid, username, password)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

 77     Category.find_all.collect { |c| c.name }
 78   end
 79 
 80   def getPost(postid, username, password)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

 81     article = Article.find(postid)
 82                     
 83     article_dto_from(article)
 84   end    
 85 
 86   def getRecentPosts(blogid, username, password, numberOfPosts)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

 87     Article.find(:all, :order => "created_at DESC", :limit => numberOfPosts).collect{ |c| article_dto_from(c) }
 88   end
 89 
 90   def newPost(blogid, username, password, struct, publish)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

 91     article = Article.new 
 92     article.body        = struct['description'] || ''
 93     article.title       = struct['title'] || ''
 94     article.published   = publish ? 1 : 0
 95     article.author      = username
 96     article.created_at  = Time.now
 97     article.user        = @user
 98 
 99     # Movable Type API support
100     article.allow_comments = struct['mt_allow_comments'] || $config['default_allow_comments']
101     article.allow_pings    = struct['mt_allow_pings'] || $config['default_allow_pings']
102     article.extended       = struct['mt_text_more'] || ''
103     article.excerpt        = struct['mt_excerpt'] || ''
104     article.keywords       = struct['mt_keywords'] || ''
105     article.text_filter    = struct['mt_convert_breaks'] || ''
106     
107     if struct['categories']
108       article.categories.clear
109       Category.find_all.each do |c|
110         article.categories << c if struct['categories'].include?(c.name)
111       end
112     end
113 
114     article.send_pings(article_url(article), struct['mt_tb_ping_urls'])
115     
116     article.save
117     article.id.to_s
118   end
119     
120   def deletePost(appkey, postid, username, password, publish)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

121     article = Article.find(postid)
122     article.destroy
123     true
124   end
125 
126   def editPost(postid, username, password, struct, publish)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

127     article = Article.find(postid)
128     article.body        = struct['description'] || ''
129     article.title       = struct['title'] || ''
130     article.published   = publish ? 1 : 0
131     article.author      = username
132     # article.dateCreated
133 
134     # Movable Type API support
135     article.allow_comments = struct['mt_allow_comments'] || $config['default_allow_comments']
136     article.allow_pings    = struct['mt_allow_pings'] || $config['default_allow_pings']
137     article.extended       = struct['mt_text_more'] || ''
138     article.excerpt        = struct['mt_excerpt'] || ''
139     article.keywords       = struct['mt_keywords'] || ''
140     article.text_filter    = struct['mt_convert_breaks'] || ''
141 
142     if struct['categories']
143       article.categories.clear
144       Category.find_all.each do |c|
145         article.categories << c if struct['categories'].include?(c.name)
146       end
147     end
148     RAILS_DEFAULT_LOGGER.info(struct['mt_tb_ping_urls'])
149     article.send_pings(article_url(article), struct['mt_tb_ping_urls'])
150 
151     article.save    
152     true
153   end
154     
155   def newMediaObject(blogid, username, password, data)
This method was called by:

      1   vendor/rails/actionwebservice/lib/action_web_service/invocation.rb:144 in 'perform_invocation_without_interception'

156     path      = "#{RAILS_ROOT}/public/files/#{data["name"].split('/')[0..-2].join('/')}"
157     filepath  = "#{RAILS_ROOT}/public/files/#{data["name"]}"
158       
159     FileUtils.mkpath(path)
160       
161     File.open(filepath, "wb") { |f| f << data["bits"] }
162 
163     resource = Resource.new
164     resource.filename   = data["name"]
165     resource.size       = File.size(path)
166     resource.mime       = data["type"]    
167     resource.save
168       
169     MetaWeblogStructs::Url.new("url" => controller.url_for(:controller => "/files/#{data["name"]}"))
170   end             
171 
172   def article_dto_from(article)
This method was called by:

      2   app/apis/meta_weblog_service.rb:87 in 'getRecentPosts'
      1   test/functional/backend_controller_test.rb:123 in 'test_meta_weblog_edit_post'
      1   app/apis/meta_weblog_service.rb:83 in 'getPost'
      1   test/functional/backend_controller_test.rb:135 in 'test_meta_weblog_new_post'

173     MetaWeblogStructs::Article.new(
174       :description       => article.body,
175       :title             => article.title,
176       :postid            => article.id.to_s,
177       :url               => article_url(article).to_s,
178       :link              => article_url(article).to_s,
179       :permaLink         => article_url(article).to_s,
180       :categories        => article.categories.collect { |c| c.name },
181       :mt_text_more      => article.extended.to_s,
182       :mt_excerpt        => article.excerpt.to_s,
183       :mt_keywords       => article.keywords.to_s,
184       :mt_allow_comments => article.allow_comments.to_i,
185       :mt_allow_pings    => article.allow_pings.to_i,
186       :mt_convert_breaks => article.text_filter.to_s,
187       :mt_tb_ping_urls   => article.pings.collect { |p| p.url },
188       :dateCreated       => article.created_at || ""
189       )
190   end
191 
192   protected
193 
194   def article_url(article)
This method was called by:

      5   app/apis/meta_weblog_service.rb:179 in 'article_dto_from'
      5   app/apis/meta_weblog_service.rb:178 in 'article_dto_from'
      5   app/apis/meta_weblog_service.rb:177 in 'article_dto_from'
      1   app/apis/meta_weblog_service.rb:114 in 'newPost'
      1   app/apis/meta_weblog_service.rb:149 in 'editPost'

195     begin
196       controller.url_for :controller=>"/articles", :action =>"permalink",
197         :year => article.created_at.year, :month => sprintf("%.2d", article.created_at.month),
198         :day => sprintf("%.2d", article.created_at.day), :title => article.stripped_title
199     rescue
200       # FIXME: rescue is needed for functional tests as the test framework currently doesn't supply fully
201       # fledged controller instances (yet?)
202       "/articles/read/#{article.id}"
203     end
204   end
205 
206   def pub_date(time)
207     time.strftime "%a, %e %b %Y %H:%M:%S %Z"
208   end
209 end

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

Valid XHTML 1.0! Valid CSS!