Branston C0 Coverage Information - RCov

app/controllers/scenarios_controller.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
app/controllers/scenarios_controller.rb 119 77
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 ScenariosController < ApplicationController
16 
17   layout 'main'
18   before_filter :login_required
19   before_filter :load_iteration_and_story, :except => [:set_scenario_title]
20 
21   in_place_edit_for :scenario, :title
22 
23   def index
24     @scenarios = @story.scenarios
25     respond_to do |format|
26       format.html
27       format.js
28     end
29   end
30 
31   # GET /scenarios/1
32   # GET /scenarios/1.xml
33   def show
34     @scenario = Scenario.find(params[:id])
35 
36     respond_to do |format|
37       format.html # scenario.html.erb
38       format.xml  { render :xml => @scenario }
39     end
40   end
41 
42   # GET /stories/:story_id/scenarios/new
43   # GET /stories/:story_id/scenarios/new.xml
44   def new
45     @scenario = Scenario.new
46     @scenarios = @story.scenarios
47     @scenarios.push @scenario
48     respond_to do |format|
49       format.html # new.html.erb
50       format.xml  { render :xml => @story }
51       format.js
52     end
53   end
54 
55 
56   # GET /scenarios/1/edit
57   def edit
58     @scenario = Scenario.find(params[:id])
59   end
60 
61   # POST /stories/:story_id/scenarios
62   # POST /stories/:story_id/scenarios.xml
63   def create
64     @scenario = Scenario.new(params[:scenario])
65     @scenario.story = @story
66     respond_to do |format|
67       if @scenario.save
68         @scenarios = @story.scenarios
69         flash[:notice] = 'Scenario was successfully created.'
70         format.html { redirect_to iteration_story_scenario_path(@iteration, @story, @scenario) }
71         format.xml  { render :xml => @scenario, :status => :created, :location => @scenario }
72         format.js
73       else
74         format.html { render :action => "new" }
75         format.xml  { render :xml => @scenario.errors, :status => :unprocessable_entity }
76       end
77     end
78   end
79 
80   # PUT /scenarios/1
81   # PUT /scenarios/1.xml
82   def update
83     @scenario = Scenario.find(params[:id])
84     respond_to do |format|
85       if @scenario.update_attributes(params[:scenario])
86         flash[:notice] = 'Scenario was successfully updated.'
87         format.html { redirect_to iteration_story_scenario_path(@iteration, @story, @scenario) }
88         format.xml  { head :ok }
89       else
90         format.html { render :action => "edit" }
91         format.xml  { render :xml => @scenario.errors, :status => :unprocessable_entity }
92       end
93     end
94   end
95 
96   # DELETE /stories/1
97   # DELETE /stories/1.xml
98   def destroy
99     @scenario = Scenario.find(params[:id])
100     @story = @scenario.story
101     @scenario.destroy
102 
103     respond_to do |format|
104       format.html { redirect_to(iteration_story_scenarios_path(@iteration, @story)) }
105       format.xml  { head :ok }
106       format.js
107     end
108   end
109 
110 
111   private
112 
113   def load_iteration_and_story
114     @story = Story.find_by_slug(params[:story_id]) if @story.nil?
115     @iteration = Iteration.find(params[:iteration_id])
116   end
117 
118 end
119 

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