File: table_diffing.feature

package info (click to toggle)
cucumber 1.3.17-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,296 kB
  • ctags: 1,812
  • sloc: ruby: 13,576; python: 28; sh: 10; makefile: 10; tcl: 3
file content (45 lines) | stat: -rw-r--r-- 1,412 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Feature: Table diffing
  In order to more easily compare data in tables
  step definition writers should be able to diff
  a table with expected data and see the diff inline
  
  Scenario: Extra row
    Given a standard Cucumber project directory structure
    And a file named "features/tables.feature" with:
      """
      Feature: Tables
        Scenario: Extra row
          Then the table should be:
            | x | y |
            | a | b |
      """
    And a file named "features/step_definitions/table_steps.rb" with:
      """
      Then /the table should be:/ do |expected| x=1
        expected.diff!(table(%{
          | x | y | 
          | a | c |
        }))
      end
      """
    When I run cucumber -i features/tables.feature
    Then it should fail with
      """
      Feature: Tables
      
        Scenario: Extra row         # features/tables.feature:2
          Then the table should be: # features/step_definitions/table_steps.rb:1
            | x | y |
            | a | b |
            | a | c |
            Tables were not identical (Cucumber::Ast::Table::Different)
            ./features/step_definitions/table_steps.rb:2:in `/the table should be:/'
            features/tables.feature:3:in `Then the table should be:'
      
      Failing Scenarios:
      cucumber features/tables.feature:2 # Scenario: Extra row

      1 scenario (1 failed)
      1 step (1 failed)

      """