Sha256: 0be6a4a4fc6d234ede7143fb6a1154035a7f888301be40de844600b0d2c99621
Contents?: true
Size: 1.39 KB
Versions: 4
Compression:
Stored size: 1.39 KB
Contents
require 'test/test_helper' gem 'resque' require 'resque' class ResquePaperclipTest < Test::Unit::TestCase def setup # Make sure that we just test Resque in here Object.send(:remove_const, :Delayed) if defined? Delayed Resque.remove_queue(:paperclip) reset_dummy end def test_enqueue_job_if_source_changed @dummy.stubs(:image_changed?).returns(true) original_job_count = Resque.size(:paperclip) @dummy.enqueue_job_for_image assert_equal original_job_count + 1, Resque.size(:paperclip) end def test_perform_job Paperclip::Attachment.any_instance.expects(:reprocess!) @dummy.save! ResquePaperclipJob.perform(@dummy.class.name, @dummy.id, :image) end def test_after_callback_is_functional @dummy_class.send(:define_method, :done_processing) { puts 'done' } @dummy_class.after_image_post_process :done_processing Dummy.any_instance.expects(:done_processing) @dummy.save! ResquePaperclipJob.perform(@dummy.class.name, @dummy.id, :image) end def test_processing_column_kept_intact @dummy = reset_dummy(true) @dummy.stubs(:image_changed?).returns(true) Paperclip::Attachment.any_instance.stubs(:reprocess!).raises(StandardError.new('oops')) @dummy.save! assert @dummy.image_processing? worker = Resque::Worker.new(:paperclip) worker.process assert @dummy.reload.image_processing? end end
Version data entries
4 entries across 4 versions & 1 rubygems