mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 12:23:36 +08:00
ea84a82f77
This is quite complex as it means that in production we have to build Ember CLI test files and allow them to be used by our Rails application. There is a fair bit of glue we can remove in the future once we move to Ember CLI completely.
43 lines
1.2 KiB
Ruby
43 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
module QunitHelper
|
|
|
|
def support_bundles
|
|
result = []
|
|
if Rails.env.production? || @legacy_ember
|
|
result << preload_script("discourse/tests/test-support-rails")
|
|
result << preload_script("discourse/tests/test-helpers-rails")
|
|
else
|
|
result << preload_script("test-support")
|
|
result << preload_script("test-helpers")
|
|
end
|
|
result.join("\n").html_safe
|
|
end
|
|
|
|
def boot_bundles
|
|
result = []
|
|
if @legacy_ember
|
|
result << preload_script("discourse/tests/test_starter")
|
|
elsif @is_proxied
|
|
result << preload_script("scripts/discourse-test-listen-boot")
|
|
result << preload_script("scripts/discourse-boot")
|
|
else
|
|
result << preload_script("discourse-test-listen-boot")
|
|
result << preload_script("discourse-boot")
|
|
end
|
|
result.join("\n").html_safe
|
|
end
|
|
|
|
def theme_tests
|
|
theme = Theme.find_by(id: request.env[:resolved_theme_id])
|
|
return "" if theme.blank?
|
|
|
|
_, digest = theme.baked_js_tests_with_digest
|
|
src = "#{GlobalSetting.cdn_url}" \
|
|
"#{Discourse.base_path}" \
|
|
"/theme-javascripts/tests/#{theme.id}-#{digest}.js" \
|
|
"?__ws=#{Discourse.current_hostname}"
|
|
"<script src='#{src}'></script>".html_safe
|
|
end
|
|
end
|