test/devise/async/model_test.rb in devise-async-0.6.0 vs test/devise/async/model_test.rb in devise-async-0.7.0
- old
+ new
@@ -34,8 +34,21 @@
admin.send(:devise_pending_notifications).must_equal [[:confirmation_instructions, {}]]
admin.save
Worker.expects(:enqueue).with(:confirmation_instructions, "Admin", admin.id.to_s, {})
end
end
+
+ it "should not enqueue a job if the enabled config option is set to false" do
+ Devise::Async.stubs(:enabled).returns(false)
+
+ # Stubbing the devise's confirmation_instructions
+ confirmation_email = Object.new
+ Devise::Mailer.stubs(:confirmation_instructions).returns(confirmation_email)
+ confirmation_email.stubs(:deliver).returns(true) # Stubbing the email sending process
+
+ admin = create_admin
+ admin.send(:devise_pending_notifications).must_equal []
+ Worker.expects(:enqueue).never
+ end
end
end
end