mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Add support for uploading a theme from a directory in system tests (#23402)
Why this change? Currently, we do not have an easy way to test themes and theme components using Rails system tests. While we support QUnit acceptance tests for themes and theme components, QUnit acceptance tests stubs out the server and setting up the fixtures for server responses is difficult and can lead to a frustrating experience. System tests on the other hand allow authors to set up the test fixtures using our fabricator system which is much easier to use. What does this change do? In order for us to allow authors to run system tests with their themes installed, we are adding a `upload_theme` helper that is made available when writing system tests. The `upload_theme` helper requires a single `directory` parameter where `directory` is the directory of the theme locally and returns a `Theme` record.
This commit is contained in:

committed by
GitHub

parent
98f3976168
commit
d2e4b32c87
@ -142,13 +142,11 @@ class Admin::ThemesController < Admin::AdminController
|
||||
bundle = params[:bundle] || params[:theme]
|
||||
theme_id = params[:theme_id]
|
||||
update_components = params[:components]
|
||||
match_theme_by_name = !!params[:bundle] && !params.key?(:theme_id) # Old theme CLI behavior, match by name. Remove Jan 2020
|
||||
begin
|
||||
@theme =
|
||||
RemoteTheme.update_zipped_theme(
|
||||
bundle.path,
|
||||
bundle.original_filename,
|
||||
match_theme: match_theme_by_name,
|
||||
user: theme_user,
|
||||
theme_id: theme_id,
|
||||
update_components: update_components,
|
||||
|
Reference in New Issue
Block a user