DEV: correctly delete custom scheme (#27203)

We were adding the custom scheme as a symbol, but trying to delete the string. Which would result in the symbol to not be removed.

This was causing errors in others test:

```
Error encountered while proccessing /admin/color_schemes.json  I18n::MissingTranslationData: Translation missing: en.color_schemes.baseschemewithnohighlightcolor
```

Reproducible with (probably possible to have a simpler repro):

```
bundle exec rspec --order random:27167 spec/integration/invalid_request_spec.rb spec/integration/spam_rules_spec.rb spec/jobs/bulk_invite_spec.rb spec/jobs/change_display_name_spec.rb spec/jobs/cleanup_imap_sync_log_spec.rb spec/jobs/download_backup_email_spec.rb spec/jobs/fix_primary_emails_for_staged_users_spec.rb spec/jobs/fix_s3_etags_spec.rb spec/jobs/pending_users_reminder_spec.rb spec/jobs/periodical_updates_spec.rb spec/jobs/pull_hotlinked_images_spec.rb spec/jobs/regular/group_smtp_email_spec.rb spec/jobs/reindex_search_spec.rb spec/jobs/update_topic_hot_scores_spec.rb spec/jobs/user_email_spec.rb spec/lib/admin_confirmation_spec.rb spec/lib/backup_restore/database_restorer_multisite_spec.rb spec/lib/backup_restore/system_interface_spec.rb spec/lib/bookmark_reminder_notification_handler_spec.rb spec/lib/color_math_spec.rb spec/lib/content_buffer_spec.rb spec/lib/discourse_spec.rb spec/lib/discourse_tagging_spec.rb spec/lib/discourse_webauthn/registration_service_spec.rb spec/lib/email/renderer_spec.rb spec/lib/email_updater_spec.rb spec/lib/ember_cli_spec.rb spec/lib/feed_element_installer_spec.rb spec/lib/file_helper_spec.rb spec/lib/final_destination/resolver_spec.rb spec/lib/freedom_patches/schema_migration_details_spec.rb spec/lib/guardian/post_guardian_spec.rb spec/lib/guardian/topic_guardian_spec.rb spec/lib/message_id_service_spec.rb spec/lib/onebox/domain_checker_spec.rb spec/lib/onebox/engine/google_maps_onebox_spec.rb spec/lib/onebox/engine/google_play_app_onebox_spec.rb spec/lib/onebox/engine/json_spec.rb spec/lib/onebox/engine/reddit_media_onebox_spec.rb spec/lib/onebox/engine/video_onebox_spec.rb spec/lib/onebox/engine/wikipedia_onebox_spec.rb spec/lib/onebox/engine/wistia_onebox_spec.rb spec/lib/post_destroyer_spec.rb spec/lib/post_locker_spec.rb spec/lib/s3_helper_spec.rb spec/lib/s3_inventory_spec.rb spec/lib/scss_checker_spec.rb spec/lib/site_icon_manager_spec.rb spec/lib/site_setting_extension_multisite_spec.rb spec/lib/summarization/base_spec.rb spec/lib/trashable_spec.rb spec/lib/validators/category_search_priority_weights_validator_spec.rb spec/lib/validators/max_username_length_validator_spec.rb spec/lib/validators/regex_presence_validator_spec.rb spec/lib/validators/regexp_list_validator_spec.rb spec/lib/validators/topic_title_length_validator_spec.rb spec/lib/validators/url_validator_spec.rb spec/lib/work_queue_spec.rb spec/mailers/test_mailer_spec.rb spec/mailers/version_mailer_spec.rb spec/models/badge_grouping_spec.rb spec/models/category_featured_topic_spec.rb spec/models/color_scheme_spec.rb spec/models/flag_spec.rb spec/models/given_daily_like_spec.rb spec/models/plugin_store_spec.rb spec/models/screened_url_spec.rb spec/models/site_setting_spec.rb spec/models/tag_spec.rb spec/models/theme_svg_sprite_spec.rb spec/models/top_menu_item_spec.rb spec/models/topic_allowed_user_spec.rb spec/models/topic_converter_spec.rb spec/models/topic_timer_spec.rb spec/models/translation_override_spec.rb spec/models/user_archived_message_spec.rb spec/models/user_email_spec.rb spec/models/user_search_spec.rb spec/models/user_status_spec.rb spec/models/web_hook_event_spec.rb spec/multisite/pausable_multisite_spec.rb spec/multisite/pausable_spec.rb spec/requests/about_controller_spec.rb spec/requests/admin/backups_controller_spec.rb spec/requests/admin/color_schemes_controller_spec.rb spec/requests/admin/email_templates_controller_spec.rb spec/requests/admin/form_templates_controller_spec.rb spec/requests/admin/screened_ip_addresses_controller_spec.rb spec/requests/admin/site_texts_controller_spec.rb spec/requests/api/categories_spec.rb spec/requests/api/site_spec.rb spec/requests/api/tags_spec.rb spec/requests/api/uploads_spec.rb spec/requests/api/users_spec.rb spec/requests/associate_accounts_controller_spec.rb spec/requests/badges_controller_spec.rb spec/requests/csp_reports_controller_spec.rb spec/requests/edit_directory_columns_controller_spec.rb spec/requests/slugs_controller_spec.rb spec/requests/steps_controller_spec.rb spec/requests/stylesheets_controller_spec.rb spec/requests/topic_view_stats_controller_spec.rb spec/requests/user_avatars_controller_spec.rb spec/requests/users_controller_spec.rb spec/script/import_scripts/vanilla_body_parser_spec.rb spec/serializers/basic_reviewable_queued_post_serializer_spec.rb spec/serializers/found_user_serializer_spec.rb spec/serializers/reviewable_flagged_post_serializer_spec.rb spec/serializers/reviewable_queued_post_serializer_spec.rb spec/serializers/reviewable_user_serializer_spec.rb spec/serializers/theme_objects_setting_metadata_serializer_spec.rb spec/serializers/topic_tracking_state_item_serializer_spec.rb spec/serializers/user_summary_serializer_spec.rb spec/serializers/user_with_custom_fields_serializer_spec.rb spec/services/color_scheme_revisor_spec.rb spec/services/email_settings_exception_handler_spec.rb spec/services/notification_emailer_spec.rb spec/services/problem_check/email_polling_errored_recently_spec.rb spec/services/problem_check/missing_mailgun_api_key_spec.rb spec/services/problem_check/unreachable_themes_spec.rb spec/services/site_settings_spec.rb spec/services/topic_timestamp_changer_spec.rb spec/services/username_changer_spec.rb
```
This commit is contained in:
Joffrey JAFFEUX 2024-05-27 16:35:42 +02:00 committed by GitHub
parent ca4b813d29
commit 3b6d4c830f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -156,7 +156,7 @@ RSpec.describe ColorScheme do
expect(resolved["secondary"]).to eq("123123") # From custom scheme
expect(resolved["tertiary"]).to eq("0088cc") # From `foundation/colors.scss`
ensure
ColorScheme::CUSTOM_SCHEMES.delete(custom_scheme_id)
ColorScheme::CUSTOM_SCHEMES.delete(custom_scheme_id.to_sym)
end
it "calculates 'hover' and 'selected' from existing db colors in dark mode" do