Geminstaller C0 Coverage Information - RCov

spec/functional/missing_dependency_finder_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/functional/missing_dependency_finder_spec.rb 77 63
5.19%
4.76%

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 if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.4')
5 # missing_dependency_finder is not used for RubyGems >= 0.9.5
6 describe "a MissingDependencyFinder instance" do
7   before(:each) do
8     GemInstaller::TestGemHome.use
9     @registry = GemInstaller::create_registry
10     @missing_dependency_finder = @registry.missing_dependency_finder
11     @mock_output_filter = mock("Mock Output Filter")
12     @missing_dependency_finder.output_filter = @mock_output_filter
13     @gem_command_manager = @registry.gem_command_manager
14     @gem_spec_manager = @registry.gem_spec_manager
15     @sample_gem = sample_gem
16     @sample_dependent_gem = sample_dependent_gem
17     @sample_multiplatform_gem = sample_multiplatform_gem_ruby
18     @sample_dependent_multiplatform_gem = sample_dependent_multiplatform_gem
19     @sample_dependent_multilevel_gem = sample_dependent_multilevel_gem
20 
21     # ensure all gems are installed to start
22     [@sample_gem, @sample_dependent_gem, @sample_multiplatform_gem, 
23       @sample_dependent_multiplatform_gem, @sample_dependent_multilevel_gem].each do |gem|
24       install_gem(gem)
25     end
26   end
27 
28   it "should return all missing dependencies, and inherit install_options from dependent, and force --include-dependencies option if not already set" do
29     # uninstall the dependencies
30     [@sample_gem, @sample_multiplatform_gem].each do |gem|
31       gem.uninstall_options -= ['--all']
32       uninstall_gem(gem)
33     end
34     @sample_dependent_gem.install_options << '--no-test'
35     @sample_dependent_multiplatform_gem.install_options << '--rdoc'
36     @sample_dependent_multiplatform_gem.install_options << '-y'
37   
38     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^Missing dependencies found for #{@sample_dependent_gem.name} \(1.0.0\)/m)
39     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^  #{@sample_gem.name} \(>= 1.0.0\)/)
40     missing_dependencies = @missing_dependency_finder.find(@sample_dependent_gem)
41     missing_dependencies[0].name.should==(@sample_gem.name)
42     missing_dependencies[0].version.should==('>= 1.0.0')
43     missing_dependencies[0].install_options.should include('--no-test')
44     missing_dependencies[0].install_options.should include('--include-dependencies')
45   
46     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^Missing dependencies found for #{@sample_dependent_multiplatform_gem.name} \(1.0.0\)/)
47     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^  #{@sample_multiplatform_gem.name} \(>= 1.0.0\)/)
48     missing_dependencies = @missing_dependency_finder.find(@sample_dependent_multiplatform_gem)
49     missing_dependencies[0].name.should==(@sample_multiplatform_gem.name)
50     missing_dependencies[0].version.should==('>= 1.0.0')
51     missing_dependencies[0].install_options.should include('--rdoc')
52     missing_dependencies[0].install_options.should include('-y')
53   end
54 
55   it "should find a missing dependency at the bottom of a multilevel dependency chain" do
56     # uninstall the dependencies
57     @sample_gem.uninstall_options -= ['--all']
58     uninstall_gem(@sample_gem)
59 
60     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^Missing dependencies found for #{@sample_dependent_gem.name} \(1.0.0\)/m)
61     @mock_output_filter.should_receive(:geminstaller_output).once.with(:info, /^  #{@sample_gem.name} \(>= 1.0.0\)/)
62 
63     dependencies = @missing_dependency_finder.find(@sample_dependent_multilevel_gem)
64     dependencies.size.should==(1)
65     dependencies[0].name.should==("stubgem")    
66   end
67   
68   after(:each) do
69     GemInstaller::TestGemHome.uninstall_all_test_gems
70   end
71 
72   def uninstall_gem(gem)
73     @gem_command_manager.uninstall_gem(gem)
74     @gem_spec_manager.is_gem_installed?(gem).should==(false)
75   end  
76 end
77 end

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