Andy Allan
1a11c4dc19
Use a state machine for user status
...
The user status is a bit complex, since there are various states and
not all transitions between them make sense.
Using AASM means that we can name and restrict the transitions, which
hopefully makes them easier to reason about.
2022-01-12 18:16:14 +00:00
Andy Allan
0100cfe304
Use factory_bot to build new model objects
2022-01-06 10:46:38 +00:00
Andy Allan
88cf03ff00
Use factorybot to build user objects
...
This allows us to only specify attributes of interest in the test.
2022-01-05 20:29:12 +00:00
Andy Allan
a863be8831
Rename User#delete to User#destroy
...
"delete" is generally used for immediate SQL deletion without running
any callbacks or other ruby code, whereas "destroy" will trigger callbacks.
Although we don't currently use any callbacks, let's rename this method to
align better with the convention.
2021-12-22 11:32:33 +00:00
Tom Hughes
0410596908
Switch traces to use ActiveStorage
2021-12-16 18:45:31 +00:00
Andy Allan
9ab15f38ea
Move the tracepoint coordinate format test to the controller test
...
This allows us to remove the model method
2021-09-29 15:25:28 +01:00
Andy Allan
d07ce46929
Move the xml format test for old nodes to the controller test
...
This allows us to remove the model method
2021-09-15 17:05:34 +01:00
Josh Soref
590f94f531
spelling: uniqueness
...
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-07-21 10:45:38 -04:00
Andy Allan
37b03e47c6
Fix various code comments
...
These were found as part of #3233
2021-07-21 11:24:23 +01:00
Tom Hughes
da546af22e
Allow acls to match on parent domains
2021-07-06 10:13:33 +01:00
Andy Allan
408c883d24
Skip intermediate lengths when testing tag validity
...
It's really the upper and lower boundaries that we want to check,
and it's reasonable to assume all the intermediate values will work
fine if the boundary values are tested.
This also saves about 75% of the time taken and almost 85% of the
assertions when running all the model tests.
2021-06-16 09:53:57 +01:00
Tom Hughes
70d7d8d850
Fix some ruby 3 compatibility issues
2021-04-22 19:20:25 +01:00
Tom Hughes
3512d6303c
Fix new rubocop warnings
2021-03-23 19:48:13 +00:00
Tom Hughes
0ff89c31e4
Remove both Potlatch versions
...
Fixes #2622
2021-01-05 21:18:45 +00:00
Tom Hughes
88ba316abe
Merge remote-tracking branch 'upstream/pull/2999'
2020-12-09 14:51:04 +00:00
Tom Hughes
582402ba8f
Prefer keyword arguments when method has optional boolean arguments
2020-11-13 10:22:55 +00:00
Andy Allan
1f242978af
Prefer keyword arguments when method has optional boolean arguments
2020-11-12 11:24:44 +00:00
Andy Allan
a65cb84288
Remove unused code
2020-11-11 16:43:58 +00:00
Tom Hughes
ea59d95f4a
Fix some new rubocop warnings
2020-08-06 22:27:30 +01:00
Tom Hughes
2d3972249c
Fix some rubocop todos
2020-08-02 19:38:58 +01:00
Tom Hughes
7a1615bc55
Fix rubocop-minitest warnings
2020-04-15 19:07:13 +01:00
Andy Allan
a219df24ca
Ensure that urls are only valid if the entire string is a url
...
This replaces our homegrown regexps (that didn't quite work) with
ruby built-in regexps, and uses the termination anchor to ensure
that the entire string, not just the first part, is validated.
2020-04-01 17:53:37 +02:00
Andy Allan
1cb0767e3d
Copy trace fixture files, rather than symlinking
...
Since we are using tmpdirs in order to enable parallel testing, we
can go the full hog and drop the fakefs too and just copy all the
files directly into the tmpdir. If a test makes changes (e.g.
changing the icon file during an import) the copy in the tmpdir is
thrown away at the end of the test anyway.
2020-03-18 15:35:55 +01:00
Andy Allan
979a474c68
Use unique test directories for each trace test
...
This allows tests to be run in parallel, since it avoids deleting
some of the symlinks that other tests expect to be there.
2020-03-18 15:04:18 +01:00
Tom Hughes
57f5b7840e
Fix rubocop warnings
2019-12-04 19:31:53 +00:00
Andy Allan
ae5c364e97
Move the format tests to test the output from the controller
2019-11-13 15:21:41 +01:00
Tom Hughes
135ec35a91
Fix numericality validation to use correct integer only constraint
...
Fixes #2355
2019-08-22 12:14:06 +01:00
Tom Hughes
18f5f1d499
Explicitly require gpx in the trace model tests
...
If we don't do this and no other test manages to trigger an
autoload before we run then we might try and autoload it inside
a MockFS block which will fail.
2019-08-14 19:10:15 +01:00
Tom Hughes
91a37235ac
Remove support for old style user images
2019-07-16 22:33:26 +01:00
Tom Hughes
d2d5d48f29
Allow signups to be blocked by MX host
2019-06-23 11:21:03 +01:00
Andy Allan
2169c503ef
Rename user.friend_users to user.friends
...
This is possible now since we've renamed Friend to Friendship
2019-06-19 16:51:35 +02:00
Andy Allan
1cf8fec58d
Rename Friend model to Friendship
...
This better describes what the model represents, which is the relationship
between the two users.
2019-06-19 16:39:25 +02:00
Tom Hughes
26cbdcf71a
Fix importing of GPX traces with a leading byte order marker
...
Fixes #2258
2019-06-14 19:01:53 +01:00
Tom Hughes
b5d903c603
Test import of various trace formats
...
Fixes #2254
2019-06-11 19:52:51 +01:00
Tom Hughes
9f57f60b87
Fix new rubocop warnings
2019-04-23 09:33:34 +01:00
Tom Hughes
dcfe326f65
Merge remote-tracking branch 'upstream/pull/2175'
2019-03-26 19:14:04 +00:00
Andy Allan
400db58036
Use activerecord-import for bulk importing tracepoint records
...
Non-rigourous testing shows a significant speedup, even on ssds.
2019-03-20 10:35:40 +01:00
Andy Allan
d102c9aaf4
Move all settings to settings.yml
...
We leave the STATUS setting alone, since it's required before rails
boots. The test-specific settings now live in config/settings/test.yml
2019-03-13 18:06:23 +01:00
Andy Allan
1ca77d6dda
Rubocop fixes for ruby 2.5
2019-03-13 10:33:33 +01:00
Tom Hughes
f7694a94c1
Update tests for changes in FactoryBot 5.x
2019-02-07 20:21:40 +00:00
Andy Allan
65e8bbd5f8
Remove unnecessary requires from tests
2019-02-06 11:44:34 +01:00
Andy Allan
d02e4ad461
Write some basic functionality tests for trace.import
2019-01-23 16:47:54 +01:00
Andy Allan
d70529f12b
Remove unnecessary include from redaction model test
2018-11-07 16:48:48 +01:00
J Guthrie
1e57189366
Added tests for validators
2018-11-05 16:23:30 +00:00
J Guthrie
6cde8c9b0c
Changed User model to not allow nil display_name (w/ tests)
2018-11-05 15:40:37 +00:00
Simon Poole
07ffb4c3f6
Calculate bounding box when deleting relations
...
Closes #2030
Fixes #2020
2018-10-21 19:32:12 +01:00
Xuyang Jia
d0e45c7c8e
Fix any_relations always being false
...
Closes #1976
2018-09-22 17:46:00 +01:00
Wil
a182820139
Resolve 96 Rubocop Lint/AmbiguousRegexpLiteral conflicts
2018-09-10 11:28:16 +08:00
Tom Hughes
f7a35c5895
Fix new rubocop warnings
2018-06-18 09:00:49 +01:00
Tom Hughes
e5604ce98e
Assign vandalism reports for users to moderators
2018-06-17 11:14:19 +01:00