spec/sugar-high/array_spec.rb in sugar-high-0.2.12 vs spec/sugar-high/array_spec.rb in sugar-high-0.3.0
- old
+ new
@@ -21,9 +21,19 @@
it "should translate nested array of numbers and strings into symbols only array, excluding numbers" do
[1, 'blip', [3, "hello"]].to_strings.should == ['blip', 'hello']
end
end
+ describe '#flat_uniq' do
+ it "should flatten array, remove nils and make unique" do
+ [1, 'blip', ['blip', nil, 'c'], nil].flat_uniq.should == [1, 'blip', 'c']
+ end
+
+ it "should return empty list if called on nil" do
+ nil.flat_uniq.should == []
+ end
+ end
+
describe '#none?' do
it "should be none if no real values in array" do
[nil, nil].none?.should be_true
nil.none?.should be_true
end