Sha256: d094295da46a5f471477912662140921b4075c1d152c20d24738363c828dd6b6
Contents?: true
Size: 1.76 KB
Versions: 5
Compression:
Stored size: 1.76 KB
Contents
require 'test_helper' require 'base_delayed_paperclip_test' require 'delayed_job' Delayed::Worker.backend = :active_record class DelayedPaperclipTest < Test::Unit::TestCase include BaseDelayedPaperclipTest def setup super DelayedPaperclip.options[:background_job_class] = DelayedPaperclip::Jobs::DelayedJob build_delayed_jobs end def process_jobs Delayed::Worker.new.work_off end def jobs_count Delayed::Job.count end def test_perform_job dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png")) dummy.image = File.open("#{RAILS_ROOT}/test/fixtures/12k.png") Paperclip::Attachment.any_instance.expects(:reprocess!) dummy.save! Delayed::Job.last.payload_object.perform end def build_delayed_jobs ActiveRecord::Base.connection.create_table :delayed_jobs, :force => true do |table| table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually. table.text :handler # YAML-encoded string of the object that will do work table.string :last_error # reason for last failure (See Note below) table.datetime :run_at # When to run. Could be Time.now for immediately, or sometime in the future. table.datetime :locked_at # Set when a client is working on this object table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) table.string :locked_by # Who is working on this object (if locked) table.string :queue table.timestamps end end end
Version data entries
5 entries across 5 versions & 1 rubygems