Sha256: 6230c7160cc45a1afc1845037f76e1fd53f6f000c779def57fba3807777cb5a1

Contents?: true

Size: 720 Bytes

Versions: 17

Compression:

Stored size: 720 Bytes

Contents

# encoding: utf-8

class Nanoc::NotificationCenterTest < MiniTest::Unit::TestCase

  include Nanoc::TestHelpers

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

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

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

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

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

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-3.6.1 test/base/test_notification_center.rb
nanoc-3.6.0 test/base/test_notification_center.rb
nanoc-3.5.0 test/base/test_notification_center.rb
nanoc-3.5.0b2 test/base/test_notification_center.rb
nanoc-3.5.0b1 test/base/test_notification_center.rb
nanoc-3.4.3 test/base/test_notification_center.rb
nanoc-3.4.2 test/base/test_notification_center.rb
nanoc-3.4.1 test/base/test_notification_center.rb
nanoc-3.4.0 test/base/test_notification_center.rb
nanoc-3.3.7 test/base/test_notification_center.rb
nanoc-3.3.6 test/base/test_notification_center.rb
nanoc-3.3.5 test/base/test_notification_center.rb
nanoc-3.3.4 test/base/test_notification_center.rb
nanoc-3.3.3 test/base/test_notification_center.rb
nanoc-3.3.2 test/base/test_notification_center.rb
nanoc-3.3.1 test/base/test_notification_center.rb
nanoc-3.3.0 test/base/test_notification_center.rb