2015-05-01 12:43:01 +02:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe Rubella::Input::Base, '.each' do
|
|
|
|
|
|
|
|
it "passes the data through the given block" do
|
2015-05-05 21:42:05 +02:00
|
|
|
input = Rubella::Input::Base.new [3, 4, 5]
|
2015-05-01 12:43:01 +02:00
|
|
|
|
|
|
|
sum = 0
|
2015-05-05 21:42:05 +02:00
|
|
|
input.each do |value|
|
2015-05-01 12:43:01 +02:00
|
|
|
sum = sum + value
|
|
|
|
end
|
|
|
|
|
|
|
|
expect(sum).to eq(12)
|
|
|
|
end
|
|
|
|
|
2015-10-22 12:11:16 +02:00
|
|
|
end
|