Sha256: fa9bb6cd7cf53fc0fe33fc8b185661178c2d32c09f4ffbc882bfa85714a3a178

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

Feature: Before Hook

  Scenario: Examine names of scenario and feature
    Given a file named "features/foo.feature" with:
      """
      Feature: Feature name

        Scenario: Scenario name
          Given a step
      """
    And a file named "features/support/hook.rb" with:
      """
      names = []
      Before do |scenario|
        expect(scenario).to_not respond_to(:scenario_outline)
        names << scenario.feature.name.split("\n").first
        names << scenario.name.split("\n").first
        if(names.size == 2)
          raise "NAMES:\n" + names.join("\n") + "\n"
        end
      end
      """
    When I run `cucumber`
    Then the output should contain:
      """
        NAMES:
        Feature name
        Scenario: Scenario name
      """

  Scenario: Examine names of scenario outline and feature
    Given a file named "features/foo.feature" with:
      """
      Feature: Feature name

        Scenario Outline: Scenario Outline name
          Given a <placeholder>

          Examples: Examples Table name
            | <placeholder> |
            | step          |
      """
    And a file named "features/support/hook.rb" with:
      """
      names = []
      Before do |scenario|
        names << scenario.scenario_outline.feature.name.split("\n").first
        names << scenario.scenario_outline.name.split("\n").first
        if(names.size == 2)
          raise "NAMES:\n" + names.join("\n") + "\n"
        end
      end
      """
    When I run `cucumber`
    Then the output should contain:
      """
            NAMES:
            Feature name
            Scenario Outline: Scenario Outline name
      """

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
cucumber-2.0.0.rc.4 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.rc.3 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.rc.2 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.rc.1 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.beta.5 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.beta.4 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.beta.3 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.beta.2 features/docs/writing_support_code/before_hook.feature
cucumber-2.0.0.beta.1 features/docs/writing_support_code/before_hook.feature