C0 code coverage information

Generated on Fri Aug 25 10:11:26 PDT 2006 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
app/controllers/view_controller.rb 288 217
11.8% 
8.8% 
  1 require 'news_parts'
  2 
  3 class ViewController < ApplicationController
  4     layout 'site'
  5     include NewsParts
  6     include ActionView::Helpers::TextHelper
  7     
  8     def record_review
  9         unless @record_review
 10             begin
 11                 @record_review = RecordReview.find(
 12                     params[:id],
 13                     :conditions => @valid_state)
 14                 
 15             rescue ActiveRecord::RecordNotFound
 16               # we will redirect it to the oops page.
 17               render :template => '/page/oops', :status     => "404 Not Found"
 18               return false
 19             end
 20         end
 21         generate_record_review
 22     end
 23 
 24     def track_review
 25         unless @track_review
 26             begin
 27                 @track_review = TrackReview.find(params[:id],
 28                 :conditions => @valid_state)
 29             rescue ActiveRecord::RecordNotFound
 30                 # we will redirect it to the oops page.
 31                 render :template => '/page/oops', :status     => "404 Not Found"
 32                 return false
 33             end
 34         end
 35 
 36         if params[:page] and params[:page].to_i > 1
 37             page_num = params[:page].to_i
 38             if page_num > @track_review.article_pages.length
 39                 @page = @track_review.article_pages[0]
 40             else
 41                 @page = @track_review.article_pages[params[:page].to_i]
 42             end
 43         else
 44             @page = @track_review.article_pages[0]
 45         end
 46 
 47 		
 48         get_current('TrackReview') unless read_fragment(:controller => '/article', :action => 'track_review', :part => 'recent')
 49         get_most_read('TrackReview') unless read_fragment(:controller => '/article', :action => 'track_review', :part => 'most_read')
 50         get_highlights('TrackReview', 2) unless read_fragment(:controller => '/article', :action => 'track_review', :part => 'highlights')
 51         @page_title = "Pitchfork: #{@track_review.artist}: \"#{strip_tags(@track_review.title)}\" [Track Review]"
 52         @stylesheets << "article"
 53         
 54         @track_review.increment_read
 55     end
 56 
 57     def news
 58         begin
 59             @news = Article.find(
 60                 params[:id],
 61                 :conditions => @valid_state + " AND (type = 'News' OR type = 'NewsBlurb')")
 62                
 63         rescue ActiveRecord::RecordNotFound
 64           # we will redirect it to the oops page.
 65           render :template => '/page/oops', :status     => "404 Not Found"
 66           return false
 67         end
 68         
 69         #build up the sidebar data
 70         current_news(false)
 71         
 72         @feeds = { 
 73             :rss => url_for( :controller => 'rss', :action => 'news' ),
 74             :atom => url_for( :controller => 'atom', :action => 'news' ),
 75         }
 76         
 77         
 78         @page_title = "Pitchfork: #{strip_tags(@news.title)}"
 79         @stylesheets << "article" << "pages"
 80     end
 81 
 82     def download
 83         begin
 84             @download = Download.find(
 85                 params[:id],
 86                 :conditions => @valid_state)
 87                
 88         rescue ActiveRecord::RecordNotFound
 89           # we will redirect it to the oops page.
 90           render :template => '/page/oops', :status     => "404 Not Found"
 91           return false
 92         end
 93         
 94         #build up the sidebar data
 95         current_news(false)
 96 
 97         @feeds = { 
 98             :rss => url_for( :controller => 'rss', :action => 'downloads' ),
 99             :atom => url_for( :controller => 'atom', :action => 'downloads' ),
100         }
101         
102         
103         @page_title = "Pitchfork Downloads: #{@download.download_type.type_name}: #{@download.artist}: #{@download.title}"
104         @stylesheets << "article" << "pages"
105     end
106 
107     def feature
108         unless @feature
109             begin
110                 @feature = Feature.find(
111                 params[:id],
112                 :conditions => @valid_state)
113                 
114             rescue ActiveRecord::RecordNotFound
115                 # we will redirect it to the oops page.
116                 render :template => '/page/oops', :status     => "404 Not Found"
117                 return false
118             end
119         end
120 
121         if params[:page] and params[:page].to_i > 1
122             page_num = params[:page].to_i
123             if page_num > @feature.article_pages.length
124                 @page = @feature.article_pages[0]
125             else
126                 @page = @feature.article_pages[page_num - 1 ]
127             end
128         else
129             @page = @feature.article_pages[0]
130         end
131 
132         get_current('Feature') unless read_fragment(:controller => '/article', :action => 'feature', :part => 'recent')
133         get_most_read('Feature') unless read_fragment(:controller => '/article', :action => 'feature', :part => 'highlights')
134         get_highlights('Feature', 1) unless read_fragment(:controller => '/article', :action => 'feature', :part => 'most_read')
135         @page_title = "Pitchfork Feature: #{@feature.full_title}"
136         @page_title << " - " + @page.custom_title if @page.custom_title and @page.custom_title != ""
137         @stylesheets << "article" << "pages"
138 
139         @feature.increment_read
140     end
141     
142     def old_record_link
143         url = request.env["REQUEST_URI"]
144         
145         begin
146             @record_review = RecordReview.find(
147                 :first,
148                 :conditions => ['old_path = ? AND ' + @valid_state, url])
149                 
150         rescue ActiveRecord::RecordNotFound
151           # we will redirect it to the oops page.
152           render :template => '/page/oops', :status     => "404 Not Found"
153           return false
154         end
155         
156         redirect_to(:controller => 'article', :action => 'record_review', :id => @record_review.id, :artist_title => @record_review)
157     end
158     
159     def old_news_link
160         url = request.env["REQUEST_URI"]
161         matches = /\/news\/(\d\d)-(\d\d)\/(\d\d).shtml/.match(url)
162         
163 #        results = nil
164 #        begin
165 #            results = Article.find(:all, :conditions => ["old_path LIKE N? AND (published_at <= NOW() OR published_at IS NULL) AND approved = 1", "%" << url << "%"])
166 #        
167 #        rescue ActiveRecord::RecordNotFound
168 #            # we will redirect it to the oops page.
169 #            render :template => '/page/oops'
170 #            return false
171 #        end
172         
173 #        if results and results.size > 0
174         if matches and matches[1] and matches[2] and matches[3]
175             redirect_to( {:controller => 'page', :action => 'news', :params => 
176                 {
177                     :year => matches[1].size > 2 ? matches[1] : (matches[1].to_i > 80 ? '19' + matches[1] : '20' + matches[1]), 
178                     :month => matches[2], 
179                     :day => matches[3]}} )
180         else
181             render :template => '/page/oops', :status => "404 Not Found"
182             return false
183         end
184     end
185     
186     def old_tracks_link
187         url = request.env["REQUEST_URI"]
188         matches = /\/tracks\/(\d\d)-(\d\d)-(\d\d).shtml/.match(url)
189         
190         redirect_to( {:controller => 'page', :action => 'track_reviews', :params => 
191             {
192                 :year => matches[1].size > 2 ? matches[1] : (matches[1].to_i > 80 ? '19' + matches[1] : '20' + matches[1]), 
193                 :month => matches[2], 
194                 :day => matches[3]}} )
195     end
196     
197     def old_feature_link
198         url = request.env["REQUEST_URI"]
199         
200         begin
201             @feature = Feature.find(
202                 :first,
203                 :conditions => ['(old_path = ? OR old_path = ?) AND ' + @valid_state, url, url + "index.shtml"])
204                 
205         rescue ActiveRecord::RecordNotFound
206           # we will redirect it to the oops page.
207           render :template => '/page/oops', :status     => "404 Not Found"
208           return false
209         end
210         
211         
212         if @feature 
213             redirect_to :controller => 'article', :action => 'feature', :id => @feature.id, :artist_title => @feature 
214         else
215             # we will redirect it to the oops page.
216             render :template => '/page/oops', :status     => "404 Not Found"
217             return false
218         end
219     end
220 
221     protected
222     attr_accessor :valid_state
223 
224     # this private method prepares the records for the Recent reviews sidebar
225     def get_current(article_type)
226         @current = Article.find(:all,
227             :limit => 5,
228             :order => 'published_at DESC, premiere_position ASC',
229             :conditions => ['type = ? AND ' + @valid_state, article_type ])
230 		logger.info "loaded recent info"
231     end
232 
233     def get_highlights(article_type, count)
234         case article_type 
235         when 'RecordReview'
236             @highlights = List.find(
237             :first,
238             :conditions => 'list_name = \'Highlights: Record Reviews\'').articles.find(:all,
239                 :order => 'RAND()',
240                 :limit => 2,
241                 :conditions => 'type = \'RecordReview\' AND ' + @valid_state)
242 
243         when 'TrackReview'
244             @highlights = List.find(
245             :first,
246             :conditions => 'list_name = \'Highlights: Track Reviews\'').articles.find(:all,
247                 :order => 'RAND()',
248                 :limit => 2,
249                 :conditions => 'type = \'TrackReview\' AND ' + @valid_state)
250             
251         when 'Feature'
252             @highlights = List.find(
253                 :first,
254                 :conditions => 'list_name = \'Highlights: Features\'').articles.find(:all,
255                     :order => 'RAND()',
256                     :limit => 2,
257                     :conditions => 'type = \'Feature\' AND ' + @valid_state)
258         end
259 		logger.info "loaded highlights info"
260     end
261 
262     def generate_record_review
263         if params[:page] and params[:page].to_i > 1
264           page_num = params[:page].to_i
265           if page_num > @record_review.article_pages.length
266             @page = @record_review.article_pages[0]
267           else
268             @page = @record_review.article_pages[page_num - 1]
269           end
270         else
271           @page = @record_review.article_pages[0]
272         end
273 
274         get_current('RecordReview') unless read_fragment(:controller => '/article', :action => 'feature', :part => 'recent')
275 
276         get_most_read('RecordReview') unless read_fragment(:controller => '/article', :action => 'feature', :part => 'most_read')
277 
278         get_highlights('RecordReview', 2) unless read_fragment(:controller => '/article', :action => 'feature', :part => 'highlights')
279         @page_title = "#{@record_review.artist}: #{@record_review.title}: Pitchfork Record Review"
280         @page_title << " - " + @page.custom_title if @page.custom_title and @page.custom_title != ""
281         @stylesheets << "article"
282         @meta_tags = "<meta name=\"description\" content=\"[#{@record_review.record_label}; #{@record_review.release_year}] Rating: #{@record_review.rating} - Review by: #{@record_review.custom_author}\">\n" +
283                     "<meta name=\"keywords\" content=\"#{@record_review.rating}, #{@record_review.record_label}; #{@record_review.release_year}, #{@record_review.title}, #{@record_review.artist}, #{@record_review.custom_author}\">"
284                     
285         @record_review.increment_read
286     end
287     
288 end

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

Valid XHTML 1.0! Valid CSS!