From 2c1fc28d00c461c897ad8fd6fb9fd87ee239bd26 Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 20 Jun 2022 16:33:05 +0200 Subject: [PATCH] DEV: Remove ember-cli flags from the backend (#17147) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …and other auxiliary code * Restore `QUNIT_EMBER_CLI` flag warning * Add `ALLOW_EMBER_CLI_PROXY_BYPASS` --- .github/workflows/tests.yml | 4 +- app/controllers/application_controller.rb | 2 +- app/controllers/qunit_controller.rb | 10 ----- app/helpers/application_helper.rb | 4 +- app/helpers/qunit_helper.rb | 27 ------------ app/views/layouts/application.html.erb | 4 +- app/views/qunit/index.html.erb | 27 ------------ app/views/qunit/theme.html.erb | 17 ++++---- config/application.rb | 12 +++--- config/initializers/assets.rb | 16 +++----- config/routes.rb | 4 -- lib/ember_cli.rb | 23 ----------- lib/tasks/assets.rake | 22 +++------- lib/tasks/docker.rake | 4 +- lib/tasks/qunit.rake | 50 ++++++++--------------- spec/helpers/application_helper_spec.rb | 24 +++++------ spec/requests/invites_controller_spec.rb | 4 +- spec/requests/qunit_controller_spec.rb | 2 +- spec/requests/topics_controller_spec.rb | 8 ++-- 19 files changed, 67 insertions(+), 197 deletions(-) delete mode 100644 app/views/qunit/index.html.erb diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e045655590..270ee753d9e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1eaaabdcb6f..9f02aff3ee5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/qunit_controller.rb b/app/controllers/qunit_controller.rb index fe4ed7ce1a0..4ee3392d507 100644 --- a/app/controllers/qunit_controller.rb +++ b/app/controllers/qunit_controller.rb @@ -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? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 82b29b7ddaa..3b2306eae21 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/app/helpers/qunit_helper.rb b/app/helpers/qunit_helper.rb index edeefa8d988..e0376a1ad26 100644 --- a/app/helpers/qunit_helper.rb +++ b/app/helpers/qunit_helper.rb @@ -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? diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2449c821fe8..f0cef4d66b3 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -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 @@ <%- end %> - <%= yield :head %> <%= build_plugin_html 'server:before-head-close' %> @@ -118,7 +117,6 @@ <% end %> - <%= yield :data %> diff --git a/app/views/qunit/index.html.erb b/app/views/qunit/index.html.erb deleted file mode 100644 index 3dbac746a16..00000000000 --- a/app/views/qunit/index.html.erb +++ /dev/null @@ -1,27 +0,0 @@ - - - - QUnit Test Runner - <%= 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 %> - - - - -
-
- - diff --git a/app/views/qunit/theme.html.erb b/app/views/qunit/theme.html.erb index 25ab0eff67a..5b2b4c1cdee 100644 --- a/app/views/qunit/theme.html.erb +++ b/app/views/qunit/theme.html.erb @@ -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 %> - <%- if !@suggested_themes %> - <%- if !EmberCli.enabled? %> -
-
- <%- end %> - <%- else %> + <%- if @suggested_themes %>

Theme QUnit Test Runner

<%- if @suggested_themes.size == 0 %>

Cannot find any theme tests.

@@ -51,6 +47,7 @@ <%- end %> <%- if !@suggested_themes %> - <%= boot_bundles %> + <%= preload_script "scripts/discourse-test-listen-boot" %> + <%= preload_script "scripts/discourse-boot" %> <%- end %> diff --git a/config/application.rb b/config/application.rb index 2b69416af9a..249b0874452 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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' diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 22bbcb067e5..e07b3cc12f5 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -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) diff --git a/config/routes.rb b/config/routes.rb index 8d30a1fd671..3f8954ea9e9 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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" diff --git a/lib/ember_cli.rb b/lib/ember_cli.rb index 04387c67e77..a1944f4585d 100644 --- a/lib/ember_cli.rb +++ b/lib/ember_cli.rb @@ -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 diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index d5c84ec344a..12859f99012 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -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 diff --git a/lib/tasks/docker.rake b/lib/tasks/docker.rake index 80c08d31063..c1d2c2d6c98 100644 --- a/lib/tasks/docker.rake +++ b/lib/tasks/docker.rake @@ -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 diff --git a/lib/tasks/qunit.rake b/lib/tasks/qunit.rake index a7294a38ba7..a4941c8e932 100644 --- a/lib/tasks/qunit.rake +++ b/lib/tasks/qunit.rake @@ -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 diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index fdf4ce1faa2..84138e8ec1b 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -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 diff --git a/spec/requests/invites_controller_spec.rb b/spec/requests/invites_controller_spec.rb index 35e7b4a5ee0..b310e7f75ea 100644 --- a/spec/requests/invites_controller_spec.rb +++ b/spec/requests/invites_controller_spec.rb @@ -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 diff --git a/spec/requests/qunit_controller_spec.rb b/spec/requests/qunit_controller_spec.rb index 2eadff46e6f..63de764cd17 100644 --- a/spec/requests/qunit_controller_spec.rb +++ b/spec/requests/qunit_controller_spec.rb @@ -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}-") diff --git a/spec/requests/topics_controller_spec.rb b/spec/requests/topics_controller_spec.rb index 8b13a2607fe..b5a13613327 100644 --- a/spec/requests/topics_controller_spec.rb +++ b/spec/requests/topics_controller_spec.rb @@ -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