Sha256: 9227bd3a6887222f93c690af531f04197bc67780f9de194935bf6dcf99f10795

Contents?: true

Size: 750 Bytes

Versions: 3

Compression:

Stored size: 750 Bytes

Contents

# encoding: utf-8

require 'test/helper'

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

3 entries across 3 versions & 1 rubygems

Version Path
nanoc3-3.1.9 test/base/test_notification_center.rb
nanoc3-3.1.8 test/base/test_notification_center.rb
nanoc3-3.2.0a4 test/base/test_notification_center.rb