Sha256: 6b2b5adf5138ac70ba0cfa247468e668fb09290d5f966f1a86855f266a10e041
Contents?: true
Size: 1008 Bytes
Versions: 2
Compression:
Stored size: 1008 Bytes
Contents
require 'test_helper' describe Frappuccino::Stream do describe "#count" do it "returns a Stepper that's value is the current length of the Stream" do button = Button.new stream = Frappuccino::Stream.new(button) count = stream.count assert_equal 0, count.now button.push assert_equal 1, count.now end it "it only counts matching items if an argument is passed" do button = Button.new stream = Frappuccino::Stream.new(button) count = stream.count(1) assert_equal 0, count.now button.emit(0) assert_equal 0, count.now button.emit(1) assert_equal 1, count.now end it "it only counts the matching item if a block is given" do button = Button.new stream = Frappuccino::Stream.new(button) count = stream.count { |i| i > 1 } assert_equal 0, count.now button.emit(1) assert_equal 0, count.now button.emit(5) assert_equal 1, count.now end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
frappuccino-0.3.0 | test/stream_test.rb |
frappuccino-0.2.0 | test/stream_test.rb |