-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathshowing_differences.feature
43 lines (35 loc) · 1.39 KB
/
showing_differences.feature
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 `failing expectation'
Failing Scenarios:
cucumber features/failing_expectation.feature:3
1 scenario (1 failed)
1 step (1 failed)
"""