Commit Graph

52 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
7a028cf003
[Tests] Set CurrentUser.ip_addr in base setup 2022-11-26 16:20:16 +01:00
Earlopain
c68fdfce2b
[Tests] Always use CurrentUser as helper 2022-11-26 15:20:15 +01:00
Earlopain
98e55562eb
[Tests] Clean up teardowns 2022-11-26 14:02:06 +01:00
Earlopain
87313c437c [Tests] Include FactoryBot::Syntax::Methods
The newly included create method behaves exacly like the self-written one,
with the added benefit of it not appearing in backtraces.
2022-11-25 21:06:54 +01:00
Earlopain
c9f65608de
[Tests] Replace timecop with native Rails method
Also removes it at a bunch of places where it's not needed
2022-11-25 14:32:56 +01:00
Earlopain
7e33ea8271
[Cleanup] Remove pool is_deleted
Pools are hard-deleted now. There are also a few pools with this flag
which can't be properly deleted at the moment
2022-07-11 22:52:26 +02:00
Earlopain
7531fc9894
[Cleanup] Remove an assortment of unused code 2022-07-11 20:17:24 +02:00
Earlopain
b1a8c4960c
[Tests] Fix pool tests 2022-02-10 17:53:51 +01:00
Kira
8ea9419045 [Pools] Fix pool name validator for '_-_'
A bad regex was added which was flagging pool names as invalid
if they contained _-_ in them or ' - '. As these are heavily used
in pool names they should be allowed. But consequitive characters
should still be not allowed.
2021-03-11 00:06:20 -08:00
Kira
2f416b51b4 [Tests] Fix pool tests
The atomic add! and remove! methods were not properly resetting
the skip_sync property once the pool was updated. This was causing
pool test behavior to fail because later syncronize methods would
fail to sync.
2021-02-25 12:08:09 -08:00
Kira
46fe5f1164 [Pools] Pool tests 2021-02-25 12:08:09 -08:00
Kira
4024108f1c Convert builder -> janitor for user rank 2019-06-29 12:58:28 -07:00
evazion
eade33fa7c Fix #3981: Inconsistency between posts and pools. 2018-11-10 12:37:08 -06:00
evazion
115ed16a96 pools: store post_ids as array instead of string (fix #3979) 2018-11-08 15:09:31 -06:00
evazion
1281481548 Fix #3978: Pool name/category validations not being enforced. 2018-11-07 16:10:16 -06:00
evazion
29b6121a07 pools: refactor #neighbors + fix broken #neighbors tests. 2018-11-04 19:40:57 -06:00
evazion
f5012464ab Fix #3965: Extraneous API attributes.
Remove the updater_id/updater_ip_addr virtual attributes from
pools/notes. Juss pass them in as params to create_version instead.
2018-10-30 15:41:17 -05:00
Albert Yi
99012ff342 fix tests 2018-05-09 11:59:51 -07:00
Albert Yi
8b98e9e009 additional tests to look for causes of incorrect post count on pools (#3667) 2018-04-26 11:14:01 -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
4f543671a2 tests: move test/helpers to test/test_helpers.
The Rails convention is for test/helpers to be used for testing the view
helpers in app/helpers. We were using it to store certain utility
methods instead. Move these to test/test_helpers so that test/helpers
can be used for its intended purpose.
2018-01-14 16:11:15 -06:00
evazion
4939c0345a Fix test failures when removing posts from deleted pools.
These tests failed because removing posts from deleted pools is now
Builder-only.
2017-11-26 18:10:08 -06:00
evazion
3b3abac8f6 pools: disallow asterisks and numeric-only names. 2017-08-10 18:37:22 -05:00
evazion
3b9a54f681 pools: strip leading/trailing, consecutive underscores in names (fix #3263). 2017-08-10 18:33:36 -05:00
evazion
76c90cc0e4 Remove unused Pool methods: create_anonymous/options/id_to_name (#3206)
* Pool.id_to_name: never used.
* Pool.create_anonymous: never used.
* Pool.options: unused since e7aff87.
2017-07-09 14:32:17 -05:00
evazion
c0e5c400a7 tests: fix tests for Rails.cache. 2017-04-16 16:48:36 -05:00
r888888888
621bef3ddf Revert "Merge pull request #2952 from evazion/fix-2950"
This reverts commit ae4509a541197684bfb0538f65afa827854b4335, reversing
changes made to eb008a0e765e231a8fdef594759a61798d6bd1d5.
2017-04-14 12:28:58 -07:00
r888888888
0b8d4105aa fix tests 2017-04-04 12:39:17 -07:00
evazion
3c89ee3199 tests: add more post/pool version creation tests.
Adds the `test_after_commit` gem too because after_commit callbacks
don't fire inside tests in rails <5.0.
2017-04-03 15:03:59 -07:00
Albert Yi
ee4ebce4d7 support pool version archive 2016-12-21 11:43:46 -08:00
r888888888
ce3af81c9f fix tests 2016-01-18 17:13:26 -08:00
r888888888
8ef7462b6b fix tests 2015-07-06 18:32:54 -07:00
r888888888
ceaa98b105 fix tests 2015-05-21 12:11:11 -07:00
r888888888
fad0ab7c93 fixes #2133 2014-04-16 17:43:34 -07:00
Toks
d0e9d4519a fixes #2016 2013-10-26 14:02:52 -04:00
小太
cba839ba76 Kill trailing whitespace in ruby files 2013-03-19 23:10:10 +11:00
albert
b03e889cdd fixed tests 2013-02-20 16:24:59 -05:00
albert
17881068e1 * Removed Pixa/Tinami sources
* Upgraded to Rails 3.2.3
* Fixed tests
2012-06-01 19:22:58 -04:00
albert
0de90d487b fixed tests 2011-10-22 19:01:27 -04:00
albert
f56ae86b5b refactored anon pools 2011-09-16 19:01:40 -04:00
Dean Matzkov
5efb6a5b92 Fix unit tests for ruby-1.8 compatibility 2011-09-08 21:00:29 -06:00
albert
1a303fd3db added tests for post sets 2011-06-11 17:05:46 -04:00
albert
ca7afc10be revamped pool tests 2011-06-10 01:02:09 -04:00
albert
49b3d43ddd * meta_search now pulls directly from GitHub
* Updated gems
* [inprogress] New pagination helpers used instead of pagination presenters
* [inprogress] Favorites refactored to use ActiveRecord
* [inprogress] PostSets refactored to use a decorator/dependency injection pattern
* [inprogress] Made pool/post interaction more robust
* Pool#posts now returns an ActiveRelation object
* Fixed unit tests
2011-06-07 17:34:09 -04:00
albert
aee5cf0aa1 fixed unit tests 2011-03-30 15:11:22 -04:00
albert
90a41a334b separated pool/post updates; fixed unit tests 2011-03-13 17:49:34 -04:00
albert
c5a9067e72 fixed unit tests 2011-01-22 03:01:15 -05:00
albert
ad39553aac updated tests, switched to rails 3.0.0rc2 2010-08-26 14:36:02 -04:00
albert
2f907c67b5 fixed unit tests, tweaked attr_accessible rules 2010-02-19 17:54:44 -05:00