Sha256: 327de451bafa4f0a48f095362436cf115793a060ff29630f01c6109180df2ba2

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

require 'bundler' ; Bundler.require :development, :test
require 'subexec-notifications'
require 'minitest/spec'
require 'minitest/mock'
require 'minitest/autorun'

class Subexec
  module Notifications
    class TestCase < MiniTest::Spec

      let(:callback)  { lambda { |*args| event(*args) } }

      after do
        clear_event!
      end


      private

      def subscribed(name="subexec.run")
        subscriber = ActiveSupport::Notifications.subscribe(name, &callback)
        yield
      ensure
        ActiveSupport::Notifications.unsubscribe(subscriber)
      end

      def event(*args)
        @event ||= ActiveSupport::Notifications::Event.new(*args)
      end

      def clear_event!
        @event = nil
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
subexec-notifications-1.0.0 test/test_helper.rb