Geminstaller C0 Coverage Information - RCov

spec/unit/file_reader_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/file_reader_spec.rb 45 41
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 existing file" do
5   it "should be openable" do
6     file_reader = GemInstaller::FileReader.new
7     testfile_path = File.expand_path("#{dir}/testfile.txt")
8     file_contents = file_reader.read(testfile_path)
9     file_contents.should==('test')
10   end
11 end
12 
13 describe "A nonexistent file" do
14   it "should return an error message" do
15     file_reader = GemInstaller::FileReader.new
16     testfile_path = File.expand_path("missing_file.txt")
17     lambda { file_reader.read(testfile_path) }.should raise_error(GemInstaller::MissingFileError)
18   end
19 end
20 
21 describe "An unopenable file" do
22   it "should return an error message" do
23     file_reader = GemInstaller::FileReader.new
24     file_reader.instance_eval {
25       def do_open(file) 
26         raise RuntimeError
27       end
28     }
29     testfile_path = File.expand_path("#{dir}/testfile.txt")
30     lambda { file_reader.read(testfile_path) }.should raise_error(GemInstaller::GemInstallerError)
31   end
32 end
33 
34 describe "A file that cannot be read" do
35   it "should return an error message" do
36     file_reader = GemInstaller::FileReader.new
37     file_reader.instance_eval {
38       def do_read(file) 
39         raise RuntimeError
40       end
41     }
42     testfile_path = File.expand_path("#{dir}/testfile.txt")
43     lambda { file_reader.read(testfile_path) }.should raise_error(GemInstaller::GemInstallerError)
44   end
45 end

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