Geminstaller C0 Coverage Information - RCov

spec/unit/gem_interaction_handler_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/gem_interaction_handler_spec.rb 37 33
10.81%
9.09%

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 # gem_interaction_handler is not used for RubyGems >= 0.9.5
6 describe "a GemInteractionHandler instance with mock dependencies" do
7   before(:each) do
8     @gem_interaction_handler = GemInstaller::GemInteractionHandler.new
9     @dependent_gem = sample_dependent_gem
10     @gem_interaction_handler.dependent_gem = @dependent_gem
11     @mock_noninteractive_chooser = mock("Mock NoninteractiveChooser")
12   end
13 
14   it "should pass only the specified platform when given a list for a dependent gem which has a platform specified" do
15     question = "question"
16     list = ["item"]
17     @mock_noninteractive_chooser.should_receive(:dependent_gem?).with(@dependent_gem.name, list).and_return(true)
18     @mock_noninteractive_chooser.should_receive(:choose).with(
19       question, list, @dependent_gem.name, @dependent_gem.version, [@dependent_gem.platform])
20     @gem_interaction_handler.handle_choose_from_list(question, list, @mock_noninteractive_chooser)
21   end
22 
23   it "should call valid_platform_selector when given a list for a gem which is not the dependent gem" do
24     question = "question"
25     list = ["item", "item"]
26     valid_platform_list = ["valid-platform-1", "valid-platform-2"]
27     @mock_valid_platform_selector = mock("Mock ValidPlatformSelector")
28     @mock_valid_platform_selector.should_receive(:select).with(@dependent_gem.platform).and_return(valid_platform_list)
29     @gem_interaction_handler.valid_platform_selector = @mock_valid_platform_selector
30     @mock_noninteractive_chooser.should_receive(:dependent_gem?).with(@dependent_gem.name, list).and_return(false)
31     @mock_noninteractive_chooser.should_receive(:uninstall_list_type?).with(question).and_return(false)
32     @mock_noninteractive_chooser.should_receive(:choose).with(
33       question, list, @dependent_gem.name, @dependent_gem.version, valid_platform_list)
34     @gem_interaction_handler.handle_choose_from_list(question, list, @mock_noninteractive_chooser)
35   end
36 end
37 end

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