DEV: Remove ember-cli flags from the backend (#17147)
…and other auxiliary code * Restore `QUNIT_EMBER_CLI` flag warning * Add `ALLOW_EMBER_CLI_PROXY_BYPASS`
This commit is contained in:
parent
6f27c50287
commit
2c1fc28d00
|
@ -153,9 +153,9 @@ jobs:
|
|||
if: matrix.build_type == 'backend' && matrix.target == 'plugins'
|
||||
run: bin/rake plugin:spec
|
||||
|
||||
- name: Plugin QUnit (Ember CLI)
|
||||
- name: Plugin QUnit
|
||||
if: matrix.build_type == 'frontend' && (matrix.target == 'plugins' || matrix.target == 'core-plugins')
|
||||
run: QUNIT_EMBER_CLI=1 bin/rake plugin:qunit['*','1200000']
|
||||
run: bin/rake plugin:qunit['*','1200000']
|
||||
timeout-minutes: 30
|
||||
|
||||
- name: Check Annotations
|
||||
|
|
|
@ -102,7 +102,7 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def ember_cli_required?
|
||||
Rails.env.development? && ENV['NO_EMBER_CLI'] != '1' && request.headers['X-Discourse-Ember-CLI'] != 'true'
|
||||
Rails.env.development? && ENV["ALLOW_EMBER_CLI_PROXY_BYPASS"] != "1" && request.headers['X-Discourse-Ember-CLI'] != 'true'
|
||||
end
|
||||
|
||||
def application_layout
|
||||
|
|
|
@ -8,16 +8,6 @@ class QunitController < ApplicationController
|
|||
}
|
||||
layout false
|
||||
|
||||
def is_ember_cli_proxy?
|
||||
request.headers["HTTP_X_DISCOURSE_EMBER_CLI"] == "true"
|
||||
end
|
||||
|
||||
# only used in non-ember-cli test / dev
|
||||
def index
|
||||
raise Discourse::NotFound.new if is_ember_cli_proxy? || EmberCli.enabled?
|
||||
raise Discourse::InvalidAccess.new if Rails.env.production?
|
||||
end
|
||||
|
||||
def theme
|
||||
raise Discourse::NotFound.new if !can_see_theme_qunit?
|
||||
|
||||
|
|
|
@ -136,11 +136,9 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def preload_script(script)
|
||||
script = EmberCli.transform_name(script)
|
||||
|
||||
scripts = [script]
|
||||
|
||||
if EmberCli.enabled? && chunks = EmberCli.script_chunks[script]
|
||||
if chunks = EmberCli.script_chunks[script]
|
||||
scripts.push(*chunks)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,33 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QunitHelper
|
||||
|
||||
def vendor_theme_tests
|
||||
if EmberCli.enabled?
|
||||
preload_script("vendor")
|
||||
else
|
||||
preload_script("vendor-theme-tests")
|
||||
end
|
||||
end
|
||||
|
||||
def support_bundles
|
||||
result = [
|
||||
preload_script("discourse/tests/test-support-rails"),
|
||||
preload_script("discourse/tests/test-helpers-rails")
|
||||
].join("\n").html_safe
|
||||
end
|
||||
|
||||
def boot_bundles
|
||||
result = []
|
||||
if EmberCli.enabled?
|
||||
result << preload_script("scripts/discourse-test-listen-boot")
|
||||
result << preload_script("scripts/discourse-boot")
|
||||
else
|
||||
result << preload_script("discourse/tests/test_starter")
|
||||
end
|
||||
result.join("\n").html_safe
|
||||
end
|
||||
|
||||
def theme_tests
|
||||
theme = Theme.find_by(id: request.env[:resolved_theme_id])
|
||||
return "" if theme.blank?
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<%= preload_script_url ExtraLocalesController.url('overrides') %>
|
||||
<%- end %>
|
||||
<%= preload_script "vendor" %>
|
||||
<%= preload_script "application" %>
|
||||
<%= preload_script "discourse" %>
|
||||
<%- Discourse.find_plugin_js_assets(include_official: allow_plugins?, include_unofficial: allow_third_party_plugins?, request: request).each do |file| %>
|
||||
<%= preload_script file %>
|
||||
<%- end %>
|
||||
|
@ -57,7 +57,6 @@
|
|||
<meta name="apple-itunes-app" content="app-id=<%= SiteSetting.ios_app_id %><%= ios_app_argument %>">
|
||||
<%- end %>
|
||||
|
||||
|
||||
<%= yield :head %>
|
||||
|
||||
<%= build_plugin_html 'server:before-head-close' %>
|
||||
|
@ -118,7 +117,6 @@
|
|||
</form>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script defer src="<%= script_asset_path "start-discourse" %>"></script>
|
||||
|
||||
<%= yield :data %>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>QUnit Test Runner</title>
|
||||
<%= discourse_color_scheme_stylesheets %>
|
||||
<%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %>
|
||||
<%= discourse_stylesheet_link_tag(:test_helper, theme_id: nil) %>
|
||||
<%= preload_script "locales/#{I18n.locale}" %>
|
||||
<%= preload_script "vendor" %>
|
||||
<%= preload_script "application" %>
|
||||
<%= preload_script "admin" %>
|
||||
<%= preload_script "wizard" %>
|
||||
<%= preload_script "discourse/tests/test-support-rails" %>
|
||||
<%= preload_script "discourse/tests/test-helpers-rails" %>
|
||||
<%= preload_script "discourse/tests/active-plugins" %>
|
||||
<%= preload_script "discourse/tests/core-tests" %>
|
||||
<%= preload_script "discourse/tests/plugin-tests" %>
|
||||
<%= preload_script "discourse/tests/test_starter" %>
|
||||
<%= csrf_meta_tags %>
|
||||
<meta property="og:title" content="">
|
||||
<meta property="og:url" content="">
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
</body>
|
||||
</html>
|
|
@ -7,12 +7,13 @@
|
|||
<%= discourse_stylesheet_link_tag(:desktop, theme_id: nil) %>
|
||||
<%= discourse_stylesheet_link_tag(:test_helper, theme_id: nil) %>
|
||||
<%= preload_script "locales/#{I18n.locale}" %>
|
||||
<%= vendor_theme_tests %>
|
||||
<%= preload_script "application" %>
|
||||
<%= preload_script "vendor" %>
|
||||
<%= preload_script "discourse" %>
|
||||
<%= preload_script "admin" %>
|
||||
<%= preload_script "discourse/tests/active-plugins" %>
|
||||
<%= preload_script "admin-plugins" %>
|
||||
<%= support_bundles %>
|
||||
<%= preload_script "test-support" %>
|
||||
<%= preload_script "test-helpers" %>
|
||||
<%= theme_translations_lookup %>
|
||||
<%= theme_js_lookup %>
|
||||
<%= theme_lookup("head_tag") %>
|
||||
|
@ -33,12 +34,7 @@
|
|||
<%- end %>
|
||||
</head>
|
||||
<body>
|
||||
<%- if !@suggested_themes %>
|
||||
<%- if !EmberCli.enabled? %>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<%- end %>
|
||||
<%- else %>
|
||||
<%- if @suggested_themes %>
|
||||
<h2>Theme QUnit Test Runner</h2>
|
||||
<%- if @suggested_themes.size == 0 %>
|
||||
<p>Cannot find any theme tests.</p>
|
||||
|
@ -51,6 +47,7 @@
|
|||
<%- end %>
|
||||
</body>
|
||||
<%- if !@suggested_themes %>
|
||||
<%= boot_bundles %>
|
||||
<%= preload_script "scripts/discourse-test-listen-boot" %>
|
||||
<%= preload_script "scripts/discourse-boot" %>
|
||||
<%- end %>
|
||||
</html>
|
||||
|
|
|
@ -188,13 +188,11 @@ module Discourse
|
|||
Sprockets.register_mime_type 'application/javascript', extensions: ['.js', '.es6', '.js.es6'], charset: :unicode
|
||||
Sprockets.register_postprocessor 'application/javascript', DiscourseJsProcessor
|
||||
|
||||
if EmberCli.enabled?
|
||||
Discourse::Application.initializer :prepend_ember_assets do |app|
|
||||
# Needs to be in its own initializer so it runs after the append_assets_path initializer defined by Sprockets
|
||||
app.config.assets.paths.unshift "#{app.config.root}/app/assets/javascripts/discourse/dist/assets"
|
||||
Sprockets.unregister_postprocessor 'application/javascript', Sprockets::Rails::SourcemappingUrlProcessor
|
||||
Sprockets.register_postprocessor 'application/javascript', DiscourseSourcemappingUrlProcessor
|
||||
end
|
||||
Discourse::Application.initializer :prepend_ember_assets do |app|
|
||||
# Needs to be in its own initializer so it runs after the append_assets_path initializer defined by Sprockets
|
||||
app.config.assets.paths.unshift "#{app.config.root}/app/assets/javascripts/discourse/dist/assets"
|
||||
Sprockets.unregister_postprocessor 'application/javascript', Sprockets::Rails::SourcemappingUrlProcessor
|
||||
Sprockets.register_postprocessor 'application/javascript', DiscourseSourcemappingUrlProcessor
|
||||
end
|
||||
|
||||
require 'discourse_redis'
|
||||
|
|
|
@ -22,9 +22,12 @@ Rails.application.config.assets.precompile += [lambda do |filename, path|
|
|||
end]
|
||||
|
||||
Rails.application.config.assets.precompile += %w{
|
||||
discourse.js
|
||||
vendor.js
|
||||
admin.js
|
||||
wizard.js
|
||||
test-support.js
|
||||
test-helpers.js
|
||||
browser-detect.js
|
||||
browser-update.js
|
||||
break_string.js
|
||||
|
@ -44,18 +47,11 @@ Rails.application.config.assets.precompile += %w{
|
|||
onpopstate-handler.js
|
||||
embed-application.js
|
||||
admin-plugins.js
|
||||
scripts/discourse-test-listen-boot
|
||||
scripts/discourse-boot
|
||||
}
|
||||
|
||||
if EmberCli.enabled?
|
||||
Rails.application.config.assets.precompile += %w{
|
||||
discourse.js
|
||||
test-support.js
|
||||
test-helpers.js
|
||||
scripts/discourse-test-listen-boot
|
||||
scripts/discourse-boot
|
||||
}
|
||||
Rails.application.config.assets.precompile += EmberCli::ASSETS.map { |name| name.sub('.js', '.map') }
|
||||
end
|
||||
Rails.application.config.assets.precompile += EmberCli::ASSETS.map { |name| name.sub('.js', '.map') }
|
||||
|
||||
# Precompile all available locales
|
||||
unless GlobalSetting.try(:omit_base_locales)
|
||||
|
|
|
@ -1001,10 +1001,6 @@ Discourse::Application.routes.draw do
|
|||
get "/safe-mode" => "safe_mode#index"
|
||||
post "/safe-mode" => "safe_mode#enter", as: "safe_mode_enter"
|
||||
|
||||
unless Rails.env.production?
|
||||
get "/qunit" => "qunit#index"
|
||||
get "/wizard/qunit" => "wizard#qunit"
|
||||
end
|
||||
get "/theme-qunit" => "qunit#theme"
|
||||
|
||||
post "/push_notifications/subscribe" => "push_notification#subscribe"
|
||||
|
|
|
@ -10,19 +10,6 @@ module EmberCli
|
|||
vendor.js
|
||||
)
|
||||
|
||||
ALIASES ||= {
|
||||
"application" => "discourse",
|
||||
"discourse/tests/test-support-rails" => "test-support",
|
||||
"discourse/tests/test-helpers-rails" => "test-helpers"
|
||||
}
|
||||
|
||||
def self.enabled?
|
||||
if !Rails.env.production? && ENV["EMBER_CLI_PROD_ASSETS"] == "0"
|
||||
STDERR.puts "The 'legacy' ember environment is discontinued. Running with ember-cli assets. Remove the EMBER_CLI_PROD_ASSETS=0 flag."
|
||||
end
|
||||
true
|
||||
end
|
||||
|
||||
def self.script_chunks
|
||||
return @@chunk_infos if defined? @@chunk_infos
|
||||
|
||||
|
@ -40,17 +27,7 @@ module EmberCli
|
|||
{}
|
||||
end
|
||||
|
||||
# Some assets have changed name following the switch
|
||||
# to ember-cli. When the switch is complete, we can
|
||||
# drop this method and update all the references
|
||||
# to use the new names
|
||||
def self.transform_name(name)
|
||||
return name if !enabled?
|
||||
ALIASES[name] || name
|
||||
end
|
||||
|
||||
def self.is_ember_cli_asset?(name)
|
||||
return false if !enabled?
|
||||
ASSETS.include?(name) || name.start_with?("chunk.")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
if !defined?(EMBER_CLI)
|
||||
EMBER_CLI = EmberCli.enabled?
|
||||
end
|
||||
|
||||
if ENV["EMBER_CLI_PROD_ASSETS"] == "0"
|
||||
STDERR.puts "The 'legacy' ember environment is discontinued. Compiling with ember-cli assets..."
|
||||
end
|
||||
|
||||
task 'assets:precompile:before' do
|
||||
|
||||
require 'uglifier'
|
||||
require 'open3'
|
||||
|
||||
|
@ -17,7 +8,7 @@ task 'assets:precompile:before' do
|
|||
raise "rake assets:precompile should only be run in RAILS_ENV=production, you are risking unminified assets"
|
||||
end
|
||||
|
||||
if EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1")
|
||||
if ENV["EMBER_CLI_COMPILE_DONE"] != "1"
|
||||
compile_command = "NODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod"
|
||||
only_assets_precompile_remaining = (ARGV.last == "assets:precompile")
|
||||
|
||||
|
@ -55,12 +46,10 @@ task 'assets:precompile:before' do
|
|||
require 'sprockets'
|
||||
require 'digest/sha1'
|
||||
|
||||
if EMBER_CLI
|
||||
# Add ember cli chunks
|
||||
Rails.configuration.assets.precompile.push(
|
||||
*EmberCli.script_chunks.values.flatten.flat_map { |name| ["#{name}.js", "#{name}.map"] }
|
||||
)
|
||||
end
|
||||
# Add ember cli chunks
|
||||
Rails.configuration.assets.precompile.push(
|
||||
*EmberCli.script_chunks.values.flatten.flat_map { |name| ["#{name}.js", "#{name}.map"] }
|
||||
)
|
||||
end
|
||||
|
||||
task 'assets:precompile:css' => 'environment' do
|
||||
|
@ -102,7 +91,6 @@ task 'assets:flush_sw' => 'environment' do
|
|||
end
|
||||
|
||||
def is_ember_cli_asset?(name)
|
||||
return false if !EMBER_CLI
|
||||
%w(
|
||||
discourse.js
|
||||
admin.js
|
||||
|
|
|
@ -214,9 +214,9 @@ task 'docker:test' do
|
|||
|
||||
unless ENV["SKIP_PLUGINS"]
|
||||
if ENV["SINGLE_PLUGIN"]
|
||||
@good &&= run_or_fail("CI=1 QUNIT_EMBER_CLI=1 bundle exec rake plugin:qunit['#{ENV['SINGLE_PLUGIN']}','#{js_timeout}']")
|
||||
@good &&= run_or_fail("CI=1 bundle exec rake plugin:qunit['#{ENV['SINGLE_PLUGIN']}','#{js_timeout}']")
|
||||
else
|
||||
@good &&= run_or_fail("CI=1 QUNIT_EMBER_CLI=1 bundle exec rake plugin:qunit['*','#{js_timeout}']")
|
||||
@good &&= run_or_fail("CI=1 bundle exec rake plugin:qunit['*','#{js_timeout}']")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,24 +28,18 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
false
|
||||
end
|
||||
|
||||
if ENV['QUNIT_EMBER_CLI'] == "0"
|
||||
if ENV["QUNIT_EMBER_CLI"] == "0"
|
||||
puts "The 'legacy' ember environment is discontinued - running tests with ember-cli assets..."
|
||||
end
|
||||
|
||||
ember_cli = true
|
||||
|
||||
port = ENV['TEST_SERVER_PORT'] || 60099
|
||||
while !port_available? port
|
||||
port += 1
|
||||
end
|
||||
|
||||
if ember_cli
|
||||
unicorn_port = 60098
|
||||
while unicorn_port == port || !port_available?(unicorn_port)
|
||||
unicorn_port += 1
|
||||
end
|
||||
else
|
||||
unicorn_port = port
|
||||
unicorn_port = 60098
|
||||
while unicorn_port == port || !port_available?(unicorn_port)
|
||||
unicorn_port += 1
|
||||
end
|
||||
|
||||
env = {
|
||||
|
@ -61,10 +55,6 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
"UNICORN_TIMEOUT" => "90",
|
||||
}
|
||||
|
||||
if !ember_cli
|
||||
env["EMBER_CLI_PROD_ASSETS"] = "0"
|
||||
end
|
||||
|
||||
pid = Process.spawn(
|
||||
env,
|
||||
"#{Rails.root}/bin/unicorn",
|
||||
|
@ -75,7 +65,6 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
success = true
|
||||
test_path = "#{Rails.root}/test"
|
||||
qunit_path = args[:qunit_path]
|
||||
qunit_path ||= "/qunit" if !ember_cli
|
||||
|
||||
options = { seed: (ENV["QUNIT_SEED"] || Random.new.seed), hidepassed: 1 }
|
||||
|
||||
|
@ -96,9 +85,10 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
|
||||
# wait for server to accept connections
|
||||
require 'net/http'
|
||||
warmup_path = ember_cli ? "/assets/discourse/tests/active-plugins.js" : "/qunit"
|
||||
warmup_path = "/assets/discourse/tests/active-plugins.js"
|
||||
uri = URI("http://localhost:#{unicorn_port}/#{warmup_path}")
|
||||
puts "Warming up Rails server"
|
||||
|
||||
begin
|
||||
Net::HTTP.get(uri)
|
||||
rescue Errno::ECONNREFUSED, Errno::EADDRNOTAVAIL, Net::ReadTimeout, EOFError
|
||||
|
@ -109,24 +99,20 @@ task "qunit:test", [:timeout, :qunit_path] do |_, args|
|
|||
end
|
||||
puts "Rails server is warmed up"
|
||||
|
||||
if ember_cli
|
||||
cmd = ["env", "UNICORN_PORT=#{unicorn_port}"]
|
||||
if qunit_path
|
||||
# Bypass `ember test` - it only works properly for the `/tests` path.
|
||||
# We have to trigger a `build` manually so that JS is available for rails to serve.
|
||||
system("yarn", "ember", "build", chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
test_page = "#{qunit_path}?#{query}&testem=1"
|
||||
cmd += ["yarn", "testem", "ci", "-f", "testem.js", "-t", test_page]
|
||||
else
|
||||
cmd += ["yarn", "ember", "test", "--query", query]
|
||||
end
|
||||
system(*cmd, chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
cmd = ["env", "UNICORN_PORT=#{unicorn_port}"]
|
||||
|
||||
if qunit_path
|
||||
# Bypass `ember test` - it only works properly for the `/tests` path.
|
||||
# We have to trigger a `build` manually so that JS is available for rails to serve.
|
||||
system("yarn", "ember", "build", chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
test_page = "#{qunit_path}?#{query}&testem=1"
|
||||
cmd += ["yarn", "testem", "ci", "-f", "testem.js", "-t", test_page]
|
||||
else
|
||||
cmd = "node #{test_path}/run-qunit.js http://localhost:#{port}#{qunit_path}"
|
||||
cmd += "?#{query.gsub('+', '%20').gsub("&", '\\\&')}"
|
||||
cmd += " #{args[:timeout]}" if args[:timeout].present?
|
||||
system(cmd)
|
||||
cmd += ["yarn", "ember", "test", "--query", query]
|
||||
end
|
||||
|
||||
system(*cmd, chdir: "#{Rails.root}/app/assets/javascripts/discourse")
|
||||
|
||||
success &&= $?.success?
|
||||
ensure
|
||||
# was having issues with HUP
|
||||
|
|
|
@ -31,9 +31,9 @@ describe ApplicationHelper do
|
|||
set_cdn_url "https://awesome.com"
|
||||
|
||||
helper.request.env["HTTP_ACCEPT_ENCODING"] = 'br'
|
||||
link = helper.preload_script('application')
|
||||
link = helper.preload_script('discourse')
|
||||
|
||||
expect(link).to eq(preload_link("https://awesome.com/brotli_asset/#{EmberCli.transform_name("application")}.js"))
|
||||
expect(link).to eq(preload_link("https://awesome.com/brotli_asset/discourse.js"))
|
||||
end
|
||||
|
||||
context "with s3 CDN" do
|
||||
|
@ -47,41 +47,41 @@ describe ApplicationHelper do
|
|||
|
||||
it "deals correctly with subfolder" do
|
||||
set_subfolder "/community"
|
||||
expect(helper.preload_script("application")).to include("https://s3cdn.com/assets/#{EmberCli.transform_name("application")}.js")
|
||||
expect(helper.preload_script("discourse")).to include("https://s3cdn.com/assets/discourse.js")
|
||||
end
|
||||
|
||||
it "replaces cdn URLs with s3 cdn subfolder paths" do
|
||||
global_setting :s3_cdn_url, 'https://s3cdn.com/s3_subpath'
|
||||
set_cdn_url "https://awesome.com"
|
||||
set_subfolder "/community"
|
||||
expect(helper.preload_script("application")).to include("https://s3cdn.com/s3_subpath/assets/#{EmberCli.transform_name("application")}.js")
|
||||
expect(helper.preload_script("discourse")).to include("https://s3cdn.com/s3_subpath/assets/discourse.js")
|
||||
end
|
||||
|
||||
it "returns magic brotli mangling for brotli requests" do
|
||||
|
||||
helper.request.env["HTTP_ACCEPT_ENCODING"] = 'br'
|
||||
link = helper.preload_script('application')
|
||||
link = helper.preload_script('discourse')
|
||||
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/#{EmberCli.transform_name("application")}.br.js"))
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/discourse.br.js"))
|
||||
end
|
||||
|
||||
it "gives s3 cdn if asset host is not set" do
|
||||
link = helper.preload_script('application')
|
||||
link = helper.preload_script('discourse')
|
||||
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/#{EmberCli.transform_name("application")}.js"))
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/discourse.js"))
|
||||
end
|
||||
|
||||
it "can fall back to gzip compression" do
|
||||
helper.request.env["HTTP_ACCEPT_ENCODING"] = 'gzip'
|
||||
link = helper.preload_script('application')
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/#{EmberCli.transform_name("application")}.gz.js"))
|
||||
link = helper.preload_script('discourse')
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/discourse.gz.js"))
|
||||
end
|
||||
|
||||
it "gives s3 cdn even if asset host is set" do
|
||||
set_cdn_url "https://awesome.com"
|
||||
link = helper.preload_script('application')
|
||||
link = helper.preload_script('discourse')
|
||||
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/#{EmberCli.transform_name("application")}.js"))
|
||||
expect(link).to eq(preload_link("https://s3cdn.com/assets/discourse.js"))
|
||||
end
|
||||
|
||||
it "gives s3 cdn but without brotli/gzip extensions for theme tests assets" do
|
||||
|
|
|
@ -10,7 +10,7 @@ describe InvitesController do
|
|||
it 'shows the accept invite page' do
|
||||
get "/invites/#{invite.invite_key}"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to have_tag(:script, with: { src: "/assets/#{EmberCli.transform_name("application")}.js" })
|
||||
expect(response.body).to have_tag(:script, with: { src: "/assets/discourse.js" })
|
||||
expect(response.body).not_to include(invite.email)
|
||||
expect(response.body).to_not include(I18n.t('invite.not_found_template', site_name: SiteSetting.title, base_url: Discourse.base_url))
|
||||
|
||||
|
@ -34,7 +34,7 @@ describe InvitesController do
|
|||
it 'shows unobfuscated email' do
|
||||
get "/invites/#{invite.invite_key}"
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to have_tag(:script, with: { src: "/assets/#{EmberCli.transform_name("application")}.js" })
|
||||
expect(response.body).to have_tag(:script, with: { src: "/assets/discourse.js" })
|
||||
expect(response.body).to include(invite.email)
|
||||
expect(response.body).not_to include('i*****g@a***********e.ooo')
|
||||
end
|
||||
|
|
|
@ -99,7 +99,7 @@ describe QunitController do
|
|||
expect(response.body).to include("/test-support")
|
||||
expect(response.body).to include("/test-helpers")
|
||||
expect(response.body).to include("/assets/markdown-it-bundle.js")
|
||||
expect(response.body).to include("/assets/#{EmberCli.transform_name("application")}.js")
|
||||
expect(response.body).to include("/assets/discourse.js")
|
||||
expect(response.body).to include("/assets/admin.js")
|
||||
expect(response.body).to match(/\/theme-javascripts\/\h{40}\.js/)
|
||||
expect(response.body).to include("/theme-javascripts/tests/#{theme.id}-")
|
||||
|
|
|
@ -2362,7 +2362,7 @@ RSpec.describe TopicsController do
|
|||
|
||||
body = response.body
|
||||
|
||||
expect(body).to have_tag(:script, src: "/assets/#{EmberCli.transform_name("application")}.js")
|
||||
expect(body).to have_tag(:script, src: "/assets/discourse.js")
|
||||
expect(body).to have_tag(:meta, with: { name: 'fragment' })
|
||||
end
|
||||
end
|
||||
|
@ -2638,7 +2638,7 @@ RSpec.describe TopicsController do
|
|||
body = response.body
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/#{EmberCli.transform_name("application")}.js" })
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
|
||||
expect(body).to_not have_tag(:meta, with: { name: 'fragment' })
|
||||
end
|
||||
end
|
||||
|
@ -2653,7 +2653,7 @@ RSpec.describe TopicsController do
|
|||
|
||||
body = response.body
|
||||
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/#{EmberCli.transform_name("application")}.js" })
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
|
||||
expect(body).to have_tag(:meta, with: { name: 'fragment' })
|
||||
end
|
||||
|
||||
|
@ -4306,7 +4306,7 @@ RSpec.describe TopicsController do
|
|||
|
||||
body = response.body
|
||||
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/#{EmberCli.transform_name("application")}.js" })
|
||||
expect(body).to have_tag(:script, with: { src: "/assets/discourse.js" })
|
||||
expect(body).to have_tag(:meta, with: { name: 'fragment' })
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue