Sha256: b9e3ad8fff72428c812d0bbbba44748569b39fe183431e8652341163131d82b4
Contents?: true
Size: 748 Bytes
Versions: 4
Compression:
Stored size: 748 Bytes
Contents
require File.dirname(__FILE__) + '/../../spec_helper' describe Enumerable do before do @mascots = ['louie', 'bert', 'ernie'] end it "should perform injecting" do @mascots.injecting({}) { |m,i| m[i] = i.size }.should == { 'louie' => 5, 'bert' => 4, 'ernie' => 5 } end it "should find arrays of things inside other arrays" do @mascots.include_any?('louie', 'sasquatch').should be_true end it "should recognize absence of arrays of things inside other arrays" do @mascots.include_any?('chicken', 'sasquatch').should be_false end it "should group by" do groups = (1..6).group_by{ |i| i % 3 } groups[0].should == [3,6] groups[1].should == [1,4] groups[2].should == [2,5] end end
Version data entries
4 entries across 4 versions & 1 rubygems