Sha256: 03df6bd96990bd13a3b94766569492bf8b9213e38f89d3555c298d4805be30b0

Contents?: true

Size: 688 Bytes

Versions: 10

Compression:

Stored size: 688 Bytes

Contents

require 'sucker_punch'

# Include this in your tests to simulate
# immediate execution of your asynchronous jobs
#
# class LogJob
#   include SuckerPunch::Job
#
#   def perform(*args)
#     # log the things
#   end
# end
#
# To trigger asynchronous job:
#
#   LogJob.perform_async(1, 2, 3)
#
# Include inline testing lib:
#
# require 'sucker_punch/testing/inline"
#
# LogJob.perform_async(1, 2, 3) is now synchronous
# LogJob.perform_in(1, 2, 3) is now synchronous
#
module SuckerPunch
  module Job
    module ClassMethods
      def perform_async(*args)
        self.new.perform(*args)
      end

      def perform_in(_, *args)
        self.new.perform(*args)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
sucker_punch-2.1.2 lib/sucker_punch/testing/inline.rb
sucker_punch-2.1.1 lib/sucker_punch/testing/inline.rb
sucker_punch-2.1.0 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.4 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.3 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.2 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.1 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.0 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.0.beta2 lib/sucker_punch/testing/inline.rb
sucker_punch-2.0.0.beta1 lib/sucker_punch/testing/inline.rb