C0 code coverage information

Generated on Sun Oct 26 11:18:05 -0500 2008 with rcov 0.8.1.2


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.
Name Total lines Lines of code Total coverage Code coverage
spec/aquarium/aspects/aspect_with_subtypes_spec.rb 85 73
100.0% 
100.0% 
 1 
 2 require File.dirname(__FILE__) + '/../spec_helper'
 3 require 'aquarium/spec_example_types'
 4 require 'aquarium/aspects'
 5 
 6 include Aquarium::Aspects
 7 
 8 # Explicitly check that advising subtypes and included modules works correctly.
 9 module SubTypeAspects
10   class Base
11     attr_reader :base_state
12     def doit *args
13       @base_state = args
14       yield args
15     end
16   end
17 
18   class Derived < Base
19     attr_reader :derived_state
20     def doit *args
21       @derived_state = args
22       super
23       yield args
24     end
25   end
26   
27   module BaseModule
28     attr_reader :base_state
29     def doit *args
30       @base_state = args
31       yield args
32     end
33   end
34 
35   class IncludingClass
36     include BaseModule
37     attr_reader :derived_state
38     def doit *args
39       @derived_state = args
40       super
41       yield args
42     end
43   end
44 end
45 
46 describe Aspect, " when advising overridden inherited methods that call super" do
47   after(:each) do
48     @aspect.unadvise if @aspect
49   end
50 
51   it "should correctly invoke and advise subclass and superclass methods." do
52     advised_types = []
53     @aspect = Aspect.new :before, :pointcut => {:types => /SubTypeAspects::.*/, :methods => :doit} do |jp, obj, *args|
54       advised_types << jp.target_type
55     end 
56     derived = SubTypeAspects::Derived.new
57     block_called = 0
58     derived.doit(:a1, :a2, :a3) { |*args| block_called += 1 }
59     block_called.should == 2
60     advised_types.should == [SubTypeAspects::Derived, SubTypeAspects::Base]
61     derived.base_state.should == [:a1, :a2, :a3]
62     derived.derived_state.should == [:a1, :a2, :a3]
63   end
64 end
65 
66 describe Aspect, " when advising overridden methods included through modules that call super" do
67   after(:each) do
68     @aspect.unadvise if @aspect
69   end
70 
71   it "should correctly invoke and advise overridden and original methods." do
72     advised_types = []
73     @aspect = Aspect.new :before, :pointcut => {:types => /SubTypeAspects::.*/, :methods => :doit} do |jp, obj, *args|
74       advised_types << jp.target_type
75     end 
76     derived = SubTypeAspects::IncludingClass.new
77     block_called = 0
78     derived.doit(:a1, :a2, :a3) { |*args| block_called += 1 }
79     block_called.should == 2
80     advised_types.should == [SubTypeAspects::IncludingClass, SubTypeAspects::BaseModule]
81     derived.base_state.should == [:a1, :a2, :a3]
82     derived.derived_state.should == [:a1, :a2, :a3]
83   end
84 end
85 

Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.

Valid XHTML 1.0! Valid CSS!