gherkin_language 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Rakefile +11 -1
- data/features/correct.feature +40 -0
- data/features/glossary.feature +42 -0
- data/features/report.feature +2 -2
- data/features/sentences.feature +55 -55
- data/features/tag.feature +2 -4
- data/gherkin_language.gemspec +2 -2
- data/lib/gherkin_language.rb +2 -2
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df497ba41442ba3e1383ea34dc77b22426c944c4
|
4
|
+
data.tar.gz: 71863c28b770c160a5b4305fe49464301322a699
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99d3b6e7c5b529424aeb7fb686305453626db0a1440304dc1fad6309cb28185627f6c79d3049f749f32d518e272cbb98f59fb9369a27fbc9f8c4218ca4f4295c
|
7
|
+
data.tar.gz: 182cb1b7d69f7b0d7141535da8fd12f3b6c224e0041a8f32f3d7f1d0e326c18f1581476e540cb3afe9d5a5ab2bfced1cff580e9969817795f6a5c0f76bfe3bea
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -11,12 +11,14 @@ Rake::TestTask.new do |t|
|
|
11
11
|
t.libs << 'test'
|
12
12
|
end
|
13
13
|
|
14
|
+
task test: :format
|
15
|
+
task test: :lint
|
14
16
|
task test: :rubocop
|
15
17
|
task test: :cucumber
|
16
18
|
|
17
19
|
desc 'Publishes the Gem'
|
18
20
|
task :push do
|
19
|
-
sh 'gem push gherkin_language-0.0.
|
21
|
+
sh 'gem push gherkin_language-0.0.5.gem'
|
20
22
|
end
|
21
23
|
|
22
24
|
desc 'Checks ruby style'
|
@@ -27,3 +29,11 @@ end
|
|
27
29
|
task :cucumber do
|
28
30
|
sh 'cucumber'
|
29
31
|
end
|
32
|
+
|
33
|
+
task :lint do
|
34
|
+
sh 'gherkin_lint --disable UnknownVariable features/*.feature'
|
35
|
+
end
|
36
|
+
|
37
|
+
task :format do
|
38
|
+
sh 'gherkin_format features/*.feature'
|
39
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
Feature: Correct
|
2
|
+
As a Business Analyst
|
3
|
+
I want no errors for correct files
|
4
|
+
so that I know that my files are all correct
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "report.rb" with:
|
8
|
+
"""
|
9
|
+
$LOAD_PATH << '../../lib'
|
10
|
+
require 'gherkin_language'
|
11
|
+
|
12
|
+
no_cache = true
|
13
|
+
language = GherkinLanguage.new no_cache
|
14
|
+
language.analyze 'test.feature'
|
15
|
+
exit language.report
|
16
|
+
|
17
|
+
"""
|
18
|
+
|
19
|
+
Scenario: Empty Feature
|
20
|
+
Given a file named "test.feature" with:
|
21
|
+
"""
|
22
|
+
Feature: Test
|
23
|
+
"""
|
24
|
+
When I run `ruby report.rb`
|
25
|
+
Then it should pass with exactly:
|
26
|
+
"""
|
27
|
+
|
28
|
+
"""
|
29
|
+
|
30
|
+
Scenario: Empty Scenario
|
31
|
+
Given a file named "test.feature" with:
|
32
|
+
"""
|
33
|
+
Feature: Test
|
34
|
+
Scenario: Test
|
35
|
+
"""
|
36
|
+
When I run `ruby report.rb`
|
37
|
+
Then it should pass with exactly:
|
38
|
+
"""
|
39
|
+
|
40
|
+
"""
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Glossary
|
2
|
+
As a Business Analyst
|
3
|
+
I want to use business terms
|
4
|
+
so that I use the same language as in the business
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a file named "report.rb" with:
|
8
|
+
"""
|
9
|
+
$LOAD_PATH << '../../lib'
|
10
|
+
require 'gherkin_language'
|
11
|
+
|
12
|
+
no_cache = true
|
13
|
+
language = GherkinLanguage.new no_cache
|
14
|
+
language.analyze 'test.feature'
|
15
|
+
exit language.report
|
16
|
+
|
17
|
+
"""
|
18
|
+
And a file named "test.feature" with:
|
19
|
+
"""
|
20
|
+
Feature: Test
|
21
|
+
Scenario: Duplex-Hyper-Reflux-Machine
|
22
|
+
"""
|
23
|
+
|
24
|
+
Scenario: Warns about undefined Term
|
25
|
+
When I run `ruby report.rb`
|
26
|
+
Then it should fail with exactly:
|
27
|
+
"""
|
28
|
+
1 unknown words: Duplex-Hyper-Reflux-Machine
|
29
|
+
|
30
|
+
"""
|
31
|
+
|
32
|
+
Scenario: Business Term
|
33
|
+
Given a file named ".glossary" with:
|
34
|
+
"""
|
35
|
+
Duplex-Hyper-Reflux-Machine Duplex-Hyper-Reflux-Machine NNP
|
36
|
+
|
37
|
+
"""
|
38
|
+
When I run `ruby report.rb`
|
39
|
+
Then it should pass with exactly:
|
40
|
+
"""
|
41
|
+
|
42
|
+
"""
|
data/features/report.feature
CHANGED
@@ -30,7 +30,7 @@ Feature: Report
|
|
30
30
|
"""
|
31
31
|
[misspelling] EN_A_VS_AN
|
32
32
|
Use 'a' instead of 'an' if the following word doesn't start with a vowel sound, e.g. 'a sentence', 'a university'
|
33
|
-
Context: Given an test when execute then pass
|
33
|
+
Context: Given an test when execute then pass
|
34
34
|
Replacements: a
|
35
35
|
References: test.feature
|
36
36
|
|
@@ -50,7 +50,7 @@ Feature: Report
|
|
50
50
|
"""
|
51
51
|
[misspelling] MORFOLOGIK_RULE_EN_US
|
52
52
|
Possible spelling mistake found
|
53
|
-
Context: Given a test when exicute then pass
|
53
|
+
Context: Given a test when exicute then pass
|
54
54
|
Replacements: execute
|
55
55
|
References: test.feature
|
56
56
|
1 unknown words: exicute
|
data/features/sentences.feature
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Feature: Sentences
|
2
|
-
As a
|
2
|
+
As a Developer
|
3
3
|
I want to extract all sentences out of my feature files
|
4
4
|
so that I could do further analysis on them
|
5
5
|
|
@@ -10,118 +10,118 @@ Feature: Sentences
|
|
10
10
|
require 'gherkin_language'
|
11
11
|
|
12
12
|
language = GherkinLanguage.new false
|
13
|
-
puts language.extract_sentences language.parse '
|
13
|
+
puts language.extract_sentences language.parse 'test.feature'
|
14
14
|
|
15
15
|
"""
|
16
16
|
|
17
17
|
Scenario: Extract Sentences
|
18
|
-
Given a file named "
|
18
|
+
Given a file named "test.feature" with:
|
19
19
|
"""
|
20
|
-
Feature:
|
21
|
-
Scenario:
|
22
|
-
Given
|
23
|
-
When I
|
24
|
-
Then
|
20
|
+
Feature: Test
|
21
|
+
Scenario: Test
|
22
|
+
Given test
|
23
|
+
When I execute
|
24
|
+
Then verify
|
25
25
|
"""
|
26
26
|
When I run `ruby extract_sentences.rb`
|
27
27
|
Then it should pass with:
|
28
28
|
"""
|
29
|
-
|
30
|
-
|
31
|
-
Given
|
29
|
+
Test
|
30
|
+
Test
|
31
|
+
Given test when I execute then verify
|
32
32
|
"""
|
33
33
|
|
34
34
|
Scenario: Extract Sentences with background
|
35
|
-
Given a file named "
|
35
|
+
Given a file named "test.feature" with:
|
36
36
|
"""
|
37
|
-
Feature:
|
37
|
+
Feature: Test
|
38
38
|
Background:
|
39
|
-
Given
|
39
|
+
Given background
|
40
40
|
|
41
|
-
Scenario:
|
42
|
-
Given
|
43
|
-
When I
|
44
|
-
Then
|
41
|
+
Scenario: Test
|
42
|
+
Given test
|
43
|
+
When I execute
|
44
|
+
Then verify
|
45
45
|
"""
|
46
46
|
When I run `ruby extract_sentences.rb`
|
47
47
|
Then it should pass with:
|
48
48
|
"""
|
49
|
-
|
50
|
-
|
51
|
-
Given
|
49
|
+
Test
|
50
|
+
Test
|
51
|
+
Given background and test when I execute then verify
|
52
52
|
"""
|
53
53
|
|
54
54
|
Scenario: Extract Sentences from outlines
|
55
|
-
Given a file named "
|
55
|
+
Given a file named "test.feature" with:
|
56
56
|
"""
|
57
|
-
Feature:
|
58
|
-
Scenario Outline:
|
59
|
-
Given
|
60
|
-
When
|
61
|
-
Then
|
57
|
+
Feature: Test
|
58
|
+
Scenario Outline: Test
|
59
|
+
Given <A>
|
60
|
+
When <B>
|
61
|
+
Then <C>
|
62
62
|
|
63
|
-
Examples:
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
Examples: Table
|
64
|
+
| A | B | C |
|
65
|
+
| 1 | 3 | 5 |
|
66
|
+
| 2 | 4 | 6 |
|
67
67
|
"""
|
68
68
|
When I run `ruby extract_sentences.rb`
|
69
69
|
Then it should pass with:
|
70
70
|
"""
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
Given
|
75
|
-
Given
|
71
|
+
Test
|
72
|
+
Test
|
73
|
+
Table
|
74
|
+
Given 1 when 3 then 5
|
75
|
+
Given 2 when 4 then 6
|
76
76
|
"""
|
77
77
|
|
78
78
|
Scenario: Extract Sentences considers feature description
|
79
|
-
Given a file named "
|
79
|
+
Given a file named "test.feature" with:
|
80
80
|
"""
|
81
|
-
Feature:
|
81
|
+
Feature: Test
|
82
82
|
As a user,
|
83
83
|
I want something
|
84
84
|
so that I have that
|
85
85
|
|
86
|
-
Scenario:
|
87
|
-
Given
|
88
|
-
When I
|
89
|
-
Then
|
86
|
+
Scenario: Test
|
87
|
+
Given test
|
88
|
+
When I execute
|
89
|
+
Then verify
|
90
90
|
"""
|
91
91
|
When I run `ruby extract_sentences.rb`
|
92
92
|
Then it should pass with:
|
93
93
|
"""
|
94
|
-
|
94
|
+
Test
|
95
95
|
As a user,
|
96
96
|
I want something
|
97
97
|
so that I have that
|
98
|
-
|
99
|
-
Given
|
98
|
+
Test
|
99
|
+
Given test when I execute then verify
|
100
100
|
"""
|
101
101
|
|
102
102
|
Scenario: Extract Sentences considers scenario description
|
103
|
-
Given a file named "
|
103
|
+
Given a file named "test.feature" with:
|
104
104
|
"""
|
105
|
-
Feature:
|
105
|
+
Feature: Test
|
106
106
|
As a user,
|
107
107
|
I want something
|
108
108
|
so that I have that
|
109
109
|
|
110
|
-
Scenario:
|
110
|
+
Scenario: Test
|
111
111
|
This is a sentence description
|
112
|
-
|
113
|
-
Given
|
114
|
-
When I
|
115
|
-
Then
|
112
|
+
|
113
|
+
Given test
|
114
|
+
When I execute
|
115
|
+
Then verify
|
116
116
|
"""
|
117
117
|
When I run `ruby extract_sentences.rb`
|
118
118
|
Then it should pass with:
|
119
119
|
"""
|
120
|
-
|
120
|
+
Test
|
121
121
|
As a user,
|
122
122
|
I want something
|
123
123
|
so that I have that
|
124
|
-
|
124
|
+
Test
|
125
125
|
This is a sentence description
|
126
|
-
Given
|
126
|
+
Given test when I execute then verify
|
127
127
|
"""
|
data/features/tag.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: Tag
|
|
3
3
|
I want to tag all words from my features files
|
4
4
|
so that I can build up a glossary or check against forbidden words
|
5
5
|
|
6
|
-
|
6
|
+
Scenario: Tag words
|
7
7
|
Given a file named "tag.rb" with:
|
8
8
|
"""
|
9
9
|
$LOAD_PATH << '../../lib'
|
@@ -14,9 +14,7 @@ Feature: Tag
|
|
14
14
|
puts language.tag ['tag.feature']
|
15
15
|
|
16
16
|
"""
|
17
|
-
|
18
|
-
Scenario: Tag words
|
19
|
-
Given a file named "tag.feature" with:
|
17
|
+
And a file named "tag.feature" with:
|
20
18
|
"""
|
21
19
|
Feature: Test
|
22
20
|
Scenario: Tag
|
data/gherkin_language.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'gherkin_language'
|
3
|
-
s.version = '0.0.
|
4
|
-
s.date = '2015-07-
|
3
|
+
s.version = '0.0.5'
|
4
|
+
s.date = '2015-07-12'
|
5
5
|
s.summary = 'Gherkin Language'
|
6
6
|
s.description = 'Check language of Gherkin Files'
|
7
7
|
s.authors = ['Stefan Rohe']
|
data/lib/gherkin_language.rb
CHANGED
@@ -115,7 +115,7 @@ class GherkinLanguage
|
|
115
115
|
doc.elements.each '//error' do |error|
|
116
116
|
errors.push Error.new(
|
117
117
|
error.attributes['category'],
|
118
|
-
error.attributes['context'],
|
118
|
+
error.attributes['context'].strip,
|
119
119
|
error.attributes['locqualityissuetype'],
|
120
120
|
error.attributes['msg'],
|
121
121
|
error.attributes['replacements'],
|
@@ -213,7 +213,7 @@ class GherkinLanguage
|
|
213
213
|
end
|
214
214
|
|
215
215
|
def report
|
216
|
-
return if @references.keys.empty?
|
216
|
+
return 0 if @references.keys.empty?
|
217
217
|
language = LanguageToolProcess.new
|
218
218
|
language.start!
|
219
219
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gherkin_language
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rohe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gherkin
|
@@ -67,6 +67,8 @@ files:
|
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- bin/gherkin_language
|
70
|
+
- features/correct.feature
|
71
|
+
- features/glossary.feature
|
70
72
|
- features/report.feature
|
71
73
|
- features/sentences.feature
|
72
74
|
- features/support/env.rb
|