OSDN Git Service

Separate observing of Note and MergeRequests
authorRobb Kidd <robb@thekidds.org>
Tue, 9 Oct 2012 22:25:29 +0000 (18:25 -0400)
committerRobb Kidd <robb@thekidds.org>
Wed, 10 Oct 2012 21:59:25 +0000 (17:59 -0400)
commit16ceae895e32c2474de04c42307d914bf9a4c304
treeaa3a0104064cd80e6716ec010257103b0e66f377
parent2b7fd29b1abb3ab6ca5ece7fe2b093f6672796d6
Separate observing of Note and MergeRequests

* Move is_assigned? and is_being_xx? methods to IssueCommonality

  This is behavior merge requests have in common with issues. Moved
  methods to IssueCommonality role. Put specs directly into
  merge_request_spec because setup differs for issues and MRs
  specifically in the "closed" factory to use.

* Add MergeRequestObserver. Parallels IssueObserver in almost every way.

  Ripe for refactoring.

* Rename MailerObserver to NoteObserver

  With merge request observing moved out of MailerObserver, all that
  was left was Note logic. Renamed to NoteObserver, added tests and
  updated application config for new observer names. Refactored
  NoteObserver to use the note's author and not rely on current_user.

* Set current_user for MergeRequestObserver

  IssueObserver and MergeRequestObserver are the only observers that
  need a reference to the current_user that they cannot look up on
  the objects they are observing.
app/controllers/application_controller.rb
app/models/issue.rb
app/observers/mailer_observer.rb [deleted file]
app/observers/merge_request_observer.rb [new file with mode: 0644]
app/observers/note_observer.rb [new file with mode: 0644]
app/roles/issue_commonality.rb
config/application.rb
spec/factories.rb
spec/models/merge_request_spec.rb
spec/observers/merge_request_observer_spec.rb [new file with mode: 0644]
spec/observers/note_observer_spec.rb [new file with mode: 0644]