-
Notifications
You must be signed in to change notification settings - Fork 14
/
invalid_step_flow.feature
85 lines (75 loc) · 1.89 KB
/
invalid_step_flow.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Feature: Invalid Step Flow
As a Business Analyst
I want to be warned about invalid step flow
so that all my tests make sense
Background: Prepare Testee
Given a file named "lint.rb" with:
"""
$LOAD_PATH << '../../lib'
require 'gherkin_lint'
linter = GherkinLint::GherkinLint.new
linter.enable %w(InvalidStepFlow)
linter.set_linter
linter.analyze 'lint.feature'
exit linter.report
"""
Scenario: Missing Action
Given a file named "lint.feature" with:
"""
Feature: Test
Scenario: A
Given setup
Then verify
"""
When I run `ruby lint.rb`
Then it should fail with exactly:
"""
InvalidStepFlow - Missing Action
lint.feature (4): Test.A step: verify
"""
Scenario: Setup After Action
Given a file named "lint.feature" with:
"""
Feature: Test
Scenario: A
When test
Given setup
Then verify
"""
When I run `ruby lint.rb`
Then it should fail with exactly:
"""
InvalidStepFlow - Given after Action or Verification
lint.feature (4): Test.A step: setup
"""
Scenario: Action As Last Step
Given a file named "lint.feature" with:
"""
Feature: Test
Scenario: A
Given setup
When test
Then verify
When test
"""
When I run `ruby lint.rb`
Then it should fail with exactly:
"""
InvalidStepFlow - Last step is an action
lint.feature (6): Test.A step: test
"""
Scenario: Valid Example
Given a file named "lint.feature" with:
"""
Feature: Test
Scenario: A
Given setup
When test
Then verification
When test
Then verification
"""
When I run `ruby lint.rb`
Then it should pass with exactly:
"""
"""