Resolves #4689 - Update seeds: mark users invitation_status
as "accepted"
#4705
+19
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #4689
Description
When we run the
bin/setup
script, it triggers various processes, including the Rails commandbin/rails db:reset
. This command is responsible for dropping the database and setting it up again (which actually creates the database, loads the schema, and initializes it with seed data). The seed data is located indb/seeds.rb
, and this file should contain all the necessary record creation to populate the database with demo values.We discovered that when a partner service attempts to invite a user created during the
bin/setup
script, the error "nil can't be converted to a Time value" is raised. This happens because those users don't have the invitation attributes set.This PR adds extra lines to the
db/seeds.rb
file to mark all created users'invitation_status
asaccepted
. Specifically, it sets theinvitation_sent_at
andinvitation_accepted_at
attributes for each user. I decided to modify only these values after reviewing theUser#invitation_status
method and this related test.Regarding the question left on the issue
| It does send the email -- it's just failing on displaying?
I'm not entirely sure, but based on the logs, there was a background job failure after I sent the user invite that I noticed. Should I be concerned about this?
Type of change
How Has This Been Tested?
I followed the steps to reproduce mentioned in the issue:
bin/setup
bin/start
I ran the test scenario that I added with
bundle exec rspec spec/models/user_spec.rb:134
I also ran the
bin/lint
commandI ran the entire test suite with
bundle exec rspec
Screenshots
(Before) On the "Manage users" partner page, after clicking on "Invite User"
(After) On the "Manage users" partner page, after clicking on "Invite User"