Sha256: 71b4f42224c3989ec7827a954f53c6890f5d366120c8edaead59aac2c16fbbb1

Contents?: true

Size: 850 Bytes

Versions: 2

Compression:

Stored size: 850 Bytes

Contents

require 'test_helper'

class EventPollerTest < Test::Unit::TestCase
  def setup
    @eb = EBStub.new
    @poller = EbDeployer::EventPoller.new("myapp", "test", @eb)
  end

  def test_run_handle_block_through_all_events_when_there_is_no_from_anchor
    messages_handled = []
    @eb.set_events('myapp', 'test', ['a', 'b', nil])
    @poller.poll(nil) do |event|
      break if event[:message].nil?
      messages_handled << event[:message]
    end

    assert_equal ['a', 'b'], messages_handled
  end


  def test_can_poll_all_events_after_an_anchor
    @eb.set_events('myapp', 'test', ['a', 'b'], ['c', 'd', nil])
    anchor = @poller.get_anchor
    messages_handled = []
    @poller.poll(anchor) do |event|
      break if event[:message].nil?
      messages_handled << event[:message]
    end

    assert_equal ['c', 'd'], messages_handled
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eb_deployer-0.6.0.beta5 test/event_poller_test.rb
eb_deployer-0.6.0.beta4 test/event_poller_test.rb