Sha256: 83a8cc2d7badb562702fc29b42c40b7721b5508bf52ad259bc78880e07dd6cb1

Contents?: true

Size: 983 Bytes

Versions: 96

Compression:

Stored size: 983 Bytes

Contents

require 'spec_helper'

class DummyNotificationPlugin < Killbill::Plugin::Notification
end

class HoarderNotificationPlugin < Killbill::Plugin::Notification
  attr_reader :events

  def start_plugin
    @events = []
    super
  end

  def on_event(event)
    @events << event
  end

  def stop_plugin
    super
    @events = []
  end
end

describe Killbill::Plugin::Notification do
  before(:each) do
    @event = Hash.new(:account_id => SecureRandom.uuid)
  end

  it "should not raise exceptions by default" do
    plugin = DummyNotificationPlugin.new
    lambda { plugin.on_event(@event) }.should_not raise_error
  end

  it "should be able to receive all events" do
    plugin = HoarderNotificationPlugin.new

    plugin.start_plugin
    plugin.events.size.should == 0

    (1..100).each do |i|
      plugin.on_event(@event)
      plugin.events.size.should == i
      plugin.events[-1].should == @event
    end

    plugin.stop_plugin
    plugin.events.size.should == 0
  end
end

Version data entries

96 entries across 96 versions & 1 rubygems

Version Path
killbill-9.4.1 spec/killbill/notification_plugin_spec.rb
killbill-8.3.6 spec/killbill/notification_plugin_spec.rb
killbill-9.4.0 spec/killbill/notification_plugin_spec.rb
killbill-9.3.2 spec/killbill/notification_plugin_spec.rb
killbill-9.3.1 spec/killbill/notification_plugin_spec.rb
killbill-8.3.5 spec/killbill/notification_plugin_spec.rb
killbill-9.3.0 spec/killbill/notification_plugin_spec.rb
killbill-9.2.2 spec/killbill/notification_plugin_spec.rb
killbill-8.3.4 spec/killbill/notification_plugin_spec.rb
killbill-8.3.3 spec/killbill/notification_plugin_spec.rb
killbill-9.2.1 spec/killbill/notification_plugin_spec.rb
killbill-9.2.0 spec/killbill/notification_plugin_spec.rb
killbill-8.3.2 spec/killbill/notification_plugin_spec.rb
killbill-8.3.1 spec/killbill/notification_plugin_spec.rb
killbill-8.3.0 spec/killbill/notification_plugin_spec.rb
killbill-8.2.0 spec/killbill/notification_plugin_spec.rb
killbill-8.1.0 spec/killbill/notification_plugin_spec.rb
killbill-7.0.6 spec/killbill/notification_plugin_spec.rb
killbill-8.0.1 spec/killbill/notification_plugin_spec.rb
killbill-8.0.0 spec/killbill/notification_plugin_spec.rb