Sha256: c9cff37826053879089be7e118c7cab0fc2b537a34c2b531d31341e5f37ab173

Contents?: true

Size: 1.31 KB

Versions: 1

Compression:

Stored size: 1.31 KB

Contents

# order: 51
Feature: Fail fast
:!hardbreaks:
When a fail-fast step is executed and the operation is a failure then
no next step is executed, including `always` and `failure` steps.

It doesn't matter if a failure is caused by the fail-fast step itself or if it
was caused by any previous step, it behaves the same way.

  Scenario: When step with `fail_fast` fails the execution is immediately stopped
    Given definition
    """ruby
    class Operation < Rung::Operation
      step(fail_fast: true) do
        print_to_output "Hello"
        false
      end

      step do
        print_to_output " World!"
      end
    end
    """
    When I run
    """
    @result = Operation.new.call
    """
    Then I see output
    """
    Hello
    """
    And I can assure that
    """
    @result.failure?
    """

  Scenario: Any kind of step can use `fail_fast`
    Given definition
    """ruby
    class Operation < Rung::Operation
      step do
        print_to_output "Hello"
        false
      end

      failure fail_fast: true do
        print_to_output "...Goodbye!"
      end

      step do
        print_to_output " World!"
      end
    end
    """
    When I run
    """
    @result = Operation.new.call
    """
    Then I see output
    """
    Hello...Goodbye!
    """
    And I can assure that
    """
    @result.failure?
    """

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rung-0.1 features/051_fail_fast.feature