dotnetprofessional / LiveDoc

A Living Documentation platform for BDD (Gherkin) specifications.
MIT License
9 stars 2 forks source link

Support transpose for tables #1

Closed dotnetprofessional closed 7 years ago

dotnetprofessional commented 7 years ago

Feature

Given the following Feature:

Feature: LiveDoc can transpose a Gherkin table.
  This an example of a simple price list.

  Scenario: A price list can be represented as price per item
    Given the price list for a coffee shop
      | coffee | 1 |
      | donut  | 2 |
    When I order 1 coffee and 1 donut
    Then should I pay 3

Using stepContext.coffee would result in a value of donut not 1. Using transpose, it would tell the library to make the first column headers. This should only work for two column tables.

Proposal

Adding a transposeTable to the setContext variable would return the table in a transposed manner.

   stepContext.tableToEntity.coffee.should.be.equal("1");