Basic tests for the trace jobs
[rails.git] / test / jobs / trace_destroyer_job_test.rb
index 0c62716a0d294d831e005c10022ad6a2b47ccfe6..ed86a161669941ac0acf6700ca94b82216352ddb 100644 (file)
@@ -1,7 +1,18 @@
-require 'test_helper'
+require "test_helper"
+require "minitest/mock"
 
 class TraceDestroyerJobTest < ActiveJob::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+  def test_destroy_called
+    trace = Minitest::Mock.new
+
+    # Tiny little bit of mocking to make activejob happy
+    trace.expect :is_a?, false, [TraceDestroyerJob]
+
+    # Check that trace.destroy is called
+    trace.expect :destroy, true
+
+    TraceDestroyerJob.perform_now(trace)
+
+    assert_mock trace
+  end
 end