Skip to content

Commit

Permalink
Rspec for SkipTask
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrinlopes committed Jul 31, 2024
1 parent ae3fdc8 commit 4056859
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec/non_rails/uber_task/task_skipped_on_error_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
describe UberTask::SkipTask do
it 'Skips the task on a error' do
task_skipped_after_exception = false

UberTask.run do
UberTask.on_subtask_error do |_task, _event, err|
if err.message == 'Some error'
task_skipped_after_exception = true
UberTask.skip(reason: err)
end
end

UberTask.run do
raise 'Some error' if task_skipped_after_exception == false
end
end

expect(task_skipped_after_exception).to be(true)
end
end

0 comments on commit 4056859

Please sign in to comment.