Sha256: 9ef17166910afa1c89e82a714899072f6b85ba366d163a3215f2789571e73448

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

require 'test_helper'

require 'frappuccino'

describe "MVP interaction" do
  it "can subscribe to an event stream" do
    button = Button.new
    stream = Frappuccino::Stream.new(button)

    counter = stream
              .map {|event| event == :pushed ? 1 : 0 }
              .inject(0) {|sum, n| sum + n }
              .map { |val| val.to_s }

    assert_equal "0", counter.now

    3.times { button.push }
    assert_equal "3", counter.now

    button.push
    assert_equal "4", counter.now
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frappuccino-0.3.0 test/mvp_test.rb