Skip to content
Browse files

Get tests pasing with latest versions of deps

  • Loading branch information...
1 parent 6574153 commit 0ae1e7cbe9b08d11071538c11230d93c9c73c07d @jstorimer jstorimer committed Jun 22, 2011
Showing with 21 additions and 15 deletions.
  1. +3 −1 test/delayed_paperclip_test.rb
  2. +3 −1 test/resque_paperclip_test.rb
  3. +15 −13 test/test_helper.rb
View
4 test/delayed_paperclip_test.rb
@@ -1,9 +1,11 @@
require 'test/test_helper'
-gem 'delayed_job'
require 'delayed_job'
+Delayed::Worker.backend = :active_record
class DelayedPaperclipTest < Test::Unit::TestCase
def setup
+ super
+
build_delayed_jobs
reset_dummy
end
View
4 test/resque_paperclip_test.rb
@@ -4,6 +4,8 @@
class ResquePaperclipTest < Test::Unit::TestCase
def setup
+ super
+
# Make sure that we just test Resque in here
Object.send(:remove_const, :Delayed) if defined? Delayed
@@ -50,4 +52,4 @@ def test_processing_column_kept_intact
assert @dummy.reload.image_processing?
end
-end
+end
View
28 test/test_helper.rb
@@ -1,23 +1,25 @@
-require 'test/unit'
require 'rubygems'
+require 'test/unit'
require 'mocha'
require 'active_record'
+require 'logger'
+require 'sqlite3'
+require 'paperclip/railtie'
+Paperclip::Railtie.insert
ROOT = File.join(File.dirname(__FILE__), '..')
RAILS_ROOT = ROOT
-RAILS_ENV = "test"
-
$LOAD_PATH << File.join(ROOT, 'lib')
-$LOAD_PATH << File.join(ROOT, 'lib', 'delayed', 'paperclip')
-$LOAD_PATH << File.join(ROOT, 'test')
-
-require File.join(ROOT, 'lib', 'delayed_paperclip.rb')
-require 'active_support'
-gem 'sqlite3-ruby'
+require 'delayed_paperclip'
-gem 'paperclip'
-require 'paperclip'
+class Test::Unit::TestCase
+ def setup
+ silence_warnings do
+ Object.const_set(:Rails, stub('Rails', :root => ROOT, :env => 'test'))
+ end
+ end
+end
FIXTURES_DIR = File.join(File.dirname(__FILE__), "fixtures")
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
@@ -29,7 +31,7 @@ def reset_dummy(with_processed = false)
reset_class "Dummy"
- @dummy = Dummy.new(:image => File.open("#{RAILS_ROOT}/test/fixtures/12k.png"))
+ @dummy = Dummy.new(:image => File.open("#{ROOT}/test/fixtures/12k.png"))
end
def reset_class class_name, include_process = true
@@ -65,4 +67,4 @@ def build_delayed_jobs
table.string :locked_by # Who is working on this object (if locked)
table.timestamps
end
-end
+end

0 comments on commit 0ae1e7c

Please sign in to comment.
Something went wrong with that request. Please try again.