Sha256: 99faaf2dea80aaa494c0190e4c7a7e37606881b9a4971e537a053c3f8e2353f6

Contents?: true

Size: 727 Bytes

Versions: 8

Compression:

Stored size: 727 Bytes

Contents

# encoding: utf-8

class Nanoc3::NotificationCenterTest < MiniTest::Unit::TestCase

  include Nanoc3::TestHelpers

  def test_post
    # Set up notification
    Nanoc3::NotificationCenter.on :ping_received, :test do
      @ping_received = true
    end

    # Post
    @ping_received = false
    Nanoc3::NotificationCenter.post :ping_received
    assert(@ping_received)
  end

  def test_remove
    # Set up notification
    Nanoc3::NotificationCenter.on :ping_received, :test do
      @ping_received = true
    end

    # Remove observer
    Nanoc3::NotificationCenter.remove :ping_received, :test

    # Post
    @ping_received = false
    Nanoc3::NotificationCenter.post :ping_received
    assert(!@ping_received)
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
nanoc3-3.2.4 test/base/test_notification_center.rb
nanoc3-3.2.3 test/base/test_notification_center.rb
nanoc3-3.2.2 test/base/test_notification_center.rb
nanoc3-3.2.1 test/base/test_notification_center.rb
nanoc3-3.2.0 test/base/test_notification_center.rb
nanoc3-3.2.0b3 test/base/test_notification_center.rb
nanoc3-3.2.0b2 test/base/test_notification_center.rb
nanoc3-3.2.0b1 test/base/test_notification_center.rb