Module: JsTestsHelper
- Defined in:
- app/helpers/js_tests_helper.rb
Instance Method Summary collapse
- #global_assets ⇒ Object
- #javascript_include_tag_if_exists(source) ⇒ Object
- #stylesheet_link_tag_if_exists(source) ⇒ Object
- #tests_by_path ⇒ Object
Instance Method Details
#global_assets ⇒ Object
2 3 4 |
# File 'app/helpers/js_tests_helper.rb', line 2 def global_assets Rails.application.config.test_rails_js.global_assets end |
#javascript_include_tag_if_exists(source) ⇒ Object
24 25 26 27 28 |
# File 'app/helpers/js_tests_helper.rb', line 24 def javascript_include_tag_if_exists source if Rails.application.assets.find_asset("#{source}.js") javascript_include_tag source end end |
#stylesheet_link_tag_if_exists(source) ⇒ Object
18 19 20 21 22 |
# File 'app/helpers/js_tests_helper.rb', line 18 def stylesheet_link_tag_if_exists source if Rails.application.assets.find_asset("#{source}.css") stylesheet_link_tag source end end |
#tests_by_path ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/js_tests_helper.rb', line 6 def tests_by_path tests.inject({}) do |acc, test| node = acc path, test_name = test[:path].split path.each_filename do |name| node = (node[name] ||= {}) end node[test_name.to_s] = test[:asset] acc end end |