cuke_cataloger 1.6.0 → 2.0.0

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +27 -3
  3. data/LICENSE.txt +1 -1
  4. data/README.md +11 -11
  5. data/cuke_cataloger.gemspec +33 -13
  6. data/exe/cuke_cataloger +53 -0
  7. data/lib/cuke_cataloger/formatters/text_report_formatter.rb +7 -2
  8. data/lib/cuke_cataloger/rake_tasks.rb +9 -4
  9. data/lib/cuke_cataloger/unique_test_case_tagger.rb +152 -147
  10. data/lib/cuke_cataloger/version.rb +1 -1
  11. data/lib/cuke_cataloger.rb +0 -1
  12. metadata +90 -51
  13. data/.cucumberproignore +0 -1
  14. data/.gitignore +0 -18
  15. data/.simplecov +0 -7
  16. data/.travis.yml +0 -67
  17. data/Gemfile +0 -41
  18. data/Rakefile +0 -70
  19. data/appveyor.yml +0 -188
  20. data/bin/cuke_cataloger +0 -49
  21. data/testing/cucumber/step_definitions/action_steps.rb +0 -64
  22. data/testing/cucumber/step_definitions/setup_steps.rb +0 -76
  23. data/testing/cucumber/step_definitions/verification_steps.rb +0 -211
  24. data/testing/cucumber/support/env.rb +0 -40
  25. data/testing/file_helper.rb +0 -42
  26. data/testing/fixtures/Rakefile +0 -19
  27. data/testing/fixtures/tests/foo.feature +0 -11
  28. data/testing/gemfiles/cql1.gemfile +0 -40
  29. data/testing/gemfiles/cuke_modeler0.gemfile +0 -35
  30. data/testing/gemfiles/cuke_modeler1.gemfile +0 -35
  31. data/testing/gemfiles/cuke_modeler2.gemfile +0 -35
  32. data/testing/gemfiles/cuke_modeler3.gemfile +0 -9
  33. data/testing/gemfiles/rake10.gemfile +0 -38
  34. data/testing/gemfiles/rake11.gemfile +0 -30
  35. data/testing/gemfiles/rake12.gemfile +0 -35
  36. data/testing/gemfiles/rake13.gemfile +0 -8
  37. data/testing/gemfiles/thor0.gemfile +0 -39
  38. data/testing/gemfiles/thor1.gemfile +0 -11
  39. data/testing/rspec/spec/cuke_cataloger_spec.rb +0 -22
  40. data/testing/rspec/spec/spec_helper.rb +0 -23
  41. data/testing/rspec/spec/unique_test_case_tagger_integration_spec.rb +0 -295
  42. data/testing/rspec/spec/unique_test_case_tagger_unit_spec.rb +0 -81
  43. data/todo.txt +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5093a2a855885a82d1979dbd2aae635006b0ff3dbcfece5e82cd46f65e8b6763
4
- data.tar.gz: b7e5e60c3cea900f3d24c085733af68365f067bd5f691345c3dbd06242c39604
3
+ metadata.gz: eb3fd5cae38ab765ef2915d216509608ce7bbf28767baf54b370bf19eff41c90
4
+ data.tar.gz: 040f1d882042efd4a4da63f8fbcbaa0d1b37ad3e3126b54a3beb809088dfa419
5
5
  SHA512:
6
- metadata.gz: e1d7fb2ac7d4bcd05c127fc4a776f3a00e2e329d431b667320af0cc70a17aa86da75517c570a4895ae90a29c87be3a67ee9ed38b1201e6293b708dd4f8172f97
7
- data.tar.gz: 24023c7622767652754aa65dd3880754606b1c44cf440fdc07952a1c0cae973f80cf43992eaaf9119748d051bfd992d86fc48d18e6ab590d6b4dfb80c3d875ac
6
+ metadata.gz: e57370bfb86b86f211c93641f0fba504279570612502d2dfce5d790c1c6061b93b2b4489bcacc4d206f51e9e748d0942633faba01a54cff1bf3ad785310cdd83
7
+ data.tar.gz: 3a48e9559901b71336a48adb65172de4d739975b3c883859ed5f184647ecc5bfb5ad2f703eb1b3f46697956e99224ecfd55b48efe9cef59783cce3392772c521
data/CHANGELOG.md CHANGED
@@ -8,6 +8,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  Nothing yet...
10
10
 
11
+ ## [2.0.0] - 2022-02-05
12
+
13
+ ### Added
14
+
15
+ - Added support for Ruby 3.x
16
+
17
+ ### Removed
18
+
19
+ - Removed support for some older versions of the gem's dependencies:
20
+ - Ruby 1.x
21
+ - Rake 0.x
22
+ - CukeModeler 0.x
23
+
24
+ ### Fixed
25
+
26
+ - Test case IDs are no longer erroneously detected if a tag only partially matches the ID pattern. For example, the
27
+ gem would incorrectly identify `@test_case_123_plus_more` as an ID tag even though it was not one.
28
+ - Cataloging tests now correctly handles tests that are nested in rules. Previously, the presence of a `Rule`
29
+ keyword would cause new ID tags to be placed on the wrong lines in the cataloged file.
30
+
31
+
11
32
  ## [1.6.0] - 2020-06-21
12
33
 
13
34
  ### Added
@@ -24,7 +45,8 @@ Nothing yet...
24
45
  ## [1.5.0] - 2018-09-09
25
46
 
26
47
  ### Added
27
- - The default cataloging prefix used by the Rake tasks is now also the default prefix used by the various object based methods.
48
+ - The default cataloging prefix used by the Rake tasks is now also the default prefix used by the various object
49
+ based methods.
28
50
 
29
51
  ## [1.4.1] - 2017-07-09
30
52
 
@@ -46,7 +68,8 @@ Nothing yet...
46
68
 
47
69
  ### Added
48
70
  - Added an executable file for the gem so that it can be used without having to use Rake tasks.
49
- - A basic cataloging location and prefix is used by default so that specifying these values will not be necessary in many cases.
71
+ - A basic cataloging location and prefix is used by default so that specifying these values will not be necessary in
72
+ many cases.
50
73
 
51
74
  ### Fixed
52
75
  - Replaced non-Ruby 1.8.x compatible code so that the gem now correctly works with older versions of Ruby.
@@ -68,7 +91,8 @@ Nothing yet...
68
91
  - Initial release
69
92
 
70
93
 
71
- [Unreleased]: https://github.com/enkessler/cuke_cataloger/compare/v1.6.0...HEAD
94
+ [Unreleased]: https://github.com/enkessler/cuke_cataloger/compare/v2.0.0...HEAD
95
+ [2.0.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.6.0...v2.0.0
72
96
  [1.6.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.5.0...v1.6.0
73
97
  [1.5.0]: https://github.com/enkessler/cuke_cataloger/compare/v1.4.1...v1.5.0
74
98
  [1.4.1]: https://github.com/enkessler/cuke_cataloger/compare/v1.4.0...v1.4.1
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014-2020 Eric Kessler
1
+ Copyright (c) 2014-2022 Eric Kessler
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -4,15 +4,14 @@ Basic stuff:
4
4
  [![Downloads](https://img.shields.io/gem/dt/cuke_cataloger.svg)](https://rubygems.org/gems/cuke_cataloger)
5
5
 
6
6
  User stuff:
7
- [![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://jam.cucumber.io/p/98c11df9-4a7b-4b86-9700-7833ac93aa3e/cuke_cataloger/documents/branch/master/)
7
+ [![Cucumber Docs](http://img.shields.io/badge/Documentation-Features-green.svg)](https://github.com/enkessler/cuke_cataloger/tree/master/testing/cucumber/features)
8
8
  [![Yard Docs](http://img.shields.io/badge/Documentation-API-blue.svg)](https://www.rubydoc.info/gems/cuke_cataloger)
9
9
 
10
10
  Developer stuff:
11
- [![Build Status](https://travis-ci.org/enkessler/cuke_cataloger.svg)](https://travis-ci.org/enkessler/cuke_cataloger)
12
- [![Build status](https://ci.appveyor.com/api/projects/status/9a7gw3r5ddfugtf0?svg=true)](https://ci.appveyor.com/project/enkessler/cuke-cataloger)
13
- [![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_cataloger/badge.svg)](https://coveralls.io/github/enkessler/cuke_cataloger)
11
+ [![Build Status](https://github.com/enkessler/cuke_cataloger/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/enkessler/cuke_cataloger/actions/workflows/ci.yml?query=branch%3Amaster)
12
+ [![Coverage Status](https://coveralls.io/repos/github/enkessler/cuke_cataloger/badge.svg?branch=master)](https://coveralls.io/github/enkessler/cuke_cataloger?branch=master)
14
13
  [![Maintainability](https://api.codeclimate.com/v1/badges/662f0e7aa69bf9725515/maintainability)](https://codeclimate.com/github/enkessler/cuke_cataloger/maintainability)
15
- [![Inline docs](http://inch-ci.org/github/enkessler/cuke_cataloger.svg)](https://inch-ci.org/github/enkessler/cuke_cataloger)
14
+ [![Inline docs](http://inch-ci.org/github/enkessler/cuke_cataloger.svg?branch=master)](https://inch-ci.org/github/enkessler/cuke_cataloger)
16
15
 
17
16
 
18
17
  ---
@@ -164,11 +163,12 @@ By default, the cataloging and validation process uses `test_case_id` as the col
164
163
 
165
164
  `Rake::Task['validate_tests'].invoke('./features','@test_case_',nil, true, 'my_special_column_id') # 5th argument is the id column name`
166
165
 
166
+ For more information and usage examples, see the documentation [here](https://github.com/enkessler/cuke_cataloger/tree/master/testing/cucumber/features).
167
167
 
168
- ## Contributing
168
+ ## Development and Contributing
169
169
 
170
- 1. Fork it `http://github.com/<my-github-username>/cuke_cataloger/fork`
171
- 2. Create your feature branch `git checkout -b my-new-feature`
172
- 3. Commit your changes `git commit -am 'Add some feature'`
173
- 4. Push to the branch `git push origin my-new-feature`
174
- 5. Create new Pull Request
170
+ See [CONTRIBUTING.md](https://github.com/enkessler/cuke_cataloger/blob/master/CONTRIBUTING.md)
171
+
172
+ ## License
173
+
174
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,33 +1,53 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require 'cuke_cataloger/version'
5
4
 
6
- Gem::Specification.new do |spec|
5
+ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength - Gemspecs inherently have a lot of lines
7
6
  spec.name = 'cuke_cataloger'
8
7
  spec.version = CukeCataloger::VERSION
9
8
  spec.authors = ['Eric Kessler']
10
9
  spec.email = ['morrow748@gmail.com']
11
10
  spec.summary = 'A tool to give every Cucumber test a unique id'
12
- spec.description = 'Scans existing Cucumber tests and updates them to include an id tag that is unique for the test suite.'
11
+ spec.description = ['Scans existing Cucumber tests and updates them to include an id tag that is unique for the ',
12
+ 'test suite.'].join
13
13
  spec.homepage = 'https://github.com/enkessler/cuke_cataloger'
14
14
  spec.license = 'MIT'
15
+ spec.metadata = {
16
+ 'bug_tracker_uri' => 'https://github.com/enkessler/cuke_cataloger/issues',
17
+ 'changelog_uri' => 'https://github.com/enkessler/cuke_cataloger/blob/master/CHANGELOG.md',
18
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/cuke_cataloger',
19
+ 'homepage_uri' => 'https://github.com/enkessler/cuke_cataloger',
20
+ 'source_code_uri' => 'https://github.com/enkessler/cuke_cataloger'
21
+ }
15
22
 
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path('', __dir__)) do
26
+ source_controlled_files = `git ls-files -z`.split("\x0")
27
+ source_controlled_files.keep_if { |file| file =~ %r{^(lib|exe|testing/cucumber/features)} }
28
+ source_controlled_files + ['README.md', 'LICENSE.txt', 'CHANGELOG.md', 'cuke_cataloger.gemspec']
29
+ end
30
+
31
+ spec.bindir = 'exe'
32
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
33
  spec.require_paths = ['lib']
20
34
 
21
- spec.add_runtime_dependency 'cuke_modeler', '>= 0.2', '< 4.0'
35
+ spec.required_ruby_version = '>= 2.0', '< 4.0'
36
+
37
+ spec.add_runtime_dependency 'cuke_modeler', '>= 1.0', '< 4.0'
22
38
  spec.add_runtime_dependency 'cql', '>= 1.0.1', '< 2.0'
23
- spec.add_runtime_dependency 'rake', '< 14.0'
39
+ spec.add_runtime_dependency 'rake', '>=10.0', '< 14.0'
24
40
  spec.add_runtime_dependency 'thor', '< 2.0'
25
41
 
26
- spec.add_development_dependency "bundler", '< 3'
42
+ spec.add_development_dependency 'childprocess', '< 5.0'
43
+ spec.add_development_dependency 'ffi', '< 2.0' # This is an invisible dependency for the `childprocess` gem on Windows
44
+ spec.add_development_dependency 'bundler', '< 3'
27
45
  spec.add_development_dependency 'cucumber', '< 4.0'
28
46
  spec.add_development_dependency 'rspec', '~> 3.0'
29
- spec.add_development_dependency 'racatt', '~> 1.0'
30
- spec.add_development_dependency 'simplecov', '< 1.0'
31
- spec.add_development_dependency 'coveralls', '< 1.0'
47
+ spec.add_development_dependency 'simplecov', '~> 0.18'
48
+ spec.add_development_dependency 'simplecov-lcov', '< 1.0'
32
49
  spec.add_development_dependency 'rainbow', '< 4.0.0'
50
+ spec.add_development_dependency 'rubocop', '<= 0.50.0' # RuboCop can not lint against Ruby 2.0 after this version
51
+ spec.add_development_dependency 'yard', '< 1.0'
52
+ spec.add_development_dependency 'pry', '< 0.14'
33
53
  end
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+ require 'cuke_cataloger'
5
+
6
+ # The Command Line Interface for the gem
7
+ class CLI < Thor
8
+
9
+ desc 'catalog_test_cases',
10
+ 'Catalog the test cases in LOCATION with an id based on PREFIX'
11
+ option :location, default: '.'
12
+ option :prefix, default: '@test_case_'
13
+ option :row_id, type: :boolean, default: true
14
+ option :id_column_name, default: 'test_case_id'
15
+
16
+ def catalog_test_cases # rubocop:disable Metrics/AbcSize - Seems to be reporting high for some reason
17
+ puts "Tagging tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
18
+ puts "Including outline rows\n" if options[:row_id]
19
+
20
+ tagger = CukeCataloger::UniqueTestCaseTagger.new
21
+ tagger.tag_tests(options[:location], options[:prefix], {}, options[:row_id], options[:id_column_name])
22
+ end
23
+
24
+ desc 'validate_test_cases',
25
+ 'Validate the test cases in LOCATION with an id based on PREFIX. Will output the report to FILE, if provided.'
26
+ option :location, default: '.'
27
+ option :prefix, default: '@test_case_'
28
+ option :row_id, type: :boolean, default: true
29
+ option :id_column_name, default: 'test_case_id'
30
+ option :file
31
+
32
+ def validate_test_cases # rubocop:disable Metrics/AbcSize - Seems to be reporting high for some reason
33
+ puts "Validating tests in '#{options[:location]}' with tag '#{options[:prefix]}'\n"
34
+ puts "Including outline rows\n" if options[:row_id]
35
+
36
+ results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(options[:location],
37
+ options[:prefix],
38
+ options[:row_id],
39
+ options[:id_column_name])
40
+ report_text = CukeCataloger::TextReportFormatter.new.format_data(results)
41
+
42
+ if options[:file]
43
+ puts "Problems found: #{results.count}"
44
+ File.open(options[:file], 'w') { |file| file.write(report_text) }
45
+ else
46
+ puts report_text
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+
53
+ CLI.start(ARGV)
@@ -1,3 +1,6 @@
1
+ # TODO: have better testing so that this can be safely refactored
2
+ # rubocop:disable Metrics/AbcSize - Not going to mess with this, given how little testing is present
3
+
1
4
  module CukeCataloger
2
5
 
3
6
  # Not a part of the public API. Subject to change at any time.
@@ -14,11 +17,11 @@ module CukeCataloger
14
17
  results_by_category[result[:problem]] << result
15
18
  end
16
19
 
17
- results_by_category.keys.each do |problem_category|
20
+ results_by_category.each_key do |problem_category|
18
21
  report_text << "#{problem_category} problems: #{results_by_category[problem_category].count}\n"
19
22
  end
20
23
 
21
- results_by_category.keys.each do |problem_category|
24
+ results_by_category.each_key do |problem_category|
22
25
  report_text << "\n\n#{problem_category} problems (#{results_by_category[problem_category].count}):\n"
23
26
 
24
27
  results_by_category[problem_category].each do |result|
@@ -31,3 +34,5 @@ module CukeCataloger
31
34
 
32
35
  end
33
36
  end
37
+
38
+ # rubocop:enable Metrics/AbcSize
@@ -1,3 +1,8 @@
1
+ # TODO: have better testing so that this can be safely refactored
2
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength, Metrics/PerceivedComplexity - Not going to mess with this, given how little testing is present
3
+
4
+
5
+ # The top level namespace used by this gem
1
6
  module CukeCataloger
2
7
 
3
8
  extend Rake::DSL
@@ -5,9 +10,8 @@ module CukeCataloger
5
10
 
6
11
  # Adds the gem's provided Rake tasks to the namespace from which the method is called
7
12
  def self.create_tasks
8
-
9
13
  desc 'Add unique id tags to tests in the given directory'
10
- task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |t, args|
14
+ task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |_t, args|
11
15
  location = args[:directory] || '.'
12
16
  prefix = args[:prefix] || '@test_case_'
13
17
  tag_rows = args[:row_id].nil? ? true : args[:row_id]
@@ -21,7 +25,7 @@ module CukeCataloger
21
25
  end
22
26
 
23
27
  desc 'Scan tests in the given directory for id problems'
24
- task 'validate_tests', [:directory, :prefix, :out_file, :row_id, :id_column_name] do |t, args|
28
+ task 'validate_tests', [:directory, :prefix, :out_file, :row_id, :id_column_name] do |_t, args|
25
29
  location = args[:directory] || '.'
26
30
  prefix = args[:prefix] || '@test_case_'
27
31
  tag_rows = args[:row_id].nil? ? true : args[:row_id]
@@ -40,7 +44,8 @@ module CukeCataloger
40
44
  puts report_text
41
45
  end
42
46
  end
43
-
44
47
  end
45
48
 
46
49
  end
50
+
51
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/LineLength, Metrics/MethodLength, Metrics/PerceivedComplexity