Add tests for Storage:each
This commit is contained in:
parent
7d7f01b6d2
commit
06e61a7aa0
|
@ -77,7 +77,7 @@ module Rubella
|
|||
Storage.new (storage.data+@data), @length
|
||||
end
|
||||
|
||||
# Passes each dataset trought the given block.
|
||||
# Passes each dataset through the given block.
|
||||
#
|
||||
# @param pointer to block
|
||||
#
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Rubella::Storage, '.each' do
|
||||
|
||||
it "passes the data through the given block" do
|
||||
storage = Rubella::Storage.new [3, 4, 5]
|
||||
|
||||
sum = 0
|
||||
storage.each do |value|
|
||||
sum = sum + value
|
||||
end
|
||||
|
||||
expect(sum).to eq(12)
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue