Geminstaller C0 Coverage Information - RCov

spec/functional/version_specifier_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/functional/version_specifier_spec.rb 52 39
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 "a VersionSpecifier instance" do
5   before(:each) do
6     @version_specifier = GemInstaller::VersionSpecifier.new
7   end
8 
9   it "should specify ambiguous version requirements when requirments are an array" do    
10     should_specify("> 0", ['1','0'], '1')
11     should_specify("= 1", ['2','1', '0'], '1')
12     should_specify("> 1.2.3", ['2.0','1.2.4,','1.2.4','0.3'], '2.0')
13   end
14   
15   it "should specify ambiguous version requirements when requirments are a comma-delimited string" do    
16     should_specify("> 0", '1, 0', '1')
17     should_specify("= 1", '2, 1, 0', '1')
18     should_specify("> 0.3.13.2", '0.3.13.4, 0.3.13.3, 0.3.13.2, 0.3.13.1', '0.3.13.4')
19     should_specify("> 1.2.3", '2.0, 1.2.4, 1.2.4, 0.3', '2.0')
20   end
21   
22   it "should handle ~> version requirement operator (greater minor version ok, but not major)" do
23     should_specify("~> 1.2", '2.1, 2.0, 1.3, 1.2, 1.1', '1.3')
24   end
25 
26   it "should handle platforms in version" do
27     should_specify("> 1", '1, 2 ruby mswin, 3', '2')
28   end
29 
30   # TODO: Should this work?  Gem::Requirement says it should...
31 #  specify "should handle multiple version requirements" do    
32 #    should_specify("> 0.3.13.1, < 0.3.13.4", '0.3.13.4, 0.3.13.3, 0.3.13.2, 0.3.13.1', '0.3.13.3')
33 #  end
34 
35   it "should throw an error if no matching versions are found" do    
36     lambda { @version_specifier.specify("> 2", '2, 1') }.should raise_error(GemInstaller::GemInstallerError)
37     lambda { @version_specifier.specify("!= 2", '2') }.should raise_error(GemInstaller::GemInstallerError)
38   end
39   
40   it "should include name of gem in error message, if it is specified" do    
41     begin
42       @version_specifier.specify("!= 2", '2', 'gem_name')
43     rescue GemInstaller::GemInstallerError => e
44       e.message.should match(/gem_name/)
45     end
46   end
47 
48   def should_specify(version_requirement, available_versions, expected_specified_version)
49     specified_version = @version_specifier.specify(version_requirement, available_versions)
50     specified_version.should==(expected_specified_version)
51   end
52 end

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