C0 code coverage information
Generated on Sun Oct 26 11:18:15 -0500 2008 with rcov 0.8.1.2
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.
1 require File.dirname(__FILE__) + '/../spec_helper'
2 require 'aquarium/utils/array_utils'
3 require 'set'
4
5 describe Aquarium::Utils::ArrayUtils, "#make_array" do
6 it "should return an empty array if the input is nil." do
7 make_array(nil).should == []
8 end
9
10 it "should accept a list of arguments instead of an array or Set." do
11 make_array(nil, nil).should == []
12 make_array(nil, 1, 2, nil, 3, 4).should == [1, 2, 3, 4]
13 end
14
15 it "should return an empty array if an input array contains all nils." do
16 make_array([nil, nil]).should == []
17 end
18
19 it "should return an empty array if an input Set contains all nils." do
20 make_array(Set.new([nil, nil])).should == []
21 end
22
23 it "should return an array with all nils removed from the input array." do
24 make_array([nil, 1, 2, nil, 3, 4]).should == [1, 2, 3, 4]
25 end
26
27 it "should return an array with all nils removed from the input Set." do
28 make_array(Set.new([nil, 1, 2, nil, 3, 4])).should == [1, 2, 3, 4]
29 end
30
31 it "should return an 1-element array with an empty element if the input is empty." do
32 make_array("").should == [""]
33 end
34
35 it "should return an 1-element array with an element that matched the input element." do
36 make_array("123").should == ["123"]
37 end
38
39 it "should return an input array unchanged if it contains no nil elements." do
40 make_array([1,2,"123"]).should == [1,2,"123"]
41 end
42
43 it "should return an input Set#to_a if it contains no nil elements." do
44 make_array(Set.new([1,2,"123"])).should == [1,2,"123"]
45 end
46
47 it "should be available as a class method." do
48 Aquarium::Utils::ArrayUtils.make_array(Set.new([1,2,"123"])).should == [1,2,"123"]
49 end
50 end
51
52 describe Aquarium::Utils::ArrayUtils, "#strip_array_nils" do
53 it "should return an empty array if an input array contains all nils." do
54 strip_array_nils([nil, nil]).should == []
55 end
56
57 it "should return an empty array if an input Set contains all nils." do
58 strip_array_nils(Set.new([nil, nil])).should == []
59 end
60
61 it "should return an array with all nils removed from the input array." do
62 strip_array_nils([nil, 1, 2, nil, 3, 4]).should == [1, 2, 3, 4]
63 end
64
65 it "should return an array with all nils removed from the input Set." do
66 strip_array_nils(Set.new([nil, 1, 2, nil, 3, 4])).should == [1, 2, 3, 4]
67 end
68 end
69
70 describe Aquarium::Utils::ArrayUtils, ".strip_array_nils" do
71 it "should work like the instance method." do
72 Aquarium::Utils::ArrayUtils.strip_array_nils(Set.new([nil, 1, 2, nil, 3, 4])).should == [1, 2, 3, 4]
73 end
74 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.