Sha256: d9d9328c3909360543fd9fbfd7d4b35077a6ccd985e3e81f71121caa2a654a37

Contents?: true

Size: 1.64 KB

Versions: 3

Compression:

Stored size: 1.64 KB

Contents

@spawn
Feature: List step defs as json

  In order to build tools on top of Cucumber
  As a tool developer
  I want to be able to query a features directory for all the step definitions it contains

  Background:
    Given a directory named "features"

  @todo-windows
  Scenario: Two Ruby step definitions, in the same file
    Given a file named "features/step_definitions/steps.rb" with:
      """
      Given(/foo/i)  { }
      Given(/b.r/xm) { }
      """
    When I run the following Ruby code:
      """
      require 'cucumber'
      puts Cucumber::StepDefinitions.new.to_json

      """
    Then it should pass with JSON:
      """
      [
        {
          "source": {"expression": "foo", "type": "regular expression"},
          "regexp": {"source": "foo", "flags": "i"}
        },
        {
          "source": {"expression": "b.r", "type": "regular expression"},
          "regexp": {"source": "b.r", "flags": "mx"}
        }
      ]
      """

  @todo-windows
  Scenario: Non-default directory structure
    Given a file named "my_weird/place/steps.rb" with:
      """
      Given(/foo/)  { }
      Given(/b.r/x) { }
      """
    When I run the following Ruby code:
      """
      require 'cucumber'
      puts Cucumber::StepDefinitions.new(:autoload_code_paths => ['my_weird']).to_json

      """
    Then it should pass with JSON:
      """
      [
        {
          "source": {"expression": "foo", "type": "regular expression"},
          "regexp": {"source": "foo", "flags": ""}
        },
        {
          "source": {"expression": "b.r", "type": "regular expression"},
          "regexp": {"source": "b.r", "flags": "x"}
        }
      ]

      """

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cucumber-3.0.1 features/docs/api/list_step_defs_as_json.feature
cucumber-3.0.0 features/docs/api/list_step_defs_as_json.feature
cucumber-3.0.0.pre.2 features/docs/api/list_step_defs_as_json.feature