gherkin_lint 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gherkin_lint.rb +29 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1d0d99d8c45ff4c504466326ac7f7dea6be3bcab
4
- data.tar.gz: 680a25d303d1502e64218883dfaf01bbf8dd0eba
3
+ metadata.gz: 88297d2e07b3d839b7cc886fb0e63521c2d7205d
4
+ data.tar.gz: ee80799f74c1d0ae976204b11cfd5f31bcb2dc24
5
5
  SHA512:
6
- metadata.gz: 3690cf08438bb34015d64a2e9218c60061ba4bfcb706346fe13a23ebaffe2a746f13b8bd4beb339238c6ab6340ec65ecc330f498a682f85e69c4a2979364e842
7
- data.tar.gz: 63bf4c8d24cd0222a38efe34a0c30cc5eaa3b83574c9b8e6391df1034e4ce208ef267021509c9b9283e45263ff899096da9890d6e28a34eb5a457e1a94025f9e
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
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-06 00:00:00.000000000 Z
11
+ date: 2015-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gherkin