Sha256: fe14ef1434575a5278278fe6b1c50a79640241ebc7259eff3be64bcbd42d9414

Contents?: true

Size: 679 Bytes

Versions: 2

Compression:

Stored size: 679 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

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 test/base/test_notification_center.rb
nanoc-3.7.5 test/base/test_notification_center.rb