Geminstaller C0 Coverage Information - RCov

spec/unit/yaml_loader_spec.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/unit/yaml_loader_spec.rb 48 34
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 "YamlLoader instance" do
5   before(:each) do
6     @yaml_loader = GemInstaller::YamlLoader.new
7   end
8 
9   it "should load yaml" do
10     yaml = @yaml_loader.load('key: value')
11     'value'.should==(yaml['key'])
12   end
13 
14   it "should load multiline yaml" do
15     yaml = @yaml_loader.load("key1: value1\nkey2: value2")
16     'value2'.should==(yaml['key2'])
17   end
18 
19   it "should allow comments after yaml" do
20     yaml = @yaml_loader.load("key1: value1 # here is a comment\nkey2: value2   # another comment")
21     'value2'.should==(yaml['key2'])
22   end
23 
24   it "should raise an error if there is an error parsing the yaml" do
25     @invalid_yaml_text = <<-STRING_END
26     --- 
27     -1: 1  
28      - 1: 1
29     STRING_END
30 
31 
32     proc_should_raise_with_message(/Error: Received error while attempting to parse YAML.*/) { @yaml_loader.load(@invalid_yaml_text) }
33   end
34 
35   it "should handle value of '> 1' even if it is not surrounded by quotes or followed by a newline" do
36     # TODO: make this pass, otherwise people must enclose version specs in quotes
37     
38     # key == '1'
39     yaml_text = "key: > 1\n"
40     # yaml parse error 
41     yaml_text = "key: > 1"
42     # key == '> 1'
43     yaml_text = "key: '> 1'"
44 
45     yaml = @yaml_loader.load(yaml_text)
46     yaml['key'].should == '> 1'
47   end
48 end

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