Commit Graph

18 Commits

Author SHA1 Message Date
Earlopain
fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00
Earlopain
0f842b9da0
[Tests] Remove wasteful post after_create hook
Not needed anymore.
Tests went from 95 seconds to 82 on my machine.
2023-09-08 21:33:25 +02:00
Earlopain
55d020877f
[Tests] Replace FFaker with FactoryBot sequences 2022-11-25 14:33:02 +01:00
Earlopain
ec658c4cb3
[Tests] Improve some factories
A forum topic must always contain a forum post, and creating things shouldn't
run into throttles. If I want to test that I opt in explicitly.
2022-04-07 17:52:35 +02:00
Earlopain
841610cd90
[Tests] Fix a few tests related to elasticsearch
Namespace the indicies, this should stop the search being messed up
after running tests. Also refresh the index immediately, this slows down
tests a bit but gets rid of a few failures. This whole search testing needs
to be revised some time.

Run this to fix your development setup:
```
Post.__elasticsearch__.create_index!
Post.import
PostArchive.__elasticsearch__.create_index!
PostArchive.import
```
2022-04-05 19:24:31 +02:00
Kira
76d1999ade [Rails] Upgrade to rails 6.1 + fix tests 2021-02-25 12:08:09 -08:00
Kira
436d2aea38 [Ruby 3] Fix up some deprecations involving ruby 3
Still pending are gems that make poor choices and need to be removed,
replaced, or fixed up.

Memoist
ActiveModelSerializers
2020-11-11 21:06:12 -08:00
Kira
fffe6b1c19 Fix test fixtures and seeds 2019-09-09 12:58:18 -07:00
r888888888
abce4d2551 Raise error on unpermitted params.
Fail loudly if we forget to whitelist a param instead of silently
ignoring it.

misc models: convert to strong params.

artist commentaries: convert to strong params.

* Disallow changing or setting post_id to a nonexistent post.

artists: convert to strong params.

* Disallow setting `is_banned` in create/update actions. Changing it
  this way instead of with the ban/unban actions would leave the artist in
  a partially banned state.

bans: convert to strong params.

* Disallow changing the user_id after the ban has been created.

comments: convert to strong params.

favorite groups: convert to strong params.

news updates: convert to strong params.

post appeals: convert to strong params.

post flags: convert to strong params.

* Disallow users from setting the `is_deleted` / `is_resolved` flags.

ip bans: convert to strong params.

user feedbacks: convert to strong params.

* Disallow users from setting `disable_dmail_notification` when creating feedbacks.
* Disallow changing the user_id after the feedback has been created.

notes: convert to strong params.

wiki pages: convert to strong params.

* Also fix non-Builders being able to delete wiki pages.

saved searches: convert to strong params.

pools: convert to strong params.

* Disallow setting `post_count` or `is_deleted` in create/update actions.

janitor trials: convert to strong params.

post disapprovals: convert to strong params.

* Factor out quick-mod bar to shared partial.
* Fix quick-mod bar to use `Post#is_approvable?` to determine visibility
  of Approve button.

dmail filters: convert to strong params.

password resets: convert to strong params.

user name change requests: convert to strong params.

posts: convert to strong params.

users: convert to strong params.

* Disallow setting password_hash, last_logged_in_at, last_forum_read_at,
  has_mail, and dmail_filter_attributes[user_id].

* Remove initialize_default_image_size (dead code).

uploads: convert to strong params.

* Remove `initialize_status` because status already defaults to pending
  in the database.

tag aliases/implications: convert to strong params.

tags: convert to strong params.

forum posts: convert to strong params.

* Disallow changing the topic_id after creating the post.
* Disallow setting is_deleted (destroy/undelete actions should be used instead).
* Remove is_sticky / is_locked (nonexistent attributes).

forum topics: convert to strong params.

* merges https://github.com/evazion/danbooru/tree/wip-rails-5.1
* lock pg gem to 0.21 (1.0.0 is incompatible with rails 5.1.4)
* switch to factorybot and change all references

Co-authored-by: r888888888 <r888888888@gmail.com>
Co-authored-by: evazion <noizave@gmail.com>

add diffs
2018-04-06 18:09:57 -07:00
evazion
3edd814be5 tests: add iqdb queries controller tests. 2017-02-06 18:48:37 -06:00
r888888888
341b29ce41 fix tests 2015-08-18 17:40:53 -07:00
Toks
afa4e83d9b Auto-add automatic tags whenever post is updated
Instead of being limited to when it's first uploaded.
2013-12-15 19:39:10 -05:00
r888888888
d5f575159f rename references of privileged to gold 2013-04-28 00:04:52 -07:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
5610731b35 sync 2010-08-18 18:42:33 -04:00
albert
3d9d6e229a added pool unit test 2010-02-13 05:11:27 -05:00
albert
2f3a6e4a8b added moderation tests for post test 2010-02-10 16:33:00 -05:00
albert
e6888ea1dd fixed tag and pending post tests, added category multiget helper to tag, post/unapproval/post version in progress still 2010-02-10 16:12:30 -05:00