discourse/spec
Alan Guo Xiang Tan 243fcb6ffc
DEV: Introduce run_theme_migration spec helper in test environment (#26845)
This commit introduces the `run_theme_migration` spec helper to allow
theme developers to write RSpec tests for theme migrations. For example,
this allows the following RSpec test to be written in themes:

```
RSpec.describe "0003-migrate-small-links-setting migration" do
  let!(:theme) { upload_theme_component }

  it "should set target property to `_blank` if previous target component is not valid or empty" do
    theme.theme_settings.create!(
      name: "small_links",
      theme: theme,
      data_type: ThemeSetting.types[:string],
      value: "some text, #|some text 2, #, invalid target",
    )

    run_theme_migration(theme, "0003-migrate-small-links-setting")

    expect(theme.settings[:small_links].value).to eq(
      [
        { "text" => "some text", "url" => "#", "target" => "_blank" },
        { "text" => "some text 2", "url" => "#", "target" => "_blank" },
      ],
    )
  end
end
```

This change is being introduced because we realised that writting just
javascript tests for the migrations is insufficient since javascript
tests do not ensure that the migrated theme settings can actually be
successfully saved into the database. Hence, we are introduce this
helper as a way for theme developers to write "end-to-end" migrations
tests.
2024-05-03 06:29:18 +08:00
..
fabricators FEATURE: Allow watched words to be created as a group (#26632) 2024-04-29 15:50:55 +05:30
fixtures DEV: Support translations for property labels in objects schema editor (#26362) 2024-03-28 10:53:51 +08:00
generator DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
helpers FIX: Include HTML content for authenticated users with crawler UA (#26757) 2024-04-25 22:41:57 +01:00
import_export DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
initializers DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
integration Revert "FIX: Post uploads setting access_control_post_id unnecessarily (#26627)" (#26643) 2024-04-16 14:10:25 +10:00
integrity Enable Embroider/Webpack code spliting for Wizard (#24919) 2023-12-20 13:15:06 +00:00
jobs FIX: Move user reindexing into a job (#26753) 2024-04-25 20:58:34 +08:00
lib FIX: Handle tags with underscores correctly (#26839) 2024-05-01 20:01:39 -05:00
mailers FIX: Correctly re-attach allowed images in activity summary e-mail (#26642) 2024-04-18 10:27:46 +08:00
migrations DEV: Silence the output of migration specs (#26365) 2024-03-26 11:32:44 +01:00
models DEV: Introduce run_theme_migration spec helper in test environment (#26845) 2024-05-03 06:29:18 +08:00
multisite DEV: Add S3 upload system specs using minio (#22975) 2023-08-23 11:18:33 +10:00
requests FIX: Order categories in SQL for Categories#search (#26810) 2024-05-01 12:21:10 -05:00
script/import_scripts DEV: Allow fab! without block (#24314) 2023-11-09 16:47:59 -06:00
serializers FIX: Serialize categories for bookmarks (#26606) 2024-04-17 17:23:47 +03:00
services DEV: Add isValidUrl helper function to theme migrations (#26817) 2024-04-30 16:45:07 +08:00
support DEV: Introduce run_theme_migration spec helper in test environment (#26845) 2024-05-03 06:29:18 +08:00
system DEV: Fix admin sidebar filter flaky (#26844) 2024-05-02 13:27:24 +10:00
tasks DEV: Improve test coverage of themes:update rake task (#26764) 2024-04-26 10:04:15 +08:00
views FEATURE: Simplify crawler content for non-canonical post URLs (#26324) 2024-03-26 15:18:46 +00:00
rails_helper.rb DEV: Add pry-stack_explorer again (#26763) 2024-04-29 10:34:28 +10:00
regenerate_swagger_docs
swagger_helper.rb DEV: Bump rswag-specs from 2.11.0 to 2.13.0 (#24654) 2023-12-07 08:16:47 +08:00