Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* gracefully handling gems that do not load

  • Loading branch information...
commit dd81b034e92ccbcf2082b7bbda2a5cbc472d27cc 1 parent a31f907
@lpetre lpetre authored
View
4 Rakefile
@@ -18,7 +18,7 @@ Jeweler::Tasks.new do |s|
s.rdoc_options = ["--main", "README.textile", "--inline-source", "--line-numbers"]
s.extra_rdoc_files = ["README.textile"]
- s.test_files = Dir['spec/**/*']
+ s.test_files = Dir['spec/*_spec.rb']
s.add_dependency "daemons"
s.add_development_dependency "rspec"
@@ -38,7 +38,7 @@ task :default => :spec
desc 'Run the specs'
Spec::Rake::SpecTask.new(:spec) do |t|
t.libs << 'lib'
- t.pattern = 'spec/**/*_spec.rb'
+ t.pattern = 'spec/*_spec.rb'
t.verbose = true
end
task :spec => :check_dependencies
View
13 spec/backend/active_record_job_spec.rb
@@ -2,13 +2,13 @@
require 'backend/shared_backend_spec'
require 'delayed/backend/active_record'
-describe Delayed::Job do
+describe Delayed::Backend::ActiveRecord::Job do
before(:all) do
- @backend = Delayed::Job
+ @backend = Delayed::Backend::ActiveRecord::Job
end
before(:each) do
- Delayed::Job.delete_all
+ Delayed::Backend::ActiveRecord::Job.delete_all
SimpleJob.runs = 0
end
@@ -27,14 +27,13 @@
it "should return UTC time if that is the AR default" do
Time.zone = nil
ActiveRecord::Base.default_timezone = :utc
- Delayed::Job.db_time_now.zone.should == 'UTC'
+ Delayed::Backend::ActiveRecord::Job.db_time_now.zone.should == 'UTC'
end
it "should return local time if that is the AR default" do
Time.zone = 'Central Time (US & Canada)'
ActiveRecord::Base.default_timezone = :local
- %w(CST CDT).should include(Delayed::Job.db_time_now.zone)
+ %w(CST CDT).should include(Delayed::Backend::ActiveRecord::Job.db_time_now.zone)
end
- end
-
+ end
end
View
0  spec/backend/datamapper_job_spec.rb → spec/backend/data_mapper_job_spec.rb
File renamed without changes
View
2  spec/setup/data_mapper.rb
@@ -3,4 +3,4 @@
DataMapper.logger = Delayed::Worker.logger
DataMapper.setup(:default, "sqlite3::memory:")
-DataMapper.auto_migrate!
+DataMapper.auto_migrate!
View
2  spec/setup/mongo_mapper.rb
@@ -9,7 +9,7 @@ class Story
def tell; text; end
def whatever(n, _); tell*n; end
def self.count; end
-
+
handle_asynchronously :whatever
end
end
View
18 spec/spec_helper.rb
@@ -6,16 +6,20 @@
require 'delayed_job'
require 'sample_jobs'
-require 'database_cleaner'
Delayed::Worker.logger = Logger.new('/tmp/dj.log')
-BACKENDS = [:active_record, :mongo_mapper, :data_mapper]
-
-BACKENDS.each do |backend|
- require "setup/#{backend}"
+# determine the available backends
+BACKENDS = []
+Dir.glob("#{File.dirname(__FILE__)}/setup/*.rb") do |backend|
+ begin
+ backend = File.basename(backend, '.rb')
+ require "setup/#{backend}"
+ require "backend/#{backend}_job_spec"
+ BACKENDS << backend.to_sym
+ rescue LoadError
+ puts "Unable to load #{backend} backend! #{$!}"
+ end
end
Delayed::Worker.backend = BACKENDS.first
-DatabaseCleaner.orm = BACKENDS.first.to_s
-DatabaseCleaner.strategy = :truncation
Please sign in to comment.
Something went wrong with that request. Please try again.