Sha256: 51468de55288d373426a9d84ea831952f0a23765e0b7fe17df532ac81e2c9bbf

Contents?: true

Size: 1.05 KB

Versions: 16

Compression:

Stored size: 1.05 KB

Contents

module EmailSpec
  module BackgroundProcesses
    module DelayedJob
      def all_emails
        work_off_queue
        super
      end

      def last_email_sent
        work_off_queue
        super
      end

      def reset_mailer
        work_off_queue
        super
      end

      def mailbox_for(address)
        work_off_queue
        super
      end

      private

      # Later versions of DelayedJob switch from using Delayed::Job to Delayed::Worker
      # Support both versions for those who haven't upgraded yet
      def work_off_queue
        if Delayed::Worker.instance_methods.detect{|iv| iv.to_s == "work_off" }
          Delayed::Worker.send :public, :work_off
          worker = Delayed::Worker.new(:max_priority => nil, :min_priority => nil, :quiet => true)
          worker.work_off
        else
          Delayed::Job.work_off
        end
      end
    end

    module Compatibility
      if defined?(Delayed) && (defined?(Delayed::Job) || defined?(Delayed::Worker))
        include EmailSpec::BackgroundProcesses::DelayedJob
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/email_spec-1.6.0/lib/email_spec/background_processes.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/email_spec-1.6.0/lib/email_spec/background_processes.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/email_spec-1.6.0/lib/email_spec/background_processes.rb
email_spec-1.6.0 lib/email_spec/background_processes.rb
email_spec-1.5.0 lib/email_spec/background_processes.rb
email_spec-1.4.0 lib/email_spec/background_processes.rb
gardelea-email_spec-1.3.0 lib/email_spec/background_processes.rb
email_spec-1.0.1 lib/email_spec/background_processes.rb
email_spec-1.2.1 lib/email_spec/background_processes.rb
email_spec-1.2.0 lib/email_spec/background_processes.rb
email_spec-0.6.6 lib/email_spec/background_processes.rb
email_spec-0.6.5 lib/email_spec/background_processes.rb
email_spec-1.1.1 lib/email_spec/background_processes.rb
email_spec-0.6.4 lib/email_spec/background_processes.rb
email_spec-tricycle-0.6.3 lib/email_spec/background_processes.rb
email_spec-0.6.3 lib/email_spec/background_processes.rb