I noticed that the following code has a `if current_user != user` that is not 
tested anywhere:

https://github.com/openstreetmap/openstreetmap-website/blob/8e97f3b1017975fb51104a22175e6d4cd8d23eec/app/controllers/api/changeset_comments_controller.rb#L47-L49

I went to add a test, ended up doing a bit of refactoring. Two commits here:
1. Refactor checks of whether emails are being received by the expected 
recipients, using a custom assertion. I also use this at 
`test/controllers/api/notes_controller_test.rb` which is unrelated to my 
initial intention.
2. Add an assertion that an unsubscribed commenter doesn't receive a 
notification email about their own comment, plus a new test checking the same 
thing for a subscribed commenter. Also testing an unrelated user, since we are 
at it.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6486

-- Commit Summary --

  * DRY tests with assertions to check whether an email was received
  * Test: users shouldn't receive notifications of own comments

-- File Changes --

    M test/controllers/api/changeset_comments_controller_test.rb (37)
    M test/controllers/api/notes_controller_test.rb (12)
    M test/test_helper.rb (23)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6486.patch
https://github.com/openstreetmap/openstreetmap-website/pull/6486.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6486
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/[email protected]>
_______________________________________________
rails-dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to