gherkin_lint 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/lib/gherkin_lint.rb +29 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88297d2e07b3d839b7cc886fb0e63521c2d7205d
|
4
|
+
data.tar.gz: ee80799f74c1d0ae976204b11cfd5f31bcb2dc24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de7dee55259142fdea3e46bdca7eabeb04967a05e35de90e026d1ecc7a8be84fc6961885721c6ab57b02b78708bc122b45469c8ab269bf9df707c5bd70adf982
|
7
|
+
data.tar.gz: 93fa786c4557ecbd2457a200a1795c884ec4c8a8d9717e8632c1b3880c1525c1b8b898ed34d00b4cdd403e4f1d8a34af81ff1ffbd071a3bc324f74d7183a1972
|
data/lib/gherkin_lint.rb
CHANGED
@@ -290,7 +290,7 @@ class GherkinLint
|
|
290
290
|
features do |file, feature|
|
291
291
|
next unless feature.include? 'name'
|
292
292
|
expected_feature_name = title_case file
|
293
|
-
next unless feature['name'] != expected_feature_name
|
293
|
+
next unless feature['name'].downcase != expected_feature_name.downcase
|
294
294
|
references = [reference(file, feature)]
|
295
295
|
add_issue(references, "Feature name should be '#{expected_feature_name}'")
|
296
296
|
end
|
@@ -521,6 +521,33 @@ class GherkinLint
|
|
521
521
|
end
|
522
522
|
end
|
523
523
|
|
524
|
+
# service class to lint for using same tag on all scenarios
|
525
|
+
class SameTagForAllScenarios < Linter
|
526
|
+
def lint
|
527
|
+
features do |file, feature|
|
528
|
+
tags = gather_same_tags feature
|
529
|
+
next if tags.length < 1
|
530
|
+
references = [reference(file, feature)]
|
531
|
+
tags.each do |tag|
|
532
|
+
add_issue(references, "Tag '#{tag}' should be used at Feature level")
|
533
|
+
end
|
534
|
+
end
|
535
|
+
end
|
536
|
+
|
537
|
+
def gather_same_tags(feature)
|
538
|
+
result = nil
|
539
|
+
return result unless feature.include? 'elements'
|
540
|
+
feature['elements'].each do |scenario|
|
541
|
+
next if scenario['keyword'] == 'Background'
|
542
|
+
next unless scenario.include? 'tags'
|
543
|
+
tags = scenario['tags'].map { |tag| tag['name'] }
|
544
|
+
result = tags if result.nil?
|
545
|
+
result &= tags
|
546
|
+
end
|
547
|
+
result
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
524
551
|
# service class to lint for using background
|
525
552
|
class UseBackground < Linter
|
526
553
|
def lint
|
@@ -603,6 +630,7 @@ class GherkinLint
|
|
603
630
|
MissingVerification,
|
604
631
|
InvalidFileName,
|
605
632
|
InvalidStepFlow,
|
633
|
+
SameTagForAllScenarios,
|
606
634
|
TooClumsy,
|
607
635
|
TooManyDifferentTags,
|
608
636
|
TooManySteps,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gherkin_lint
|
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-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gherkin
|