Geminstaller C0 Coverage Information - RCov

spec/unit/ruby_gem_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/ruby_gem_spec.rb 94 79
88.30%
86.08%

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 ruby gem data object" do
5   before(:each) do
6   end
7 
8   # it "should fail as a test of CI" do
9   #   'does cruise work?'.should == "yes"
10   # end
11 
12   it "may be instantiated with a name, a version, a platform, install options, check_for_upgrade flag, fix_dependencies flag, no_autogem flag, and prefer_binary_platform flag" do
13     gem = GemInstaller::RubyGem.new('mygem', :version => 'v1.1', :platform => "ruby", :install_options => '-y')
14     gem.name.should==('mygem')
15     gem.version.should==('v1.1')
16     gem.platform.should==('ruby')
17     gem.install_options.should==('-y')
18     gem.check_for_upgrade.should==(false)
19     gem.fix_dependencies.should==(false)
20     gem.no_autogem.should==(false)
21     if GemInstaller::RubyGemsVersionChecker.matches?('>=0.9.5')
22       gem.prefer_binary_platform.should==(nil)
23     else
24       gem.prefer_binary_platform.should==(true)
25     end
26   end
27   
28   it "may be instantiated with only a name and a version" do
29     gem = GemInstaller::RubyGem.new('mygem', :version => '1.1')
30     gem.name.should==('mygem')
31     gem.version.should==('1.1')
32   end
33 
34   if GemInstaller::RubyGemsVersionChecker.matches?('<=0.9.5') 
35   it "should default the platform to ruby if it is not specified" do
36     gem = GemInstaller::RubyGem.new('mygem', :version => 'v1.1')
37     gem.name.should==('mygem')
38     gem.version.should==('v1.1')
39     gem.platform.should==('ruby')
40   end
41   end
42 
43   if GemInstaller::RubyGemsVersionChecker.matches?('>0.9.5') 
44   it "should leave the platform nil if it is not specified" do
45     gem = GemInstaller::RubyGem.new('mygem', :version => 'v1.1')
46     gem.name.should==('mygem')
47     gem.version.should==('v1.1')
48     gem.platform.should==(nil)
49   end
50   end
51 
52   it "may be instantiated with only a name, and install options (unspecified version)" do
53     gem = GemInstaller::RubyGem.new('mygem', :install_options => '-y')
54     gem.name.should==('mygem')
55     gem.install_options.should==('-y')
56   end
57 
58   it "may be instantiated with only a name, and uninstall options" do
59     gem = GemInstaller::RubyGem.new('mygem', :uninstall_options => '--all')
60     gem.name.should==('mygem')
61     gem.uninstall_options.should==('--all')
62   end
63 
64   it "may be instantiated with only a name, and install options (unspecified version)" do
65     gem = GemInstaller::RubyGem.new('mygem', :version => '> 0.1.2.3')
66     gem.version.should==('> 0.1.2.3')
67   end
68 
69   it "should be comparable on name, version, and platform" do
70     gems = []
71     gems << GemInstaller::RubyGem.new('3', :version => '2', :platform => '2', :install_options => '4')
72     gems << GemInstaller::RubyGem.new('3', :version => '2', :platform => '1', :install_options => '3')
73     gems << GemInstaller::RubyGem.new('3', :version => '1', :platform => '3', :install_options => '2')
74     gems << GemInstaller::RubyGem.new('2', :version => '1', :platform => '3', :install_options => '1')
75     gems << GemInstaller::RubyGem.new('1', :version => '1', :platform => '3', :install_options => '0')
76     gems.sort!
77     gems[0].install_options.should==('0')
78     gems[1].install_options.should==('1')
79     gems[2].install_options.should==('2')
80     gems[3].install_options.should==('3')
81     gems[4].install_options.should==('4')
82   end
83 
84   it "should compare as equal if both platforms are nil" do
85     gem1 = GemInstaller::RubyGem.new('1', :platform => nil)
86     gem2 = GemInstaller::RubyGem.new('1', :platform => nil)
87     gem1.should ==(gem2)
88   end
89 
90   it "should return regexp_escaped_name" do
91     gem = GemInstaller::RubyGem.new('mygem()')
92     gem.regexp_escaped_name.should==('mygem\(\)')
93   end
94 end

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