Geminstaller C0 Coverage Information - RCov

spec/unit/install_processor_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/install_processor_spec.rb 68 57
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 dir = File.dirname(__FILE__)
2 require File.expand_path("#{dir}/../helper/spec_helper")
3 
4 describe "an InstallProcessor instance with no options passed" do
5   before(:each) do
6     install_processor_spec_setup_common
7     @sample_gem.fix_dependencies = false
8   end
9 
10   it "should install a gem" do
11     @mock_gem_spec_manager.should_receive(:is_gem_installed?).once.with(@sample_gem).and_return(false)
12     @mock_gem_list_checker.should_receive(:verify_and_specify_remote_gem!).once.with(@sample_gem)
13     @mock_gem_command_manager.should_receive(:install_gem).once.with(@sample_gem, false).and_return([])
14     @mock_output_filter.should_receive(:geminstaller_output).once.with(:install,/^Invoking gem install for #{@sample_gem.name}, version 1.0.0/).and_return([])
15 
16     @install_processor.process([@sample_gem])
17   end  
18 
19   it "should not install a gem which is already installed" do
20     @sample_gem.check_for_upgrade = false
21     @mock_gem_spec_manager.should_receive(:is_gem_installed?).once.with(@sample_gem).and_return(true)
22     @mock_output_filter.should_receive(:geminstaller_output).once.with(:debug,/^Gem #{@sample_gem.name}, version 1.0.0 is already installed./).and_return([])
23     @install_processor.process([@sample_gem])
24   end
25 
26   it "should verify and specify gem if check_for_upgrade is specified" do
27     @sample_gem.check_for_upgrade = true
28     @mock_gem_list_checker.should_receive(:verify_and_specify_remote_gem!).once.with(@sample_gem)
29     @mock_gem_spec_manager.should_receive(:is_gem_installed?).once.with(@sample_gem).and_return(true)
30     @mock_output_filter.should_receive(:geminstaller_output).once.with(:debug,/^Gem #{@sample_gem.name}, version 1.0.0 is already installed./).and_return([])
31     @install_processor.process([@sample_gem])
32   end
33 end
34 
35 describe "an InstallProcessor instance invoked with info option passed" do
36   before(:each) do
37     install_processor_spec_setup_common
38     @sample_gem.fix_dependencies = false
39     @options[:info] = true
40   end
41 
42   it "should show info message for a gem which is already installed" do
43     @sample_gem.check_for_upgrade = false
44     @mock_gem_spec_manager.should_receive(:is_gem_installed?).once.with(@sample_gem).and_return(true)
45     @mock_output_filter.should_receive(:geminstaller_output).once().with(:debug,/^Gem .*, version .*is already installed/)
46     @install_processor.process([@sample_gem])
47   end
48 end
49 
50 def install_processor_spec_setup_common
51   @install_processor = GemInstaller::InstallProcessor.new
52 
53   @mock_gem_command_manager = mock("Mock GemCommandManager")
54   @mock_gem_spec_manager = mock("Mock GemCommandManager")
55   @mock_output_filter = mock("Mock Output Filter")
56   @mock_gem_list_checker = mock("Mock GemListChecker")
57   @mock_missing_dependency_finder = mock("Mock MissingDependencyFinder")
58   @options = {}
59 
60   @install_processor.gem_list_checker = @mock_gem_list_checker
61   @install_processor.gem_command_manager = @mock_gem_command_manager
62   @install_processor.gem_spec_manager = @mock_gem_spec_manager
63   @install_processor.options = @options
64   @install_processor.output_filter = @mock_output_filter
65   @install_processor.missing_dependency_finder = @mock_missing_dependency_finder
66 
67   @sample_gem = sample_gem
68 end

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