diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..a0891f5 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.3.4 diff --git a/spec/non_rails/uber_task/task_skipped_on_error_spec.rb b/spec/non_rails/uber_task/task_skipped_on_error_spec.rb new file mode 100644 index 0000000..fd86895 --- /dev/null +++ b/spec/non_rails/uber_task/task_skipped_on_error_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +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