Sha256: adb30951c82fb356015c8ebab03c2fbe6340da39e34ef945a0d29b14d8ae7faa

Contents?: true

Size: 681 Bytes

Versions: 15

Compression:

Stored size: 681 Bytes

Contents

# encoding: utf-8

class Nanoc::NotificationCenterTest < Nanoc::TestCase

  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

15 entries across 15 versions & 1 rubygems

Version Path
nanoc-3.7.4 test/base/test_notification_center.rb
nanoc-3.7.3 test/base/test_notification_center.rb
nanoc-3.7.2 test/base/test_notification_center.rb
nanoc-3.7.1 test/base/test_notification_center.rb
nanoc-3.7.0 test/base/test_notification_center.rb
nanoc-3.6.11 test/base/test_notification_center.rb
nanoc-3.6.10 test/base/test_notification_center.rb
nanoc-3.6.9 test/base/test_notification_center.rb
nanoc-3.6.8 test/base/test_notification_center.rb
nanoc-3.6.7 test/base/test_notification_center.rb
nanoc-3.6.6 test/base/test_notification_center.rb
nanoc-3.6.5 test/base/test_notification_center.rb
nanoc-3.6.4 test/base/test_notification_center.rb
nanoc-3.6.3 test/base/test_notification_center.rb
nanoc-3.6.2 test/base/test_notification_center.rb