Commit graph

53 commits

Author SHA1 Message Date
Tom Hughes
03cad948e3 Fix new rubocop warnings 2022-03-15 19:24:09 +00:00
Tom Hughes
cbcc7dc49f Fix some rubocop Naming/PredicateName warnings 2022-03-03 22:47:55 +00:00
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
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
Andy Allan
37b03e47c6 Fix various code comments
These were found as part of #3233
2021-07-21 11:24:23 +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
Andy Allan
a65cb84288 Remove unused code 2020-11-11 16:43:58 +00:00
Tom Hughes
7a1615bc55 Fix rubocop-minitest warnings 2020-04-15 19:07:13 +01:00
Tom Hughes
91a37235ac Remove support for old style user images 2019-07-16 22:33:26 +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
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
Tom Hughes
f7a35c5895 Fix new rubocop warnings 2018-06-18 09:00:49 +01:00
Tom Hughes
cb3c4ec09b Update for rubocop 0.54.0 2018-05-17 19:39:25 +01:00
Tom Hughes
b6b9d543ac Fix rubocop warnings 2017-10-29 19:43:02 +00:00
Tom Hughes
5b33f3f8e3 Fix rubocop warnings 2017-06-02 00:08:30 +01:00
Andy Allan
5d0ea28796 Remove the api_fixtures helper
This is no longer required, as the tests no longer use fixtures.
2017-06-01 10:59:48 +01:00
Andy Allan
1041ead253 Convert the test_users_nearby to user factories. 2017-02-02 13:52:26 +00:00
Andy Allan
3b26ff0c40 Use factory for user language tests 2017-02-02 13:33:15 +00:00
Andy Allan
b83271de92 Refactor the friend_users test, and remove the tests which duplicate the (renamed) test_friends_with above. 2017-02-02 13:24:46 +00:00
Andy Allan
f96c563c10 Convert test_friend_with to use factories, and use alice/bob/charlie for easier understanding. 2017-02-02 13:20:51 +00:00
Andy Allan
584748fe0a User factory for uniqueness tests 2017-02-02 13:09:39 +00:00
Andy Allan
df6469c76b Convert class method tests to use User factory.
Also improve the tests by being explicit about which results should
be returned, rather than just hoping that the fixtures cover all
possibilities.
2017-02-02 13:05:43 +00:00
Andy Allan
0bd2e9ea8c Add status traits to user factory. 2017-02-02 12:55:32 +00:00
Andy Allan
38fc6331af Add moderator_user and administrator_user factories. 2017-02-02 12:38:19 +00:00
Andy Allan
9e591d8ccb Add with_home_location trait for user factories. 2017-02-02 12:08:36 +00:00
Andy Allan
589e9802a9 Create a simple user factory, and convert some basic tests. 2017-02-01 17:42:05 +00:00
Tom Hughes
69b967c9ff Add support for Wikimedia authentication
Closes #1146
2016-12-20 22:32:25 +00:00
Tom Hughes
b9b255fa65 Work around upcoming minitest insanity
Minitest 6 will not allow assert_equal to compare for equality
with nil and minitest 5 has already started warning about it.

That's fine if you're comparing with a nil constant, but if you're
comparing with an expression that is sometimes nil and sometimes
not nil it's an absolute pain in the rear end.
2016-12-02 22:29:44 +00:00
Andy Allan
c365e2b28a Convert the languages fixtures to a factory
For some tests, the existance of an 'en' language is assumed by
the database structure (not null default 'en'::character varying) so
this can be created in a setup block.
2016-10-26 13:14:52 +01:00
Andy Allan
feb3b03227 Use model relations when creating objects from factories
Rather than passing around record ids explicitly, we can use the
model relations and pass around the models. This makes reading the
tests slightly simpler to read.
2016-10-19 11:32:08 +01:00
Andy Allan
bfe760a4b0 Replace friends fixture with a factory 2016-10-05 13:18:45 +01:00
Simon Poole
90b7101cc3 Add tests for change of gravatar use depending on email 2016-08-16 22:09:11 +02:00
Tom Hughes
c70a1fe933 Add support for GitHub authentication 2016-07-14 09:40:45 +01:00
Tom Hughes
4028f4cdb9 Rework locale selection
Implement our own matching algorithm rather than trying to
patch the http_accept_language one and make sure everything is
using it in a consistent way.

Fixes #1125
2016-01-06 18:43:25 +00:00
Tom Hughes
2b2264ddab Add support for Windows Live authentication 2015-05-19 14:04:09 +01:00
Tom Hughes
c9893e186b Add support for Facebook authentication 2015-05-19 14:04:08 +01:00
Tom Hughes
ddaf43bc0e Add tests for Google OAuth authentication 2015-04-14 10:08:07 +01:00
Tom Hughes
650adc10b2 Allow space as a language separator
The separator is supposed to be comma, so technically having
space instead is user error, but it seems to be very common.

Fixes #942
2015-03-31 20:53:51 +01:00
Tom Hughes
15b550182c Yet more tests... 2015-03-02 21:20:01 +00:00
Tom Hughes
bc056a5e98 More test coverage improvements 2015-03-01 00:44:32 +00:00
Tom Hughes
f04211b172 Improve test coverage 2015-02-27 00:40:37 +00:00
Tom Hughes
dc2a2c8ebd Standardise on double quoted strings 2015-02-20 19:47:26 +00:00
Tom Hughes
ef7f3d800c Fix most auto-correctable rubocop issues 2015-02-20 08:56:16 +00:00
Tom Hughes
34e3e51456 Cleanup trailing whitespace 2015-02-20 08:56:16 +00:00
Tom Hughes
574220187b Test that reserved usernames are not allowed 2014-10-02 19:54:26 +01:00
Tom Hughes
56d39b06f2 Rename User#public to User#identifiable 2014-07-04 19:24:25 +01:00