Sha256: 0c5f4c56dbc28154ab6a2d86cc1b227309d0c2474c79b3c2b69b9beed94abf4d

Contents?: true

Size: 409 Bytes

Versions: 2

Compression:

Stored size: 409 Bytes

Contents

require 'test_helper'

describe "scan" do
  it "returns a stream where every element is the result of the passed block applied to the last result and the current element" do
    button =  Button.new
    stream = Frappuccino::Stream.new(button)
    count_stream = to_array(stream.scan(0) { |last, current|
      last + 1
    })

    5.times { button.push }
    assert_equal [1,2,3,4,5], count_stream
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
frappuccino-0.3.0 test/scan_test.rb
frappuccino-0.2.0 test/scan_test.rb