Sha256: 69efe482538120a7604e884dc854380b8e272f17b2eef486038291c3dd24666c

Contents?: true

Size: 1.17 KB

Versions: 15

Compression:

Stored size: 1.17 KB

Contents

require "#{::File.dirname(__FILE__)}/../../test_helper"

class CallbacksTestClass
  attr_reader :configured
  include PoolParty::Callbacks
  
  additional_callbacks ["after_boxes"]
  
  def before_configure
    @configured = true
  end
end

class TestCallbacks < Test::Unit::TestCase
  context "methods" do
    setup do
      @tc = CallbacksTestClass.new
      @tc.setup_callbacks
    end

    should "have the 4 basic callbacks" do
      assert @tc.respond_to?(:call_before_bootstrap_callbacks)
      assert @tc.respond_to?(:call_after_bootstrap_callbacks)
      assert @tc.respond_to?(:call_before_configure_callbacks)
      assert @tc.respond_to?(:call_after_configure_callbacks)
    end
    should "have an addiitonal callback caller method" do
      assert @tc.respond_to?(:call_after_boxes_callbacks)
    end
    should "call the callback on the class when calling call_(\w+)_callbacks method" do
      assert_nil @tc.configured
      @tc.call_before_configure_callbacks
      assert @tc.configured
    end
    should "not explode when the method does not exist on the call_(\w+)_callbacks method" do
      lambda {@tc.call_after_boxes_callbacks}.should_not raise_error
    end
  end
  
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
auser-poolparty-1.1.6 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.1.7 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.0 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.1 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.10 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.11 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.12 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.2 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.3 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.4 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.7 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.8 test/poolparty/modules/callbacks_test.rb
auser-poolparty-1.2.9 test/poolparty/modules/callbacks_test.rb
fairchild-poolparty-1.2.12 test/poolparty/modules/callbacks_test.rb
poolparty-1.2.2 test/poolparty/modules/callbacks_test.rb