spec/backgrounder/orm/base_spec.rb in carrierwave_backgrounder-0.1.2 vs spec/backgrounder/orm/base_spec.rb in carrierwave_backgrounder-0.1.3

- old
+ new

@@ -10,94 +10,65 @@ @mock_class.extend CarrierWave::Backgrounder::ORM::Base end it 'mixes in the two DSL methods' do - @mock_class.should respond_to(:process_in_background) - @mock_class.should respond_to(:store_in_background) + expect(@mock_class).to respond_to(:process_in_background) + expect(@mock_class).to respond_to(:store_in_background) end - describe 'process in background' do - - describe 'setting up callbacks' do - - it 'creates a before_save hook' do - @mock_class.expects(:before_save).with(:set_avatar_processing, :if => :trigger_avatar_background_processing?) - @mock_class.process_in_background :avatar - end - - it 'creates an after_save hook' do - @mock_class.expects(:after_commit).with(:enqueue_avatar_background_job, :if => :trigger_avatar_background_processing?) - @mock_class.process_in_background :avatar - end - - end - - describe 'including new methods' do + describe '.process_in_background' do + context 'including new methods' do before do @mock_class.process_in_background :avatar @instance = @mock_class.new end it 'creates a processing enabled accessor' do - @instance.should respond_to(:process_avatar_upload) - @instance.should respond_to(:process_avatar_upload=) + expect(@instance).to respond_to(:process_avatar_upload) + expect(@instance).to respond_to(:process_avatar_upload=) end it 'create a setter for the processing attribute' do - @instance.should respond_to(:set_avatar_processing) + expect(@instance).to respond_to(:set_avatar_processing) end it 'create a background job queuer' do - @instance.should respond_to(:enqueue_avatar_background_job) + expect(@instance).to respond_to(:enqueue_avatar_background_job) end it 'create a trigger interrogator' do - @instance.should respond_to(:trigger_avatar_background_processing?) + expect(@instance).to respond_to(:enqueue_avatar_background_job?) end - end - end describe 'store in background' do - - describe 'setting up callbacks' do - - it 'creates an after_save hook' do - @mock_class.expects(:after_commit).with(:enqueue_avatar_background_job, :if => :trigger_avatar_background_storage?) - @mock_class.store_in_background :avatar - end - - end - describe 'including new methods' do before do @mock_class.store_in_background :avatar @instance = @mock_class.new end it 'creates a processing enabled accessor' do - @instance.should respond_to(:process_avatar_upload) - @instance.should respond_to(:process_avatar_upload=) + expect(@instance).to respond_to(:process_avatar_upload) + expect(@instance).to respond_to(:process_avatar_upload=) end it 'overrides the write column identifier method from carrierwave' do - @instance.should respond_to(:write_avatar_identifier) + expect(@instance).to respond_to(:write_avatar_identifier) end it 'overrides the store column method from carrierwave' do - @instance.should respond_to(:store_avatar!) + expect(@instance).to respond_to(:store_avatar!) end it 'create a background job queuer' do - @instance.should respond_to(:enqueue_avatar_background_job) + expect(@instance).to respond_to(:enqueue_avatar_background_job) end it 'create a trigger interrogator' do - @instance.should respond_to(:trigger_avatar_background_storage?) + expect(@instance).to respond_to(:enqueue_avatar_background_job?) end - end end - end