Rcov C0 Coverage Information - RCov

app/controllers/admins_controller.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/controllers/admins_controller.rb 55 39
81.82%
76.92%

Key

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.

Coverage Details

1 class AdminsController < ApplicationController
2   include UsersHelper
3   before_filter  :authorize_only_for_admin
4 
5   def index
6   end
7 
8   def populate
9     admins_data = Admin.find(:all, :order => "user_name")
10     # construct_table_rows defined in UsersHelper
11     @admins = construct_table_rows(admins_data)
12   end
13 
14   def edit
15     @user = Admin.find_by_id(params[:id])
16   end
17 
18   def new
19     @user = Admin.new(params[:user])
20   end
21 
22   def update
23     @user = Admin.find(params[:id])
24     attrs = params[:user]
25     # update_attributes supplied by ActiveRecords
26     if !@user.update_attributes(attrs)
27       flash[:error] = I18n.t("admins.update.error")
28       render :action => :edit
29     else
30       flash[:success] = I18n.t("admins.update.success",
31                                    :user_name => @user.user_name)
32       redirect_to :action => 'index'
33     end
34   end
35 
36   # Create a new Admin
37   def create
38     # Default attributes: role = TA or role = STUDENT
39     # params[:user] is a hash of values passed to the controller
40     # by the HTML form with the help of ActiveView::Helper::
41     @user = Admin.new(params[:user])
42     # Return unless the save is successful; save inherted from
43     # active records--creates a new record if the model is new, otherwise
44     # updates the existing record
45     if @user.save
46       flash[:success] = I18n.t("admins.create.success",
47                                :user_name => @user.user_name)
48 
49       redirect_to :action => 'index'
50     else
51       flash[:error] = I18n.t('admins.create.error')
52       render "new"
53     end
54   end
55 end

Generated on Tue Feb 07 00:07:35 -0500 2012 with rcov 0.9.10