discourse/spec/tasks
Alan Guo Xiang Tan 35bc27a36d
FIX: themes:update rake task not rolling back transaction on error (#26750)
This commit fixes a bug in the `themes:update` rake task which resulted
in the ActiveRecord transaction not being rolled back when an error was
encountered. The transaction was first introduced in
7f0682f4f2 which changed a `begin..rescue`
block to `transaction do..rescue`. The problem with that change
prevented the transaction from ever rolling back as the code block
looks something like this:

```
transaction do
  begin
    update_theme
  rescue => e
    # surpress error
  end
end
```

From the transaction's point of view now, it will never rollback even if
an error was encountered when updating the remote theme because it will
never see the error.

Instead we should have done something like this if we wanted to surpress
the errors encountered while still ensuring that the transaction is
rolled back.

```
begin
  transaction do
    update_theme
  end
rescue => e
  # surpress error
end
```
2024-04-25 15:19:23 +08:00
..
assets_precompile_spec.rb DEV: Remove the transpilation message (#23998) 2023-10-19 01:00:15 +02:00
compatibility_spec.rb DEV: Introduce rake task to validate discourse-compatibility file (#26158) 2024-03-13 13:57:41 +00:00
hashtags_spec.rb DEV: Remove enable_experimental_hashtag_autocomplete logic (#22820) 2023-08-08 11:18:55 +10:00
incoming_emails_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
posts_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
redis_spec.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
themes_spec.rb FIX: themes:update rake task not rolling back transaction on error (#26750) 2024-04-25 15:19:23 +08:00
topics_spec.rb FEATURE: do not bump topics when retroactively closing (#23115) 2023-08-16 11:20:47 +10:00
uploads_spec.rb DEV: Add file_size_restriction site setting type (#24704) 2023-12-13 16:22:48 -07:00
version_bump_spec.rb DEV: Do not squash commits in version_bump:stage_security_fixes (#23547) 2023-09-12 18:00:42 +01:00