Sha256: 297f310479540db6d7b08e34c5f16e5bc58c563669519b781141d912fbfce4c0

Contents?: true

Size: 1.16 KB

Versions: 5

Compression:

Stored size: 1.16 KB

Contents

require File.dirname(__FILE__) + '/../test_helper'

class ExtensionTest < Test::Unit::TestCase
  
  def test_admin
    assert_equal Radiant::AdminUI.instance, Radiant::Extension.admin
  end
  
  class BasicExtensionObserver < MethodObserver
    cattr_accessor :activate_called, :deactivate_called
    @@activate_called = false
    def before_activate
      @@activate_called = true
    end
    @@deactivate_called = false
    def before_deactivate
      @@deactivate_called = true
    end
  end
  
  def test_activate
    BasicExtension.activate
    assert BasicExtension.active?
    BasicExtensionObserver.new.observe(BasicExtension.instance)
    BasicExtension.activate
    assert BasicExtension.active?
    assert !BasicExtensionObserver.activate_called
  end
  
  def test_deactivate
    assert BasicExtension.active?
    BasicExtensionObserver.new.observe(BasicExtension.instance)
    BasicExtension.deactivate
    assert !BasicExtension.active?
    assert BasicExtensionObserver.deactivate_called
    BasicExtensionObserver.deactivate_called = false
    BasicExtension.deactivate
    assert !BasicExtension.active?
    assert !BasicExtensionObserver.deactivate_called
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-0.6.0 test/unit/extension_test.rb
radiant-0.6.1 test/unit/extension_test.rb
radiant-0.6.2 test/unit/extension_test.rb
radiant-0.6.3 test/unit/extension_test.rb
radiant-0.6.4 test/unit/extension_test.rb