Skip to content

Commit 4fb5b9c

Browse files
committed
Fix up tests
1 parent 5331d7b commit 4fb5b9c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/models/solid_queue/claimed_execution_test.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ class SolidQueue::ClaimedExecutionTest < ActiveSupport::TestCase
2222
job = claimed_execution.job
2323

2424
assert_difference -> { SolidQueue::ClaimedExecution.count } => -1, -> { SolidQueue::FailedExecution.count } => 1 do
25-
claimed_execution.perform
25+
assert_raises RuntimeError do
26+
claimed_execution.perform
27+
end
2628
end
2729

2830
assert_not job.reload.finished?
@@ -37,10 +39,12 @@ class SolidQueue::ClaimedExecutionTest < ActiveSupport::TestCase
3739
test "job failures are reported via Rails error subscriber" do
3840
subscriber = ErrorBuffer.new
3941

40-
with_error_subscriber(subscriber) do
41-
claimed_execution = prepare_and_claim_job RaisingJob.perform_later(RuntimeError, "B")
42+
assert_raises RuntimeError do
43+
with_error_subscriber(subscriber) do
44+
claimed_execution = prepare_and_claim_job RaisingJob.perform_later(RuntimeError, "B")
4245

43-
claimed_execution.perform
46+
claimed_execution.perform
47+
end
4448
end
4549

4650
assert_equal 1, subscriber.errors.count
@@ -61,9 +65,10 @@ class SolidQueue::ClaimedExecutionTest < ActiveSupport::TestCase
6165
test "fail with error" do
6266
claimed_execution = prepare_and_claim_job AddToBufferJob.perform_later(42)
6367
job = claimed_execution.job
64-
6568
assert_difference -> { SolidQueue::ClaimedExecution.count } => -1, -> { SolidQueue::FailedExecution.count } => 1 do
66-
claimed_execution.failed_with(RuntimeError.new)
69+
assert_raises RuntimeError do
70+
claimed_execution.failed_with(RuntimeError.new)
71+
end
6772
end
6873

6974
assert job.reload.failed?

0 commit comments

Comments
 (0)