Module: CukeCataloger
- Extended by:
- Rake::DSL
- Defined in:
- lib/cuke_cataloger.rb,
lib/cuke_cataloger/version.rb,
lib/cuke_cataloger/rake_tasks.rb,
lib/cuke_cataloger/unique_test_case_tagger.rb,
lib/cuke_cataloger/formatters/text_report_formatter.rb
Overview
TODO: have better testing so that this can be safely refactored rubocop:disable Metrics/AbcSize - Not going to mess with this, given how little testing is present
Defined Under Namespace
Classes: TextReportFormatter, UniqueTestCaseTagger
Constant Summary collapse
- VERSION =
The current version of the gem
'2.0.0'.freeze
Class Method Summary collapse
-
.create_tasks ⇒ Object
Adds the gem's provided Rake tasks to the namespace from which the method is called.
Class Method Details
.create_tasks ⇒ Object
Adds the gem's provided Rake tasks to the namespace from which the method is called
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cuke_cataloger/rake_tasks.rb', line 12 def self.create_tasks desc 'Add unique id tags to tests in the given directory' task 'tag_tests', [:directory, :prefix, :row_id, :id_column_name] do |_t, args| location = args[:directory] || '.' prefix = args[:prefix] || '@test_case_' tag_rows = args[:row_id].nil? ? true : args[:row_id] id_column_name = args[:id_column_name] || 'test_case_id' puts "Tagging tests in '#{location}' with tag '#{prefix}'\n" puts "Including outline rows\n" if tag_rows tagger = CukeCataloger::UniqueTestCaseTagger.new tagger.tag_tests(location, prefix, {}, tag_rows, id_column_name) end desc 'Scan tests in the given directory for id problems' task 'validate_tests', [:directory, :prefix, :out_file, :row_id, :id_column_name] do |_t, args| location = args[:directory] || '.' prefix = args[:prefix] || '@test_case_' tag_rows = args[:row_id].nil? ? true : args[:row_id] id_column_name = args[:id_column_name] || 'test_case_id' puts "Validating tests in '#{location}' with tag '#{prefix}'\n" puts "Including outline rows\n" if tag_rows results = CukeCataloger::UniqueTestCaseTagger.new.validate_test_ids(location, prefix, tag_rows, id_column_name) report_text = CukeCataloger::TextReportFormatter.new.format_data(results) if args[:out_file] puts "Problems found: #{results.count}" File.open(args[:out_file], 'w') { |file| file.write(report_text) } else puts report_text end end end |