Sha256: 3f3863decbb5a2b2a307c531601c38c77e48b8e437c48574af7b58cce465a7b7

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

module GlobalMacros
  def load_file(name)
    File.open("#{image_fixture_path}/#{name}")
  end

  def load_files(*names)
    names.map { |name| load_file(name) }
  end

  def image_fixture_path
    'spec/support/fixtures/images'
  end

  def file_count(path)
    Dir.entries(path).reject { |f| f =~ /\.\.$|\.$|\.gitkeep/ }.size
  end

  def process_latest_sidekiq_job
    job = Sidekiq::Queues["carrierwave"].pop
    worker_class = job['class']
    worker = worker_class.constantize.new

    if worker_class =~ /JobWrapper/
      worker.perform job['args'].first
    else
      worker.perform(*job['args'])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave_backgrounder-1.0.0.beta.2 spec/support/global_macros.rb