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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 879fcf82c13163c263dd75d963e77f34e27e4b3e
4
- data.tar.gz: 33005675ef8a6eaa9abfd4f00e0b22919d456968
3
+ metadata.gz: df497ba41442ba3e1383ea34dc77b22426c944c4
4
+ data.tar.gz: 71863c28b770c160a5b4305fe49464301322a699
5
5
  SHA512:
6
- metadata.gz: a15937b5f209e4b9152fd84ca1b23ed37dac161b9c0daac3e015d51a2334f8384faa927a7c9ffde0658345001f477282a7710de596fe5d2778eb59218b741c58
7
- data.tar.gz: db82d8c0ac5403faf6b39b8fa1c17fa97b52bd13f2115c1b8adeed26cd38f98aeacb72edc4c565a396fd3514d2fc6b9c0b3f846abe57ac7cd4e26481a185f66e
6
+ metadata.gz: 99d3b6e7c5b529424aeb7fb686305453626db0a1440304dc1fad6309cb28185627f6c79d3049f749f32d518e272cbb98f59fb9369a27fbc9f8c4218ca4f4295c
7
+ data.tar.gz: 182cb1b7d69f7b0d7141535da8fd12f3b6c224e0041a8f32f3d7f1d0e326c18f1581476e540cb3afe9d5a5ab2bfced1cff580e9969817795f6a5c0f76bfe3bea
data/Gemfile CHANGED
@@ -1,6 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
  gem 'rubocop'
3
3
  gem 'gherkin'
4
+ gem 'gherkin_lint'
5
+ gem 'gherkin_format'
4
6
  gem 'rake'
5
7
  gem 'aruba'
6
8
  gem 'term-ansicolor'
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.4.gem'
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
+ """
@@ -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
@@ -1,5 +1,5 @@
1
1
  Feature: Sentences
2
- As a Business Analyst
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 'foo.feature'
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 "foo.feature" with:
18
+ Given a file named "test.feature" with:
19
19
  """
20
- Feature: Foo
21
- Scenario: Bar
22
- Given a foo
23
- When I bar
24
- Then I baz
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
- Foo
30
- Bar
31
- Given a foo when I bar then I baz
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 "foo.feature" with:
35
+ Given a file named "test.feature" with:
36
36
  """
37
- Feature: Foo
37
+ Feature: Test
38
38
  Background:
39
- Given something
39
+ Given background
40
40
 
41
- Scenario: Bar
42
- Given a foo
43
- When I bar
44
- Then I baz
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
- Foo
50
- Bar
51
- Given something and a foo when I bar then I baz
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 "foo.feature" with:
55
+ Given a file named "test.feature" with:
56
56
  """
57
- Feature: Foo
58
- Scenario Outline: Bar
59
- Given a <foo>
60
- When I <bar>
61
- Then I <baz>
57
+ Feature: Test
58
+ Scenario Outline: Test
59
+ Given <A>
60
+ When <B>
61
+ Then <C>
62
62
 
63
- Examples: table
64
- | foo | bar | baz |
65
- | FOO | BAR | BAZ |
66
- | oof | rab | zab |
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
- Foo
72
- Bar
73
- table
74
- Given a FOO when I BAR then I BAZ
75
- Given a oof when I rab then I zab
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 "foo.feature" with:
79
+ Given a file named "test.feature" with:
80
80
  """
81
- Feature: Foo
81
+ Feature: Test
82
82
  As a user,
83
83
  I want something
84
84
  so that I have that
85
85
 
86
- Scenario: Bar
87
- Given a foo
88
- When I bar
89
- Then I baz
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
- Foo
94
+ Test
95
95
  As a user,
96
96
  I want something
97
97
  so that I have that
98
- Bar
99
- Given a foo when I bar then I baz
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 "foo.feature" with:
103
+ Given a file named "test.feature" with:
104
104
  """
105
- Feature: Foo
105
+ Feature: Test
106
106
  As a user,
107
107
  I want something
108
108
  so that I have that
109
109
 
110
- Scenario: Bar
110
+ Scenario: Test
111
111
  This is a sentence description
112
-
113
- Given a foo
114
- When I bar
115
- Then I baz
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
- Foo
120
+ Test
121
121
  As a user,
122
122
  I want something
123
123
  so that I have that
124
- Bar
124
+ Test
125
125
  This is a sentence description
126
- Given a foo when I bar then I baz
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
- Background: Prepare Testee
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
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'gherkin_language'
3
- s.version = '0.0.4'
4
- s.date = '2015-07-09'
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']
@@ -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
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-09 00:00:00.000000000 Z
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