Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in which role assignments aren’t tracked in version history #2965

Merged
merged 1 commit into from
Mar 8, 2022

Conversation

AndrewKvalheim
Copy link
Member

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the upstream master branch.
  • The tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works (if appropriate).
  • I have added necessary documentation (if appropriate).

Short description of what this resolves

Role assignments (i.e. UsersRole creation/deletion) managed via Rolify aren’t tracked in the PaperTrail version history. Tests fail with:

Failures:

  1) Version display changes in users_role for conference role
     Failure/Error: expect(page).to have_text("added role cfp with ID #{user_role.id} to user #{user.name} in conference #{conference.short_title}")
       expected to find text "added role cfp with ID 2 to user name2 in conference fr_GAQ" in […]
     # ./spec/features/versions_spec.rb:350:in `block (2 levels) in <top (required)>'

Finished in 16.47 seconds (files took 3.45 seconds to load)
1 example, 1 failure

Failed examples:

rspec ./spec/features/versions_spec.rb:342 # Version display changes in users_role for conference role

Changes proposed in this pull request

Deferring the has_many :through until after rolify seems to resolve the problem, but I don’t understand why.

Resolves failing test `spec/features/versions_spec.rb:344`:

    1) Version display changes in users_role for conference role
       Failure/Error: expect(page).to have_text("added role cfp with ID #{user_role.id} to user #{user.name} in conference #{conference.short_title}")
         expected to find text "added role cfp with ID 2 to user name2 in conference fr_GAQ" in "OSEM\nname1\nAll Conferences\nOrganizations\nRevision History\nAll Conferences\nRevision History\nLog of changes made to conferences and associated resources\nShow\n10\n25\n50\n100\nAll\nentries\nSearch:\nID Description Actions\n18\nname2 signed up less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n17\nSomeone (probably via the console) updated is admin of user name1 less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n16\nname1 signed up less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n15\nSomeone (probably via the console) created new cfp for events in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n14\nSomeone (probably via the console) created new role volunteers_coordinator in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n13\nSomeone (probably via the console) created new role info_desk in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n12\nSomeone (probably via the console) created new role cfp in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n11\nSomeone (probably via the console) created new role organizer in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n10\nSomeone (probably via the console) created new difficulty level Hard in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\n9\nSomeone (probably via the console) created new difficulty level Medium in conference fr_GAQ less than a minute ago\n(May 1, 2014 00:01)\n\n\n\nView Changes\nRevert\nShowing 1 to 10 of 16 entries\nFirst\nPrevious\n1\n2\nNext\nLast\nThis tool is free software, released under the MIT license. You can run, copy, distribute, study, change and improve it. The source code and the developers are on GitHub."
       # ./spec/features/versions_spec.rb:350:in `block (2 levels) in <top (required)>'
@hennevogel
Copy link
Member

Deferring the has_many :through until after rolify seems to resolve the problem, but I don’t understand why.

Yeah this seems to have significance now...

@hennevogel hennevogel merged commit 9da3bf9 into openSUSE:master Mar 8, 2022
@AndrewKvalheim AndrewKvalheim deleted the users-role-versions branch March 9, 2022 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants