Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/contexts/ShowStatisticsContext.rb | 72 | 50 | 86.11%
|
80.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 require 'Context/Context' |
2 require 'Context/Bridge' |
3 require 'Context/View' |
4 |
5 module JLDrill |
6 |
7 class ShowStatisticsContext < Context::Context |
8 |
9 def initialize(viewBridge) |
10 super(viewBridge) |
11 end |
12 |
13 class StatisticsView < Context::View |
14 attr_reader :quiz |
15 |
16 def initialize(context) |
17 super(context) |
18 @quiz = nil |
19 end |
20 |
21 # This closes the window. It's a convenience function |
22 # for the test code so that it has something to catch other |
23 # than the context closing. |
24 def close |
25 @context.exit |
26 end |
27 |
28 # Destroy the window containing the view |
29 def destroy |
30 # Please define in the concrete class |
31 end |
32 |
33 # Update the view with the statistics from the quiz |
34 def update(quiz) |
35 @quiz = quiz |
36 # Please define the rest of this method in the concrete class. |
37 # You should call super(quiz) first. |
38 end |
39 end |
40 |
41 def createViews |
42 @mainView = @viewBridge.StatisticsView.new(self) |
43 end |
44 |
45 def destroyViews |
46 @mainView.destroy if !@mainView.nil? |
47 @mainView = nil |
48 end |
49 |
50 def hasQuiz?(parent) |
51 !parent.nil? && parent.class.public_method_defined?(:quiz) && |
52 !parent.quiz.nil? |
53 end |
54 |
55 def enter(parent) |
56 if hasQuiz?(parent) |
57 super(parent) |
58 @mainView.update(parent.quiz) |
59 @parent.quiz.publisher.subscribe(self, "newProblem") |
60 end |
61 end |
62 |
63 def exit |
64 @parent.quiz.publisher.unsubscribe(self, "newProblem") |
65 super |
66 end |
67 |
68 def newProblemUpdated(problem) |
69 @mainView.update(@parent.quiz) unless @mainView.nil? |
70 end |
71 end |
72 end |
Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8