Sha256: 514ea6c0e1b9142fa60e6b1521983470d46e2c645c9bc2f5f46792c92ec6d269

Contents?: true

Size: 957 Bytes

Versions: 9

Compression:

Stored size: 957 Bytes

Contents

require 'codeclimate-test-reporter'
CodeClimate::TestReporter.start

require 'bundler/setup'
Bundler.setup

require 'rails'
require 'active_record'
require 'timecop'
require 'sidekiq'
require 'rspec-sidekiq'

require 'delayed_cron/railtie'
DelayedCron::Railtie.insert


RSpec.configure do |config|

end

def setup(options)
  DelayedCron.setup do |config|
    config.default_interval = options[:default_interval]
    config.cron_jobs = options[:cron_jobs] || []
  end
end

def build_class(class_name, name, options = {})
  # setup class and include delayed_cron

  ActiveRecord::Base.send(:include, DelayedCron::Glue)
  Object.send(:remove_const, class_name) rescue nil

  # Set class as a constant
  klass = Object.const_set(class_name, Class.new(ActiveRecord::Base))

  # Setup class with paperclip and delayed paperclip
  klass.class_eval do
    include DelayedCron::Glue

    cron_job name, options

    def self.test_method
    end

  end
  
  klass
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
delayed_cron-0.2.8 spec/spec_helper.rb
delayed_cron-0.2.7 spec/spec_helper.rb
delayed_cron-0.2.6 spec/spec_helper.rb
delayed_cron-0.2.5 spec/spec_helper.rb
delayed_cron-0.2.4 spec/spec_helper.rb
delayed_cron-0.2.3 spec/spec_helper.rb
delayed_cron-0.2.2 spec/spec_helper.rb
delayed_cron-0.2.1 spec/spec_helper.rb
delayed_cron-0.2.0 spec/spec_helper.rb