Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
app/controllers/outcomes_controller.rb | 116 | 74 | 100.00%
|
100.00%
|
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.
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 OutcomesController < ApplicationController |
16 |
17 before_filter :login_required |
18 before_filter :find_scenario, :except => [:destroy, :set_outcome_description] |
19 |
20 in_place_edit_for :outcome, :description |
21 |
22 # GET /outcomes |
23 # GET /outcomes.xml |
24 def index |
25 @outcomes = @scenario.outcomes |
26 |
27 respond_to do |format| |
28 format.html # index.html.erb |
29 format.xml { render :xml => @outcomes } |
30 format.js |
31 end |
32 end |
33 |
34 # GET /outcomes/1 |
35 # GET /outcomes/1.xml |
36 def show |
37 @outcome = Outcome.find(params[:id]) |
38 |
39 respond_to do |format| |
40 format.html # show.html.erb |
41 format.xml { render :xml => @outcome } |
42 end |
43 end |
44 |
45 # GET /outcomes/new |
46 # GET /outcomes/new.xml |
47 def new |
48 @outcome = Outcome.new |
49 @outcomes = @scenario.outcomes |
50 @outcomes.push @outcome |
51 respond_to do |format| |
52 format.html # new.html.erb |
53 format.xml { render :xml => @outcome } |
54 format.js |
55 end |
56 end |
57 |
58 # GET /outcomes/1/edit |
59 def edit |
60 @outcome = Outcome.find(params[:id]) |
61 end |
62 |
63 # POST /outcomes |
64 # POST /outcomes.xml |
65 def create |
66 @outcome = Outcome.new(params[:outcome]) |
67 @outcome.scenario = @scenario |
68 @outcomes = @scenario.outcomes |
69 respond_to do |format| |
70 if @outcome.save |
71 flash[:notice] = 'Outcome was successfully created.' |
72 format.html { redirect_to(@outcome) } |
73 format.xml { render :xml => @outcome, :status => :created, :location => @outcome } |
74 format.js |
75 else |
76 format.html { render :action => "new" } |
77 format.xml { render :xml => @outcome.errors, :status => :unprocessable_entity } |
78 end |
79 end |
80 end |
81 |
82 # PUT /outcomes/1 |
83 # PUT /outcomes/1.xml |
84 def update |
85 @outcome = Outcome.find(params[:id]) |
86 |
87 respond_to do |format| |
88 if @outcome.update_attributes(params[:outcome]) |
89 flash[:notice] = 'Outcome was successfully updated.' |
90 format.html { redirect_to(@outcome) } |
91 format.xml { head :ok } |
92 else |
93 format.html { render :action => "edit" } |
94 format.xml { render :xml => @outcome.errors, :status => :unprocessable_entity } |
95 end |
96 end |
97 end |
98 |
99 # DELETE /outcomes/1 |
100 # DELETE /outcomes/1.xml |
101 def destroy |
102 @outcome = Outcome.find(params[:id]) |
103 @outcome.destroy |
104 |
105 respond_to do |format| |
106 format.html { redirect_to(outcomes_url) } |
107 format.xml { head :ok } |
108 format.js |
109 end |
110 end |
111 |
112 def find_scenario |
113 @scenario = Scenario.find(params[:scenario_id]) |
114 end |
115 end |
116 |
Generated on Thu Jan 07 15:27:03 +0000 2010 with rcov 0.9.6