Sha256: f7272a0e6870fe8e6876644c3b4b8800a08ba5ca6780d5707534c9e6961f0a71

Contents?: true

Size: 739 Bytes

Versions: 17

Compression:

Stored size: 739 Bytes

Contents

# frozen_string_literal: true

require 'helper'

class Nanoc::Int::NotificationCenterTest < Nanoc::TestCase
  def test_post
    # Set up notification
    Nanoc::Int::NotificationCenter.on :ping_received, :test do
      @ping_received = true
    end

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

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

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

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
nanoc-4.8.11 test/base/test_notification_center.rb
nanoc-4.8.10 test/base/test_notification_center.rb
nanoc-4.8.9 test/base/test_notification_center.rb
nanoc-4.8.8 test/base/test_notification_center.rb
nanoc-4.8.7 test/base/test_notification_center.rb
nanoc-4.8.6 test/base/test_notification_center.rb
nanoc-4.8.5 test/base/test_notification_center.rb
nanoc-4.8.4 test/base/test_notification_center.rb
nanoc-4.8.3 test/base/test_notification_center.rb
nanoc-4.8.2 test/base/test_notification_center.rb
nanoc-4.8.1 test/base/test_notification_center.rb
nanoc-4.8.0 test/base/test_notification_center.rb
nanoc-4.7.14 test/base/test_notification_center.rb
nanoc-4.7.13 test/base/test_notification_center.rb
nanoc-4.7.12 test/base/test_notification_center.rb
nanoc-4.7.11 test/base/test_notification_center.rb
nanoc-4.7.10 test/base/test_notification_center.rb