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-2.0.0 spec/killbill/notification_plugin_spec.rb
killbill-1.9.0 spec/killbill/notification_plugin_spec.rb
killbill-1.8.4 spec/killbill/notification_plugin_spec.rb
killbill-1.8.3 spec/killbill/notification_plugin_spec.rb
killbill-1.8.2 spec/killbill/notification_plugin_spec.rb
killbill-1.8.1 spec/killbill/notification_plugin_spec.rb
killbill-1.8.0 spec/killbill/notification_plugin_spec.rb
killbill-1.7.1 spec/killbill/notification_plugin_spec.rb
killbill-1.7.0 spec/killbill/notification_plugin_spec.rb
killbill-1.6.0 spec/killbill/notification_plugin_spec.rb
killbill-1.5.0 spec/killbill/notification_plugin_spec.rb
killbill-1.4.0 spec/killbill/notification_plugin_spec.rb
killbill-1.3.0 spec/killbill/notification_plugin_spec.rb
killbill-1.2.0 spec/killbill/notification_plugin_spec.rb
killbill-1.1.2 spec/killbill/notification_plugin_spec.rb
killbill-1.1.1 spec/killbill/notification_plugin_spec.rb
killbill-1.0.19 spec/killbill/notification_plugin_spec.rb
killbill-1.0.18 spec/killbill/notification_plugin_spec.rb
killbill-1.0.17 spec/killbill/notification_plugin_spec.rb
killbill-1.0.16 spec/killbill/notification_plugin_spec.rb