discourse/spec/models
Blake Erickson efb116d2bd
FIX: Reset related site settings on general category delete (#18548)
* FIX: Reset related site settings on general category delete

If the new seeded General category is deleted we also need to delete the
corresponding site setting for it so that we don't try and reference it.

This fixes a bug in the category dropdown composer.

This change creates the `clear_related_site_settings` after destroy
hook that could also be used by other features in the future, like maybe
when we have a `default_category_id` site_setting.

Looks like if `nil` out a site setting it is set to `0`?

```
[9] pry(main)> SiteSetting.general_category_id = nil
  SiteSetting Load (0.4ms)  SELECT "site_settings".* FROM "site_settings" WHERE "site_settings"."name" = 'general_category_id' LIMIT 1
=> nil
[10] pry(main)> SiteSetting.general_category_id
=> 0
```

That is why the tests check if the value is `< 1` and not `nil`.

* Use -1 instead of nil because it is the default
2022-10-12 11:09:45 -06:00
..
about_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
admin_dashboard_data_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
api_key_scope_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
api_key_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
application_request_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
associated_group_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
badge_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
badge_type_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
bookmark_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
category_featured_topic_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
category_group_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
category_list_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
category_spec.rb FIX: Reset related site settings on general category delete (#18548) 2022-10-12 11:09:45 -06:00
category_user_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
child_theme_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
color_scheme_color_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
color_scheme_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
developer_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
digest_email_site_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
directory_item_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
discourse_connect_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
do_not_disturb_timing_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
draft_sequence_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
draft_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
email_change_request_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
email_log_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
email_token_spec.rb FIX: do not redeem expired invites on new user signup (#17798) 2022-08-05 07:50:48 +05:30
embeddable_host_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
emoji_spec.rb DEV: emoji model should set the group of the emoji (#18237) 2022-09-14 13:10:48 +02:00
given_daily_like_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
global_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
group_archived_message_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
group_associated_group_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
group_history_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
group_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
group_user_spec.rb FIX: Restore trust level when leaving group (#17954) 2022-08-29 13:00:48 +03:00
incoming_link_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
incoming_links_report_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
invite_redeemer_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
invite_spec.rb FIX: Add better and more strict invite validators (#18399) 2022-09-30 13:35:00 +03:00
javascript_cache_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
locale_site_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
mailing_list_mode_site_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
notification_spec.rb DEV: Prioritize unread notifications in the experimental user menu (#18216) 2022-09-12 21:19:25 +03:00
optimized_image_spec.rb DEV: Rename secure_media to secure_uploads (#18376) 2022-09-29 09:24:33 +10:00
permalink_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
plugin_store_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
post_action_spec.rb FEATURE: Introduce personal_message_enabled_groups setting (#18042) 2022-09-26 13:58:40 +10:00
post_action_type_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
post_analyzer_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
post_detail_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
post_mover_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
post_reply_key_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
post_reply_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
post_revision_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
post_spec.rb DEV: Rename secure_media to secure_uploads (#18376) 2022-09-29 09:24:33 +10:00
post_timing_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
private_message_topic_tracking_state_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
published_page_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
quoted_post_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
remote_theme_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
report_spec.rb UX: danger colour update (#18516) 2022-10-12 19:01:01 +02:00
reviewable_claimed_topic_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
reviewable_flagged_post_spec.rb DEV: Use AR enums in reviewables related code 2022-09-22 14:44:27 +02:00
reviewable_history_spec.rb DEV: Use AR enums in reviewables related code 2022-09-22 14:44:27 +02:00
reviewable_post_spec.rb DEV: Use AR enums in reviewables related code 2022-09-22 14:44:27 +02:00
reviewable_queued_post_spec.rb DEV: Use AR enums in reviewables related code 2022-09-22 14:44:27 +02:00
reviewable_score_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
reviewable_spec.rb DEV: Delete reviewable associations when deleting (#18472) 2022-10-05 13:38:41 -03:00
reviewable_user_spec.rb FIX: Recover from guardian check when deleting reviewable users. (#17949) 2022-08-16 11:50:06 -03:00
s3_region_site_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
screened_email_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
screened_ip_address_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
screened_url_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
search_log_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
sidebar_section_link_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
site_setting_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
site_spec.rb FIX: do not show welcome CTA banner if the welcome topic is deleted (#18528) 2022-10-10 16:53:19 +05:30
sitemap_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
skipped_email_log_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
stylesheet_cache_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
tag_group_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
tag_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
tag_user_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
theme_field_spec.rb FIX: Ensure `<script>` handlebars templates are namespaced correctly (#18178) 2022-09-04 13:01:10 +02:00
theme_modifier_set_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
theme_spec.rb DEV: Use DiscourseJsProcessor for theme template compilation (#18135) 2022-09-01 11:50:46 +01:00
top_menu_item_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
top_topic_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_allowed_user_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_converter_spec.rb FEATURE: Make General the default category (#18383) 2022-09-30 12:20:21 -06:00
topic_embed_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_featured_users_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_group_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_invite_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_link_click_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_link_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_list_spec.rb FIX: Avoid duplicate topic-list requests (#18073) 2022-08-24 11:54:01 +01:00
topic_participants_summary_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_posters_summary_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_spec.rb FIX: Remove public topic invite functionality (#18488) 2022-10-10 19:21:51 +03:00
topic_tag_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_thumbnail_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
topic_timer_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_tracking_state_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
topic_user_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
topic_view_item_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
translation_override_spec.rb FEATURE: update bootstrap mode notice to add invite and wizard links (#17822) 2022-08-10 00:13:42 +05:30
trust_level3_requirements_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
trust_level_and_staff_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
trust_level_setting_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
unsubscribe_key_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
upload_reference_spec.rb FEATURE: Add dark mode option for category logos (#18460) 2022-10-07 11:00:44 -04:00
upload_spec.rb FIX: Correctly handle HTTP errors during dominant color calculation (#18565) 2022-10-12 15:50:44 +01:00
user_action_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_api_key_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_archived_message_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_associated_group_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_auth_token_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_avatar_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_badge_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_bookmark_list_spec.rb FIX: Return next bookmarks page only if it exists (#18139) 2022-09-01 13:04:00 +03:00
user_email_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_export_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
user_field_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_history_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_notification_schedule_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_option_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_profile_spec.rb SECURITY: Limit user profile field length (#18302) 2022-09-21 12:07:06 +10:00
user_profile_view_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
user_search_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
user_second_factor_spec.rb DEV: Automatically require 'rails_helper' in all specs (#16077) 2022-03-01 17:50:50 +00:00
user_spec.rb DEV: Remove usages of enable_personal_messages (#18437) 2022-10-05 10:50:20 +10:00
user_stat_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
user_status_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_summary_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
user_visit_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
username_validator_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00
watched_word_spec.rb FIX: Allow to add the same watched word with a different case (#17799) 2022-08-05 12:18:17 +02:00
web_crawler_request_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
web_hook_event_spec.rb Add RSpec 4 compatibility (#17652) 2022-07-28 10:27:38 +08:00
web_hook_spec.rb DEV: Use proper wording for contexts in specs 2022-08-04 11:05:02 +02:00