Repository navigation
Extract organiser grant/revoke diffing into WorkshopOrganiserAssigner service (#2941) - #3049
Conversation
b897cc5 to
88a8cd0
Compare
mroderick
left a comment
There was a problem hiding this comment.
One behaviour change on the update path and two assertion gaps in the new specs - details in the line comments.
The blocker for me is the absent-param handling in WorkshopOrganiserAssigner: nil on update now silently clears all organisers where it previously raised, and nil means chapter fallback on create but full revocation on update. The rest of the extraction looks faithful.
| host: nil, organisers: [organiser.id.to_s] | ||
| } | ||
| } | ||
| end.not_to raise_error |
There was a problem hiding this comment.
.not_to raise_error is the only assertion in both new create specs, so they stay green even if the grant never happens: a mistyped service call, or a wrong params key falling back to the chapter default, passes just the same. Could the provided-ids spec also assert the effect?
| end.not_to raise_error | |
| end.not_to raise_error | |
| expect(Workshop.unscoped.order(:id).last.organisers).to include(organiser) |
(created is assigned on the next line, so the suggestion queries inline; swap the order if you prefer to reuse created.)
The PATCH #update spec below has real value assertions, so this is only about the two create cases.
There was a problem hiding this comment.
this should now be resolved
There was a problem hiding this comment.
I have updated the comment above into a suggested change: the added line asserts that the provided organiser id reaches the created workshop, so the spec fails if the params key is dropped and the chapter fallback takes over. Use the "Commit suggestion" button to apply it as-is, or reorder to reuse created if you prefer.
There was a problem hiding this comment.
thanks I've applied the suggestion.
faa1309 to
3a25aec
Compare
test: the added line asserts that the provided organiser id reaches the created workshop, so the spec fails if the params key is dropped and the chapter fallback takes over. Co-authored-by: Morgan Roderick <20321+mroderick@users.noreply.github.com>
05f513a to
dd44316
Compare
this refactor relates to issue 2941
Before: missing organiser_ids raised NoMethodError (nil.reject!) and left roles untouched.
After: