We're updating the issue view to help you get more done. 

User.orphan_account fails to create the user on a new database

Description

On a new database, we attempt to create the orphan_account user if doesn't exist.

https://github.com/otwcode/otwarchive/blob/854a4926c67c0419b10b1a4fe2165d8ccb8e9d87/app/models/user.rb#L547-L553

This fails because the new user is missing a host of required information (email, password, age check, TOS check), which means in tests we need the extra step of faking orphan_account, e.g. for Cucumber tests:

https://github.com/otwcode/otwarchive/blob/854a4926c67c0419b10b1a4fe2165d8ccb8e9d87/features/step_definitions/user_steps.rb#L11-L14

(This is not a problem on production or staging, which already has the orphan_account user.

Possible fix: orphan_account doesn't actually need to be valid, so we could just skip validations when creating it. Then we can remove the extra setup steps in tests.

1 2 orphan_account = User.find_or_initialize_by(login: "orphan_account") orphan_account.save(validate: false)

How to test: check if we can still orphan works.

Environment

None

Status

Assignee

Unassigned

Reporter

redsummernight

Roadmap

Orphaning

Priority

Low

Affects versions

0.9.250

Fix versions

None

Components

AutomatedTests
BackEnd

Difficulty

Medium

Required Access Level

None

Milestone

Internal 0.9