Sha256: ec5673320828b4d65c87907cd9808deb7c34abac0e5a0a5cf649c6de48449a3b

Contents?: true

Size: 1.5 KB

Versions: 11

Compression:

Stored size: 1.5 KB

Contents

Feature: Listen for events

  Scenario: Step Matched Event
    Given a file named "features/test.feature" with:
      """
      Feature:
        Scenario:
          Given matching
      """
    And a file named "features/step_definitions/steps.rb" with:
      """
      Given(/matching/) do
      end
      """
    And a file named "features/support/my_listener.rb" with:
      """
      AfterConfiguration do |config|
        io = config.out_stream
        config.on_event Cucumber::Events::StepMatch do |event|
          io.puts "Success!"
          io.puts "Event type:      #{event.class}"
          io.puts "Step name:       #{event.test_step.name}"
          io.puts "Source location: #{event.step_match.location}"
        end
      end
      """
    When I run `cucumber`
    Then it should pass with:
      """
      Success!
      Event type:      Cucumber::Events::StepMatch
      Step name:       matching
      Source location: features/step_definitions/steps.rb:1
      """

  Scenario: After Test Step event
    Given a file named "features/test.feature" with:
      """
      Feature:
        Scenario:
          Given passing
      """
    And the standard step definitions
    And a file named "features/support/my_listener.rb" with:
      """
      AfterConfiguration do |config|
        io = config.out_stream
        config.on_event Cucumber::Events::AfterTestStep do |event|
          io.puts "YO"
        end
      end
      """
    When I run `cucumber`
    Then it should pass with:
      """
      YO
      """

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
cucumber-2.99.0 features/docs/api/listen_for_events.feature
mobiusloop-0.1.5 features/docs/api/listen_for_events.feature
cucumber-2.4.0 features/docs/api/listen_for_events.feature
mobiusloop-0.1.3 features/docs/api/listen_for_events.feature
mobiusloop-0.1.2 features/docs/api/listen_for_events.feature
cucumber-2.3.3 features/docs/api/listen_for_events.feature
cucumber-2.3.2 features/docs/api/listen_for_events.feature
cucumber-2.3.1 features/docs/api/listen_for_events.feature
cucumber-2.3.0 features/docs/api/listen_for_events.feature
cucumber-2.2.0 features/docs/api/listen_for_events.feature
cucumber-2.1.0 features/docs/api/listen_for_events.feature