Geminstaller C0 Coverage Information - RCov

spec/functional/install_processor_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/functional/install_processor_spec.rb 126 90
83.33%
80.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 dir = File.dirname(__FILE__)
2 require File.expand_path("#{dir}/../helper/spec_helper")
3 
4 describe "an InstallProcessor instance" do
5   before(:each) do
6     GemInstaller::TestGemHome.use
7     @registry = GemInstaller::create_registry
8     @install_processor = @registry.install_processor
9     @mock_output_filter = mock("Mock Output Filter")
10     @install_processor.output_filter = @mock_output_filter
11 
12     @missing_dependency_finder = @registry.missing_dependency_finder
13     @missing_dependency_finder.output_filter = @mock_output_filter
14 
15     @gem_command_manager = @registry.gem_command_manager
16     @gem_spec_manager = @registry.gem_spec_manager
17     @sample_gem = sample_gem
18     @sample_dependent_gem = sample_dependent_gem
19     @sample_multiplatform_gem = sample_multiplatform_gem_ruby
20     @sample_dependent_multiplatform_gem = sample_dependent_multiplatform_gem
21     @sample_dependent_multilevel_gem = sample_dependent_multilevel_gem
22 
23     # ensure all gems are installed to start
24     [@sample_gem, @sample_dependent_gem, @sample_dependent_multilevel_gem].each do |gem|
25       gem.fix_dependencies = true
26       install_gem(gem)
27     end
28   end
29 
30   it "should install a missing dependency at the bottom of a multilevel dependency chain" do
31     # uninstall ONLY the dependency
32     @sample_gem.uninstall_options -= ['--all']
33     uninstall_gem(@sample_gem)
34 
35     @mock_output_filter.should_receive(:geminstaller_output).once.with(:debug,/^Gem #{@sample_dependent_multilevel_gem.name}, version 1.0.0 is already installed/m)
36 
37     if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
38       # Rubygems >= 0.9.5 automatically installs missing dependencies by reinstalling top-level gem
39       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/fix_dependencies.*#{@sample_dependent_multilevel_gem.name}.*will be reinstalled/m)
40       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_dependent_multilevel_gem.name}, version 1.0.0/)
41       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Rubygems automatically installed dependency gem #{@sample_gem.name}-#{@sample_gem.version}/)
42     else
43       # GemInstaller handles missing dependencies for older versions, but doesn't perform re-install of top-level gem
44       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^Missing dependencies found for #{@sample_dependent_gem.name} \(1.0.0\)/m)
45       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^  #{@sample_gem.name} \(>= 1.0.0\)/)
46       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Installing #{@sample_gem.name} \(>= 1.0.0\)/)
47       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_gem.name}, version 1.0.0/)
48     end
49 
50 
51     @install_processor.process([@sample_dependent_multilevel_gem])
52     @gem_spec_manager.is_gem_installed?(@sample_gem).should==(true)
53   end
54   
55   it "should install missing dependencies in middle and bottom of a multilevel dependency chain" do
56     # uninstall the dependencies
57     [@sample_gem, @sample_dependent_gem].each do |gem|
58       gem.uninstall_options -= ['--all']
59       uninstall_gem(gem)
60     end
61   
62     options = {:info => true}
63     @install_processor.options = options
64   
65     @mock_output_filter.should_receive(:geminstaller_output).once.with(:debug,/^Gem #{@sample_dependent_multilevel_gem.name}, version 1.0.0 is already installed/m)
66     if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
67       # Rubygems >= 0.9.5 automatically installs missing dependencies by reinstalling top-level gem
68       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/fix_dependencies.*#{@sample_dependent_multilevel_gem.name}.*will be reinstalled/m)
69       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_dependent_multilevel_gem.name}, version 1.0.0/)
70       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Rubygems automatically installed dependency gem #{@sample_dependent_gem.name}-#{@sample_dependent_gem.version}/)
71     else
72       # GemInstaller handles missing dependencies for older versions, but doesn't perform re-install of top-level gem
73       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^Missing dependencies found for #{@sample_dependent_multilevel_gem.name} \(1.0.0\)/m)
74       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^  #{@sample_dependent_gem.name} \(>= 1.0.0\)/)
75       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Installing #{@sample_dependent_gem.name} \(>= 1.0.0\)/)
76       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_dependent_gem.name}, version 1.0.0/)
77     end
78   
79     # TODO: info option results in duplicate installation messages
80     @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Rubygems automatically installed dependency gem #{@sample_gem.name}-#{@sample_gem.version}/)
81   
82     @install_processor.process([@sample_dependent_multilevel_gem])
83     @gem_spec_manager.is_gem_installed?(@sample_dependent_gem).should==(true)
84     @gem_spec_manager.is_gem_installed?(@sample_gem).should==(true)
85   end
86   
87   it "should install missing dependencies at top and bottom of a multilevel dependency chain" do
88     # uninstall the gems
89     [@sample_gem, @sample_dependent_multilevel_gem].each do |gem|
90       gem.uninstall_options -= ['--all']
91       uninstall_gem(gem)
92     end
93   
94     @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_dependent_multilevel_gem.name}, version 1.0.0/)
95   
96     if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
97       # Rubygems >= 0.9.5 automatically installs missing dependencies
98       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Rubygems automatically installed dependency gem #{@sample_gem.name}-1.0.0/m)
99     else
100       # GemInstaller handles missing dependencies for older versions
101       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^Missing dependencies found for #{@sample_dependent_gem.name} \(1.0.0\)/m)
102       @mock_output_filter.should_receive(:geminstaller_output).once.with(:info,/^  #{@sample_gem.name} \(>= 1.0.0\)/)
103       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_gem.name}, version 1.0.0/)
104       @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Installing #{@sample_gem.name} \(>= 1.0.0\)/)
105     end
106   
107   
108     # middle level should already be installed
109     @gem_spec_manager.is_gem_installed?(@sample_dependent_gem).should==(true)
110   
111     @install_processor.process([@sample_dependent_multilevel_gem])
112     #top level should be installed
113     @gem_spec_manager.is_gem_installed?(@sample_dependent_multilevel_gem).should==(true)
114     #bottom level should be installed
115     @gem_spec_manager.is_gem_installed?(@sample_gem).should==(true)
116   end
117   
118   after(:each) do
119     GemInstaller::TestGemHome.uninstall_all_test_gems
120   end
121 
122   def uninstall_gem(gem)
123     @gem_command_manager.uninstall_gem(gem)
124     @gem_spec_manager.is_gem_installed?(gem).should==(false)
125   end  
126 end

Generated on Mon May 10 23:40:29 -0700 2010 with rcov 0.9.8