cuke_linter 0.12.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +41 -1
  3. data/README.md +12 -8
  4. data/cuke_linter.gemspec +25 -21
  5. data/exe/cuke_linter +3 -1
  6. data/lib/cuke_linter.rb +119 -176
  7. data/lib/cuke_linter/configuration.rb +45 -0
  8. data/lib/cuke_linter/default_linters.rb +32 -0
  9. data/lib/cuke_linter/formatters/pretty_formatter.rb +63 -35
  10. data/lib/cuke_linter/gherkin.rb +10 -0
  11. data/lib/cuke_linter/linter_registration.rb +32 -0
  12. data/lib/cuke_linter/linters/background_does_more_than_setup_linter.rb +17 -1
  13. data/lib/cuke_linter/linters/element_with_common_tags_linter.rb +23 -14
  14. data/lib/cuke_linter/linters/element_with_duplicate_tags_linter.rb +18 -13
  15. data/lib/cuke_linter/linters/element_with_too_many_tags_linter.rb +17 -11
  16. data/lib/cuke_linter/linters/feature_with_too_many_different_tags_linter.rb +1 -3
  17. data/lib/cuke_linter/linters/feature_without_description_linter.rb +1 -1
  18. data/lib/cuke_linter/linters/linter.rb +17 -13
  19. data/lib/cuke_linter/linters/step_with_too_many_characters_linter.rb +2 -2
  20. data/lib/cuke_linter/linters/test_should_use_background_linter.rb +56 -4
  21. data/lib/cuke_linter/linters/test_with_action_step_as_final_step_linter.rb +12 -1
  22. data/lib/cuke_linter/linters/test_with_bad_name_linter.rb +4 -4
  23. data/lib/cuke_linter/linters/test_with_no_action_step_linter.rb +12 -1
  24. data/lib/cuke_linter/linters/test_with_no_verification_step_linter.rb +12 -1
  25. data/lib/cuke_linter/linters/test_with_setup_step_after_action_step_linter.rb +18 -2
  26. data/lib/cuke_linter/linters/test_with_setup_step_after_verification_step_linter.rb +18 -2
  27. data/lib/cuke_linter/linters/test_with_setup_step_as_final_step_linter.rb +12 -1
  28. data/lib/cuke_linter/version.rb +1 -1
  29. data/testing/cucumber/features/linters/background_does_more_than_setup.feature +34 -0
  30. data/testing/cucumber/features/linters/test_with_action_as_final_step.feature +25 -3
  31. data/testing/cucumber/features/linters/test_with_no_action_step.feature +27 -1
  32. data/testing/cucumber/features/linters/test_with_no_verification_step.feature +28 -1
  33. data/testing/cucumber/features/linters/test_with_setup_step_after_action_step.feature +28 -1
  34. data/testing/cucumber/features/linters/test_with_setup_step_after_verification_step.feature +28 -1
  35. data/testing/cucumber/features/linters/test_with_setup_step_as_final_step.feature +25 -3
  36. metadata +88 -106
  37. data/.gitignore +0 -19
  38. data/.simplecov +0 -8
  39. data/.travis.yml +0 -23
  40. data/CONTRIBUTING.md +0 -26
  41. data/Gemfile +0 -6
  42. data/Rakefile +0 -63
  43. data/appveyor.yml +0 -43
  44. data/bin/console +0 -14
  45. data/bin/setup +0 -8
  46. data/environments/common_env.rb +0 -12
  47. data/environments/cucumber_env.rb +0 -22
  48. data/environments/rspec_env.rb +0 -50
  49. data/testing/cucumber/step_definitions/action_steps.rb +0 -84
  50. data/testing/cucumber/step_definitions/setup_steps.rb +0 -230
  51. data/testing/cucumber/step_definitions/verification_steps.rb +0 -94
  52. data/testing/file_helper.rb +0 -41
  53. data/testing/formatter_factory.rb +0 -15
  54. data/testing/gemfiles/cuke_modeler1.gemfile +0 -8
  55. data/testing/gemfiles/cuke_modeler2.gemfile +0 -8
  56. data/testing/linter_factory.rb +0 -60
  57. data/testing/model_factory.rb +0 -109
  58. data/testing/rspec/spec/integration/cli_integration_spec.rb +0 -556
  59. data/testing/rspec/spec/integration/configuration_spec.rb +0 -811
  60. data/testing/rspec/spec/integration/cuke_linter_integration_spec.rb +0 -243
  61. data/testing/rspec/spec/integration/formatters/formatter_integration_specs.rb +0 -5
  62. data/testing/rspec/spec/integration/formatters/pretty_formatter_integration_spec.rb +0 -8
  63. data/testing/rspec/spec/integration/linters/background_does_more_than_setup_linter_integration_spec.rb +0 -8
  64. data/testing/rspec/spec/integration/linters/element_with_common_tags_linter_integration_spec.rb +0 -8
  65. data/testing/rspec/spec/integration/linters/element_with_duplicate_tags_linter_integration_spec.rb +0 -8
  66. data/testing/rspec/spec/integration/linters/element_with_too_many_tags_linter_integration_spec.rb +0 -8
  67. data/testing/rspec/spec/integration/linters/example_without_name_linter_integration_spec.rb +0 -8
  68. data/testing/rspec/spec/integration/linters/feature_file_with_invalid_name_integration_spec.rb +0 -8
  69. data/testing/rspec/spec/integration/linters/feature_file_with_mismatched_name_integration_spec.rb +0 -8
  70. data/testing/rspec/spec/integration/linters/feature_with_too_many_different_tags_linter_integration_spec.rb +0 -8
  71. data/testing/rspec/spec/integration/linters/feature_without_description_linter_integration_spec.rb +0 -8
  72. data/testing/rspec/spec/integration/linters/feature_without_name_linter_integration_spec.rb +0 -8
  73. data/testing/rspec/spec/integration/linters/feature_without_scenarios_linter_integration_spec.rb +0 -8
  74. data/testing/rspec/spec/integration/linters/linter_integration_spec.rb +0 -8
  75. data/testing/rspec/spec/integration/linters/linter_integration_specs.rb +0 -7
  76. data/testing/rspec/spec/integration/linters/outline_with_single_example_row_linter_integration_spec.rb +0 -8
  77. data/testing/rspec/spec/integration/linters/single_test_background_linter_integration_spec.rb +0 -8
  78. data/testing/rspec/spec/integration/linters/step_with_end_period_linter_integration_spec.rb +0 -8
  79. data/testing/rspec/spec/integration/linters/step_with_too_many_characters_linter_integration_spec.rb +0 -8
  80. data/testing/rspec/spec/integration/linters/test_should_use_background_linter_integration_spec.rb +0 -8
  81. data/testing/rspec/spec/integration/linters/test_with_action_step_as_final_step_linter_integration_spec.rb +0 -8
  82. data/testing/rspec/spec/integration/linters/test_with_bad_name_integration_spec.rb +0 -8
  83. data/testing/rspec/spec/integration/linters/test_with_no_action_step_integration_spec.rb +0 -8
  84. data/testing/rspec/spec/integration/linters/test_with_no_name_integration_spec.rb +0 -8
  85. data/testing/rspec/spec/integration/linters/test_with_no_verification_step_integration_spec.rb +0 -8
  86. data/testing/rspec/spec/integration/linters/test_with_setup_step_after_action_step_linter_integration_spec.rb +0 -8
  87. data/testing/rspec/spec/integration/linters/test_with_setup_step_after_verification_step_linter_integration_spec.rb +0 -8
  88. data/testing/rspec/spec/integration/linters/test_with_setup_step_as_final_step_linter_integration_spec.rb +0 -8
  89. data/testing/rspec/spec/integration/linters/test_with_too_many_steps_linter_integration_spec.rb +0 -8
  90. data/testing/rspec/spec/unit/cuke_linter_unit_spec.rb +0 -102
  91. data/testing/rspec/spec/unit/formatters/formatter_unit_specs.rb +0 -11
  92. data/testing/rspec/spec/unit/formatters/pretty_formatter_unit_spec.rb +0 -115
  93. data/testing/rspec/spec/unit/linters/background_does_more_than_setup_linter_unit_spec.rb +0 -77
  94. data/testing/rspec/spec/unit/linters/configurable_linter_unit_specs.rb +0 -11
  95. data/testing/rspec/spec/unit/linters/element_with_common_tags_linter_unit_spec.rb +0 -248
  96. data/testing/rspec/spec/unit/linters/element_with_duplicate_tags_linter_unit_spec.rb +0 -203
  97. data/testing/rspec/spec/unit/linters/element_with_too_many_tags_linter_unit_spec.rb +0 -296
  98. data/testing/rspec/spec/unit/linters/example_without_name_linter_unit_spec.rb +0 -81
  99. data/testing/rspec/spec/unit/linters/feature_file_with_invalid_name_linter_unit_spec.rb +0 -106
  100. data/testing/rspec/spec/unit/linters/feature_file_with_mismatched_name_linter_unit_spec.rb +0 -124
  101. data/testing/rspec/spec/unit/linters/feature_with_too_many_different_tags_linter_unit_spec.rb +0 -293
  102. data/testing/rspec/spec/unit/linters/feature_without_description_linter_unit_spec.rb +0 -80
  103. data/testing/rspec/spec/unit/linters/feature_without_name_linter_unit_spec.rb +0 -84
  104. data/testing/rspec/spec/unit/linters/feature_without_scenarios_linter_unit_spec.rb +0 -102
  105. data/testing/rspec/spec/unit/linters/linter_unit_spec.rb +0 -197
  106. data/testing/rspec/spec/unit/linters/linter_unit_specs.rb +0 -57
  107. data/testing/rspec/spec/unit/linters/outline_with_single_example_row_linter_unit_spec.rb +0 -184
  108. data/testing/rspec/spec/unit/linters/single_test_background_linter_unit_spec.rb +0 -89
  109. data/testing/rspec/spec/unit/linters/step_with_end_period_linter_unit_spec.rb +0 -54
  110. data/testing/rspec/spec/unit/linters/step_with_too_many_characters_linter_unit_spec.rb +0 -155
  111. data/testing/rspec/spec/unit/linters/test_should_use_background_linter_unit_spec.rb +0 -226
  112. data/testing/rspec/spec/unit/linters/test_with_action_step_as_final_step_linter_unit_spec.rb +0 -98
  113. data/testing/rspec/spec/unit/linters/test_with_bad_name_linter_unit_spec.rb +0 -81
  114. data/testing/rspec/spec/unit/linters/test_with_no_action_step_linter_unit_spec.rb +0 -176
  115. data/testing/rspec/spec/unit/linters/test_with_no_name_linter_unit_spec.rb +0 -88
  116. data/testing/rspec/spec/unit/linters/test_with_no_verification_step_linter_unit_spec.rb +0 -179
  117. data/testing/rspec/spec/unit/linters/test_with_setup_step_after_action_step_linter_unit_spec.rb +0 -124
  118. data/testing/rspec/spec/unit/linters/test_with_setup_step_after_verification_step_linter_unit_spec.rb +0 -125
  119. data/testing/rspec/spec/unit/linters/test_with_setup_step_as_final_step_linter_unit_spec.rb +0 -98
  120. data/testing/rspec/spec/unit/linters/test_with_too_many_steps_linter_unit_spec.rb +0 -192
@@ -4,6 +4,9 @@ module CukeLinter
4
4
 
5
5
  class Linter
6
6
 
7
+ # Returns the name of the linter
8
+ attr_reader :name
9
+
7
10
  # Creates a new linter object
8
11
  def initialize(name: nil, message: nil, rule: nil)
9
12
  @name = name || self.class.name.split('::').last
@@ -11,27 +14,28 @@ module CukeLinter
11
14
  @rule = rule
12
15
  end
13
16
 
14
- # Returns the name of the linter
15
- def name
16
- @name
17
- end
18
-
19
17
  # Lints the given model and returns linting data about said model
20
18
  def lint(model)
21
19
  raise 'No linting rule provided!' unless @rule || respond_to?(:rule)
22
20
 
23
21
  problem_found = respond_to?(:rule) ? rule(model) : @rule.call(model)
24
22
 
25
- if problem_found
26
- problem_message = respond_to?(:message) ? message : @message
23
+ return nil unless problem_found
24
+
25
+ build_problem(model)
26
+ end
27
+
28
+
29
+ private
30
+
31
+
32
+ def build_problem(model)
33
+ problem_message = respond_to?(:message) ? message : @message
27
34
 
28
- if model.is_a?(CukeModeler::FeatureFile)
29
- { problem: problem_message, location: "#{model.path}" }
30
- else
31
- { problem: problem_message, location: "#{model.get_ancestor(:feature_file).path}:#{model.source_line}" }
32
- end
35
+ if model.is_a?(CukeModeler::FeatureFile)
36
+ { problem: problem_message, location: model.path }
33
37
  else
34
- nil
38
+ { problem: problem_message, location: "#{model.get_ancestor(:feature_file).path}:#{model.source_line}" }
35
39
  end
36
40
  end
37
41
 
@@ -15,8 +15,8 @@ module CukeLinter
15
15
  # The rule used to determine if a model has a problem
16
16
  def rule(model)
17
17
  return false unless model.is_a?(CukeModeler::Step)
18
-
19
- @linted_step_length = model.text&.length || 0
18
+
19
+ @linted_step_length = model.text.nil? ? 0 : model.text.length
20
20
 
21
21
  @linted_step_length > step_length_threshold
22
22
  end
@@ -1,5 +1,6 @@
1
1
  module CukeLinter
2
2
 
3
+ # TODO: Make a new class that it is from the POV of a Feature model instead
3
4
  # A linter that detects scenarios and outlines within a feature that all share common beginning steps
4
5
 
5
6
  class TestShouldUseBackgroundLinter < Linter
@@ -13,10 +14,10 @@ module CukeLinter
13
14
 
14
15
  return false unless parent_feature_model.tests.count > 1
15
16
 
16
- parent_feature_model.tests.all? do |test|
17
- test_steps = test.steps || []
18
- test_steps.first == model_steps.first
19
- end
17
+ matching_steps = all_first_steps_match?(parent_feature_model, model_steps)
18
+ none_parameterized = no_parameterized_steps?(parent_feature_model)
19
+
20
+ matching_steps && none_parameterized
20
21
  end
21
22
 
22
23
  # The message used to describe the problem that has been found
@@ -24,5 +25,56 @@ module CukeLinter
24
25
  'Test shares steps with all other tests in feature. Use a background.'
25
26
  end
26
27
 
28
+
29
+ private
30
+
31
+
32
+ def all_first_steps_match?(feature_model, model_steps)
33
+ feature_model.tests.all? do |test|
34
+ test_steps = test.steps || []
35
+ test_steps.first == model_steps.first
36
+ end
37
+ end
38
+
39
+ def no_parameterized_steps?(feature_model)
40
+ feature_model.tests.none? do |test|
41
+ next false if test.is_a?(CukeModeler::Scenario)
42
+
43
+ test_steps = test.steps || []
44
+ params_used_by_test = test.examples.map(&:parameters).flatten.uniq
45
+
46
+ next false unless test_steps.any?
47
+
48
+ parameterized_step?(test_steps.first, parameters: params_used_by_test)
49
+ end
50
+ end
51
+
52
+ def parameterized_step?(step_model, parameters:)
53
+ parameters.any? do |parameter|
54
+ parameter_string = "<#{parameter}>"
55
+
56
+ parameterized_text?(step_model, parameter_string) ||
57
+ parameterized_doc_string?(step_model, parameter_string) ||
58
+ parameterized_table?(step_model, parameter_string)
59
+ end
60
+ end
61
+
62
+ def parameterized_text?(step_model, parameter)
63
+ step_model.text.include?(parameter)
64
+ end
65
+
66
+ def parameterized_doc_string?(step_model, parameter)
67
+ return false unless step_model.block.is_a?(CukeModeler::DocString)
68
+
69
+ step_model.block.content.include?(parameter)
70
+ end
71
+
72
+ def parameterized_table?(step_model, parameter)
73
+ return false unless step_model.block.is_a?(CukeModeler::Table)
74
+
75
+ step_model.block.rows.map(&:cells).flatten.map(&:value).any? { |cell_text| cell_text.include?(parameter) }
76
+ end
77
+
27
78
  end
79
+
28
80
  end
@@ -4,6 +4,11 @@ module CukeLinter
4
4
 
5
5
  class TestWithActionStepAsFinalStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @when_keywords = options['When']
10
+ end
11
+
7
12
  # The rule used to determine if a model has a problem
8
13
  def rule(model)
9
14
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -11,7 +16,7 @@ module CukeLinter
11
16
  model_steps = model.steps || []
12
17
  return false unless model_steps.last
13
18
 
14
- model_steps.last.keyword == 'When'
19
+ when_keywords.include?(model_steps.last.keyword)
15
20
  end
16
21
 
17
22
  # The message used to describe the problem that has been found
@@ -19,5 +24,11 @@ module CukeLinter
19
24
  "Test has 'When' as the final step."
20
25
  end
21
26
 
27
+ private
28
+
29
+ def when_keywords
30
+ @when_keywords || [DEFAULT_WHEN_KEYWORD]
31
+ end
32
+
22
33
  end
23
34
  end
@@ -9,10 +9,10 @@ module CukeLinter
9
9
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
10
10
 
11
11
  lowercase_name = model.name.downcase
12
- return true if lowercase_name.include?('test') ||
13
- lowercase_name.include?('verif') ||
14
- lowercase_name.include?('check')
15
- false
12
+
13
+ lowercase_name.include?('test') ||
14
+ lowercase_name.include?('verif') ||
15
+ lowercase_name.include?('check')
16
16
  end
17
17
 
18
18
  # The message used to describe the problem that has been found
@@ -4,6 +4,11 @@ module CukeLinter
4
4
 
5
5
  class TestWithNoActionStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @when_keywords = options['When']
10
+ end
11
+
7
12
  # The rule used to determine if a model has a problem
8
13
  def rule(model)
9
14
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -11,7 +16,7 @@ module CukeLinter
11
16
  model_steps = model.steps || []
12
17
  background_steps = model.parent_model.has_background? ? model.parent_model.background.steps || [] : []
13
18
  all_steps = model_steps + background_steps
14
- all_steps.none? { |step| step.keyword == 'When' }
19
+ all_steps.none? { |step| when_keywords.include?(step.keyword) }
15
20
  end
16
21
 
17
22
  # The message used to describe the problem that has been found
@@ -19,5 +24,11 @@ module CukeLinter
19
24
  "Test does not have a 'When' step."
20
25
  end
21
26
 
27
+ private
28
+
29
+ def when_keywords
30
+ @when_keywords || [DEFAULT_WHEN_KEYWORD]
31
+ end
32
+
22
33
  end
23
34
  end
@@ -4,6 +4,11 @@ module CukeLinter
4
4
 
5
5
  class TestWithNoVerificationStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @then_keywords = options['Then']
10
+ end
11
+
7
12
  # The rule used to determine if a model has a problem
8
13
  def rule(model)
9
14
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -11,7 +16,7 @@ module CukeLinter
11
16
  model_steps = model.steps || []
12
17
  background_steps = model.parent_model.has_background? ? model.parent_model.background.steps || [] : []
13
18
  all_steps = model_steps + background_steps
14
- all_steps.none? { |step| step.keyword == 'Then' }
19
+ all_steps.none? { |step| then_keywords.include?(step.keyword) }
15
20
  end
16
21
 
17
22
  # The message used to describe the problem that has been found
@@ -19,5 +24,11 @@ module CukeLinter
19
24
  "Test does not have a 'Then' step."
20
25
  end
21
26
 
27
+ private
28
+
29
+ def then_keywords
30
+ @then_keywords || [DEFAULT_THEN_KEYWORD]
31
+ end
32
+
22
33
  end
23
34
  end
@@ -4,6 +4,12 @@ module CukeLinter
4
4
 
5
5
  class TestWithSetupStepAfterActionStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @given_keywords = options['Given']
10
+ @when_keywords = options['When']
11
+ end
12
+
7
13
  # The rule used to determine if a model has a problem
8
14
  def rule(model)
9
15
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -13,9 +19,9 @@ module CukeLinter
13
19
 
14
20
  model_steps.each do |step|
15
21
  if action_step_found
16
- return true if step.keyword == 'Given'
22
+ return true if given_keywords.include?(step.keyword)
17
23
  else
18
- action_step_found = step.keyword == 'When'
24
+ action_step_found = when_keywords.include?(step.keyword)
19
25
  end
20
26
  end
21
27
 
@@ -27,5 +33,15 @@ module CukeLinter
27
33
  "Test has 'Given' step after 'When' step."
28
34
  end
29
35
 
36
+ private
37
+
38
+ def given_keywords
39
+ @given_keywords || [DEFAULT_GIVEN_KEYWORD]
40
+ end
41
+
42
+ def when_keywords
43
+ @when_keywords || [DEFAULT_WHEN_KEYWORD]
44
+ end
45
+
30
46
  end
31
47
  end
@@ -4,6 +4,12 @@ module CukeLinter
4
4
 
5
5
  class TestWithSetupStepAfterVerificationStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @given_keywords = options['Given']
10
+ @then_keywords = options['Then']
11
+ end
12
+
7
13
  # The rule used to determine if a model has a problem
8
14
  def rule(model)
9
15
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -13,9 +19,9 @@ module CukeLinter
13
19
 
14
20
  model_steps.each do |step|
15
21
  if verification_step_found
16
- return true if step.keyword == 'Given'
22
+ return true if given_keywords.include?(step.keyword)
17
23
  else
18
- verification_step_found = step.keyword == 'Then'
24
+ verification_step_found = then_keywords.include?(step.keyword)
19
25
  end
20
26
  end
21
27
 
@@ -27,5 +33,15 @@ module CukeLinter
27
33
  "Test has 'Given' step after 'Then' step."
28
34
  end
29
35
 
36
+ private
37
+
38
+ def given_keywords
39
+ @given_keywords || [DEFAULT_GIVEN_KEYWORD]
40
+ end
41
+
42
+ def then_keywords
43
+ @then_keywords || [DEFAULT_THEN_KEYWORD]
44
+ end
45
+
30
46
  end
31
47
  end
@@ -4,6 +4,11 @@ module CukeLinter
4
4
 
5
5
  class TestWithSetupStepAsFinalStepLinter < Linter
6
6
 
7
+ # Changes the linting settings on the linter using the provided configuration
8
+ def configure(options)
9
+ @given_keywords = options['Given']
10
+ end
11
+
7
12
  # The rule used to determine if a model has a problem
8
13
  def rule(model)
9
14
  return false unless model.is_a?(CukeModeler::Scenario) || model.is_a?(CukeModeler::Outline)
@@ -11,7 +16,7 @@ module CukeLinter
11
16
  model_steps = model.steps || []
12
17
  return false unless model_steps.last
13
18
 
14
- model_steps.last.keyword == 'Given'
19
+ given_keywords.include?(model_steps.last.keyword)
15
20
  end
16
21
 
17
22
  # The message used to describe the problem that has been found
@@ -19,5 +24,11 @@ module CukeLinter
19
24
  "Test has 'Given' as the final step."
20
25
  end
21
26
 
27
+ private
28
+
29
+ def given_keywords
30
+ @given_keywords || [DEFAULT_GIVEN_KEYWORD]
31
+ end
32
+
22
33
  end
23
34
  end
@@ -1,4 +1,4 @@
1
1
  module CukeLinter
2
2
  # The release version of this gem
3
- VERSION = '0.12.0'
3
+ VERSION = '1.1.0'.freeze
4
4
  end
@@ -48,3 +48,37 @@ Feature: Background does more than setup linter
48
48
  """
49
49
  When it is linted
50
50
  Then no error is reported
51
+
52
+ Scenario Outline: Configuration of keywords for different dialect
53
+ Given a linter for backgrounds that do more than setup has been registered
54
+ And the following configuration file:
55
+ """
56
+ BackgroundDoesMoreThanSetupLinter:
57
+ Given:
58
+ - Dado
59
+ When:
60
+ - Quando
61
+ Then:
62
+ - Então
63
+ - Entao
64
+ """
65
+ And the following feature:
66
+ """
67
+ # language:pt
68
+ Funcionalidade: Feature name
69
+
70
+ Contexto: A Background in pt dialect
71
+ Dado some setup in pt dialect
72
+ <step>
73
+ """
74
+ When the configuration file is loaded
75
+ And it is linted
76
+ Then an error is reported:
77
+ | linter | problem | location |
78
+ | BackgroundDoesMoreThanSetupLinter | Background has non-setup steps | <path_to_file>:4 |
79
+
80
+ Examples:
81
+ | step |
82
+ | Quando this is an action in pt dialect |
83
+ | Então this is a validation in pt dialect |
84
+ | Entao this is also a validation in pt dialect |
@@ -22,7 +22,29 @@ Feature: Test with action step as final step linter
22
22
  | linter | problem | location |
23
23
  | TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:3 |
24
24
 
25
- @wip
26
- Scenario: Configuration
25
+ Scenario: Configuration of keywords for different dialect
26
+ Given a linter for tests with an action step as the final step has been registered
27
+ And the following configuration file:
28
+ """
29
+ TestWithActionStepAsFinalStepLinter:
30
+ Given:
31
+ - Dado
32
+ When:
33
+ - Quando
34
+ - '*'
35
+ Then:
36
+ - Então
37
+ """
38
+ And the following feature:
39
+ """
40
+ # language:pt
41
+ Funcionalidade: Feature name
27
42
 
28
- Configure the keyword(s) that count as action steps?
43
+ Cenário: scenario name
44
+ Quando this is an action in pt dialect
45
+ """
46
+ When the configuration file is loaded
47
+ And it is linted
48
+ Then an error is reported:
49
+ | linter | problem | location |
50
+ | TestWithActionStepAsFinalStepLinter | Test has 'When' as the final step. | <path_to_file>:4 |