Class: CemAcpt::TestData::Fetcher
- Inherits:
-
Object
- Object
- CemAcpt::TestData::Fetcher
- Includes:
- Logging
- Defined in:
- lib/cem_acpt/test_data.rb
Overview
Fetcher provides the methods for extracting and formatting test data.
Instance Attribute Summary collapse
-
#acceptance_tests ⇒ Object
readonly
Returns the value of attribute acceptance_tests.
-
#module_dir ⇒ Object
readonly
Returns the value of attribute module_dir.
Instance Method Summary collapse
-
#acceptance_test_data ⇒ Array<Hash>
Extracts, formats, and returns a test data hash.
-
#initialize(config) ⇒ Fetcher
constructor
Initializes a new Fetcher object.
Methods included from Logging
current_log_config, #current_log_config, current_log_format, current_log_level, #current_log_level, included, #logger, new_log_config, #new_log_config, new_log_formatter, new_log_level, #new_log_level
Constructor Details
#initialize(config) ⇒ Fetcher
Initializes a new Fetcher object.
26 27 28 29 30 |
# File 'lib/cem_acpt/test_data.rb', line 26 def initialize(config) @config = config @module_dir = config.get('module_dir') @acceptance_tests = find_acceptance_tests(config.get('module_dir')) end |
Instance Attribute Details
#acceptance_tests ⇒ Object (readonly)
Returns the value of attribute acceptance_tests.
22 23 24 |
# File 'lib/cem_acpt/test_data.rb', line 22 def acceptance_tests @acceptance_tests end |
#module_dir ⇒ Object (readonly)
Returns the value of attribute module_dir.
22 23 24 |
# File 'lib/cem_acpt/test_data.rb', line 22 def module_dir @module_dir end |
Instance Method Details
#acceptance_test_data ⇒ Array<Hash>
Extracts, formats, and returns a test data hash.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/cem_acpt/test_data.rb', line 34 def acceptance_test_data logger.info 'Gathering acceptance test data...' acceptance_tests.each_with_object([]) do |t, a| logger.debug("Processing #{t}...") test_name = File.basename(t, '_spec.rb') test_data = { test_name: test_name, test_file: File.(t), } next unless @config.has?('tests') && @config.get('tests').include?(test_name) process_for_each(test_data).each do |test_data_i| process_static_vars(test_data_i) process_name_pattern_vars(test_name, test_data_i) vars_post_processing!(test_data_i) test_data_i.format! a << test_data_i end end end |