Sha256: 0621a5308e237d0559f7b4083bdbce8c3840726c617ec5429876ff7f45434590
Contents?: true
Size: 846 Bytes
Versions: 2
Compression:
Stored size: 846 Bytes
Contents
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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
frappuccino-0.3.0 | test/select_test.rb |
frappuccino-0.2.0 | test/select_test.rb |