File: showing_differences.feature

package info (click to toggle)
cucumber 2.4.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,076 kB
  • sloc: ruby: 17,016; javascript: 4,641; makefile: 12; sh: 10; tcl: 3
file content (43 lines) | stat: -rw-r--r-- 1,434 bytes parent folder | download | duplicates (4)
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
Feature: Showing differences to expected output

  Cucumber will helpfully show you the expectation error that your
  testing library gives you, in the context of the failing scenario.
  When using RSpec, for example, this will show the difference between
  the expected and the actual output.

  Scenario: Run single failing scenario with default diff enabled
    Given a file named "features/failing_expectation.feature" with:
      """
      Feature: Failing expectation

        Scenario: Failing expectation
          Given failing expectation
      """
    And a file named "features/step_definitions/steps.rb" with:
      """
      Given /^failing expectation$/ do x=1
        expect('this').to eq 'that'
      end
      """
    When I run `cucumber -q features/failing_expectation.feature`
    Then it should fail with:
      """
      Feature: Failing expectation
      
        Scenario: Failing expectation
          Given failing expectation
            
            expected: "that"
                 got: "this"
            
            (compared using ==)
             (RSpec::Expectations::ExpectationNotMetError)
            ./features/step_definitions/steps.rb:2:in `/^failing expectation$/'
            features/failing_expectation.feature:4:in `Given failing expectation'

      Failing Scenarios:
      cucumber features/failing_expectation.feature:3

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