test/project_hierarchy_test_helper.rb
def sync_delayed_jobs delayed_job_classes=[]
    eval <<-END_EVAL
        class << Delayed::Job
              alias_method :enqueue_not_perform, :enqueue
              def enqueue(*args)
                   obj ||= args.shift
                  obj.perform if #{delayed_job_classes}.detect{|job_class| obj.is_a? job_class}
              end
          end
    END_EVAL
  end
#perform delayed jobs when they are created for easy test
perform delayed jobs when they are created for easy test
perform delayed jobs when they are created for easy test
def sync_delayed_jobs delayed_job_classes=[]
    eval <<-END_EVAL
        class << Delayed::Job
              alias_method :enqueue_not_perform, :enqueue
              def enqueue(*args)
                   obj ||= args.shift
                  obj.perform if #{delayed_job_classes}.detect{|job_class| obj.is_a? job_class}
              end
          end
    END_EVAL
  end
def sync_delayed_jobs delayed_job_classes = [ ] eval <<-END_EVAL 
        class << Delayed::Job
              alias_method :enqueue_not_perform, :enqueue
              def enqueue(*args)
                   obj ||= args.shift
                  obj.perform if  #{ delayed_job_classes } .detect{|job_class| obj.is_a? job_class}
              end
          end
     END_EVAL end
perform delayed jobs when they are created for easy test
perform delayed jobs when they are created for easy test
delayed_job_classes