Sha256: 7e2866d7ef3aadf5248c8bf36894feed20f3ae52af635226d7f0bf7132d6ded2
Contents?: true
Size: 553 Bytes
Versions: 83
Compression:
Stored size: 553 Bytes
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes.rb' describe "String#sum" do it "returns a basic n-bit checksum of the characters in self" do "ruby".sum.should == 450 "ruby".sum(8).should == 194 "rubinius".sum(23).should == 881 end it "tries to convert n to an integer using to_int" do obj = mock('8') obj.should_receive(:to_int).and_return(8) "hello".sum(obj).should == "hello".sum(8) end end
Version data entries
83 entries across 83 versions & 1 rubygems