C0 code coverage information

Generated on Thu Jun 07 11:33:59 -0400 2007 with rcov 0.8.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/games_controller.rb 78 67
38.5% 
31.3% 
 1 class GamesController < ApplicationController
 2 	layout "tournament"
 3 	before_filter :admin_required, :except => [:view, :scoreboard]
 4 	before_filter :tournament_required
 5 
 6 	def add
 7 		@teams = @tournament.teams.find( :all, :order => "name")
 8 		return unless request.post?
 9 		# refactor into Game validations...yeah, do this
10 		if params[:team1] == params[:team2]
11 			flash[:errors] = "A team may not play itself."
12 			render
13 		else
14 			game = @tournament.games.create(:teams => @tournament.teams.find(params[:team1], params[:team2]), :round => @tournament.rounds.find_or_create_by_number(params[:round].to_i))
15 			redirect_to :action => "scores", :game => game
16 		end
17 	end
18 	def schedule
19 		@teams = @tournament.teams.find(:all, :order => "name")
20 		return unless request.post?
21 		game = @tournament.games.create(:teams => Team.find(params[:team1], params[:team2]),
22 			:round => @tournament.rounds.find_or_create_by_number(params[:round].to_i))
23 		redirect_to :action => 'list'
24 	end	
25 
26 	def scores
27 		@game = @tournament.games.find(params[:game])
28 		@teams = @game.teams
29 	end
30 	
31 	def scoreboard
32 		@rounds = @tournament.rounds.find(:all)
33 	end
34 
35 	def list
36 		@rounds = @tournament.rounds.find(:all, :order => :number)
37 	end
38 
39 	def unscored
40 		@rounds = @tournament.rounds.find(:all, :order => :number)
41 	end
42 
43 	def view
44 		@game = @tournament.games.find params[:id]
45 	end
46 
47 	def tiebreak
48 		# this is dumb; change this after you have a functional 
49 		# test for tiebreak
50 		unless request.post?
51 			@game = @tournament.games.find(params[:id])
52 			@teams = @game.teams
53 			dummy = Struct.new(:name, :id).new("Tied", -1)
54 			@teams.unshift dummy
55 		end
56 		return unless request.post?
57 		@game ||= @tournament.games.find(params[:game])
58 		winner = params[:winner].to_i
59 		unless winner == -1
60 			@game.update_tiebreak(winner)
61 		end
62 		redirect_to :controller => "teams", :action => "standings"
63 	end
64 
65 	def process_scores
66 		the_game = @tournament.games.find(params[:game])
67 		the_game.process_round_results(params)
68 		the_game.save!
69 		if the_game.tied?
70 			redirect_to :action => "tiebreak", :id => @game.id
71 		else
72 			redirect_to :controller => "teams", :action => "standings"
73 		end
74 	rescue ActiveRecord::RecordNotSaved
75 		flash[:errors] = ["Game not saved"]
76 		redirect_to :back
77 	end
78 end

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

Valid XHTML 1.0! Valid CSS!