Sha256: 653ea6d000b6d8844eb8aac867151af0f9a771f4a3557323656c056c373546ee

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'rubygems'
require 'bundler/setup'
require 'rspec'
require 'logger'

require 'delayed_job_active_record'
require 'delayed/backend/shared_spec'

Delayed::Worker.logger = Logger.new('/tmp/dj.log')
ENV['RAILS_ENV'] = 'test'

config = YAML.load(File.read('spec/database.yml'))
ActiveRecord::Base.establish_connection config['sqlite']
ActiveRecord::Base.logger = Delayed::Worker.logger
ActiveRecord::Migration.verbose = false

ActiveRecord::Schema.define do
  create_table :delayed_jobs, :force => true do |table|
    table.integer  :priority, :default => 0
    table.integer  :attempts, :default => 0
    table.text     :handler
    table.text     :last_error
    table.datetime :run_at
    table.datetime :locked_at
    table.datetime :failed_at
    table.string   :locked_by
    table.string   :queue
    table.timestamps
  end

  add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'

  create_table :stories, :primary_key => :story_id, :force => true do |table|
    table.string :text
    table.boolean :scoped, :default => true
  end
end

# Purely useful for test cases...
class Story < ActiveRecord::Base
  set_primary_key :story_id
  def tell; text; end
  def whatever(n, _); tell*n; end
  default_scope where(:scoped => true)

  handle_asynchronously :whatever
end

# Add this directory so the ActiveSupport autoloading works
ActiveSupport::Dependencies.autoload_paths << File.dirname(__FILE__)

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
raj_delayed_job_active_record-0.0.4 spec/spec_helper.rb
raj_delayed_job_active_record-0.0.3 spec/spec_helper.rb
delayed_job_active_record-0.3.3 spec/spec_helper.rb
drewda_delayed_job_active_record-0.3.2 spec/spec_helper.rb
delayed_job_active_record-0.3.2 spec/spec_helper.rb
delayed_job_active_record-0.3.1 spec/spec_helper.rb
delayed_job_active_record-0.3.0 spec/spec_helper.rb