Sha256: 5af82daaf773d997e80c84d70ebe9f0c2daa8cebac4f821604cd2bacff19abb8
Contents?: true
Size: 972 Bytes
Versions: 2
Compression:
Stored size: 972 Bytes
Contents
module ActiveDelivery module TestDelivery class << self def enable raise ArgumentError, "block is reauired" unless block_given? begin clear Thread.current[:active_delivery_testing] = true yield ensure Thread.current[:active_delivery_testing] = false end end def enabled? Thread.current[:active_delivery_testing] == true end def track(delivery, event, args, options) store << [delivery, event, args, options] end def store @store ||= [] end def clear store.clear end end def notify(event, *args, **options) return super unless test? TestDelivery.track(self, event, args, options) nil end def test? TestDelivery.enabled? end end end ActiveDelivery::Base.prepend ActiveDelivery::TestDelivery require "active_delivery/testing/rspec" if defined?(RSpec)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
active_delivery-0.1.1 | lib/active_delivery/testing.rb |
active_delivery-0.1.0 | lib/active_delivery/testing.rb |