Branston C0 Coverage Information - RCov

app/controllers/preconditions_controller.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/controllers/preconditions_controller.rb 120 76
100.00%
100.00%

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 #    This file is part of Branston.
2 #
3 #    Branston is free software: you can redistribute it and/or modify
4 #    it under the terms of the GNU Affero General Public License as published by
5 #    the Free Software Foundation.
6 #
7 #    Branston is distributed in the hope that it will be useful,
8 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
9 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 #    GNU Affero General Public License for more details.
11 #
12 #    You should have received a copy of the GNU Affero General Public License
13 #    along with Branston.  If not, see <http://www.gnu.org/licenses/>.
14 
15 class PreconditionsController < ApplicationController
16 
17   layout 'main'
18   before_filter :login_required
19   before_filter :find_scenario, :except => [:destroy, :set_precondition_description]
20 
21   in_place_edit_for :precondition, :description
22 
23   # GET /preconditions
24   # GET /preconditions.xml
25   def index
26     @preconditions = @scenario.preconditions
27 
28     respond_to do |format|
29       format.html # index.html.erb
30       format.xml  { render :xml => @preconditions }
31       format.js
32     end
33   end
34 
35   # GET /preconditions/1
36   # GET /preconditions/1.xml
37   def show
38     @precondition = Precondition.find(params[:id])
39 
40     respond_to do |format|
41       format.html # show.html.erb
42       format.xml  { render :xml => @precondition }
43     end
44   end
45 
46   # GET /preconditions/new
47   # GET /preconditions/new.xml
48   def new
49     @precondition = Precondition.new
50     @preconditions = @scenario.preconditions
51     @preconditions.push @precondition
52     respond_to do |format|
53       format.html # new.html.erb
54       format.xml  { render :xml => @precondition }
55       format.js
56     end
57   end
58 
59   # GET /preconditions/1/edit
60   def edit
61     @precondition = Precondition.find(params[:id])
62   end
63 
64   # POST /preconditions
65   # POST /preconditions.xml
66   def create
67     @precondition = Precondition.new(params[:precondition])
68     @precondition.scenario = @scenario
69     @preconditions = @scenario.preconditions
70     respond_to do |format|
71       if @precondition.save
72         flash[:notice] = 'Precondition was successfully created.'
73         format.html { redirect_to(@precondition) }
74         format.xml  { render :xml => @precondition, :status => :created, :location => @precondition }
75         format.js
76       else
77         format.html { render :action => "new" }
78         format.xml  { render :xml => @precondition.errors, :status => :unprocessable_entity }
79       end
80     end
81   end
82 
83   # PUT /preconditions/1
84   # PUT /preconditions/1.xml
85   def update
86     @precondition = Precondition.find(params[:id])
87 
88     respond_to do |format|
89       if @precondition.update_attributes(params[:precondition])
90         flash[:notice] = 'Precondition was successfully updated.'
91         format.html { redirect_to(@precondition) }
92         format.xml  { head :ok }
93       else
94         format.html { render :action => "edit" }
95         format.xml  { render :xml => @precondition.errors, :status => :unprocessable_entity }
96       end
97     end
98   end
99 
100   # DELETE /preconditions/1
101   # DELETE /preconditions/1.xml
102   def destroy
103     @precondition = Precondition.find(params[:id])
104     @precondition.destroy
105 
106     respond_to do |format|
107       format.html { redirect_to(preconditions_url(:scenario_id => @precondition.scenario_id)) }
108       format.xml  { head :ok }
109       format.js
110     end
111   end
112 
113   private
114 
115   def find_scenario
116     @scenario = Scenario.find(params[:scenario_id])
117   end
118 
119 end
120 

Generated on Thu Jan 07 15:27:03 +0000 2010 with rcov 0.9.6