Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
require 'test_helper'
describe "#select" do
it "properly filters events from the stream" do
points = Points.new
button = Button.new
stream = Frappuccino::Stream.new(points, button)
filtered_stream = to_array(stream.select{|event| event == :POINTS! })
9.times { points.POINTS! }
9.times { button.push }
assert_equal 9, filtered_stream.length
assert_equal true, filtered_stream.all? { |event| event == :POINTS! }
end
it "has #on_value" do
points = Points.new
button = Button.new
stream = Frappuccino::Stream.new(points, button)
filtered_stream = stream
.select{|event| event == :POINTS! }
count = 0
filtered_stream.on_value do |event|
count += 1
end
points.POINTS!
points.POINTS!
button.push
assert_equal 2, count
end
end