Module: ImportmapMocha::TestHelper
- Defined in:
- app/helpers/importmap_mocha/test_helper.rb
Constant Summary collapse
- PATTERN =
['**/*.test.js', '**/*.spec.js'].freeze
Instance Method Summary collapse
Instance Method Details
#files ⇒ Object
11 12 13 |
# File 'app/helpers/importmap_mocha/test_helper.rb', line 11 def files root_path.flat_map { |path| path.glob(PATTERN).map { |m| m.relative_path_from(path) } } end |
#root_path ⇒ Object
15 16 17 |
# File 'app/helpers/importmap_mocha/test_helper.rb', line 15 def root_path Rails.application.config.importmap_mocha_path end |
#testcase ⇒ Object
7 8 9 |
# File 'app/helpers/importmap_mocha/test_helper.rb', line 7 def testcase files.map { |m| javascript_import_module_tag(m.to_s.sub('.js', '')) }.join("\n").html_safe end |