Sha256: 8952b11873b17e0b9bd3397ede771ac5122062ca8192608a086ea47c7986aa36

Contents?: true

Size: 847 Bytes

Versions: 1

Compression:

Stored size: 847 Bytes

Contents

# order: 70
Feature: Operation wrappers
:!hardbreaks:
It is possible to define global wrappers on the Operation level using `around` call.

  Scenario: Operation can have multiple global wrappers
  Wrappers are called in the order they are defined.
    Given definition
    """ruby
    class Operation < Rung::Operation
      class Wrapper
        def initialize(name)
          @name = name
        end

        def call
          print_to_output "#{@name} start\n"
          yield
          print_to_output "#{@name} done\n"
        end
      end

      around Wrapper.new("1")
      around Wrapper.new("2")

      step { print_to_output "Hello World!\n" }
    end
    """
    When I run
    """
    Operation.new.call(variable: true)
    """
    Then I see output
    """
    1 start
    2 start
    Hello World!
    2 done
    1 done

    """

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rung-0.1 features/070_operation_wrappers.feature