Permalink
Browse files

Merge pull request #50 from alphagov/shouldnt_set_requester_as_collab…

…orator

removing the requester email from collaborators
  • Loading branch information...
2 parents bc04384 + bdaa875 commit 4f35a518fa2083488f12f47f9f89c5a700141c16 @JordanHatch JordanHatch committed Feb 13, 2013
Showing with 8 additions and 1 deletion.
  1. +3 −1 app/models/shared/requester.rb
  2. +5 −0 test/unit/models/requester_test.rb
@@ -18,7 +18,9 @@ def collaborator_emails
end
def collaborator_emails=(emails_as_string)
- @collaborator_emails = emails_as_string.split(",").collect(&:strip)
+ collaborator_emails = emails_as_string.split(",").collect(&:strip)
+ filtered_collaborators = collaborator_emails.reject { |collab| collab == email }
+ @collaborator_emails = filtered_collaborators
end
def collaborator_emails_are_all_valid
@@ -25,4 +25,9 @@ class RequesterTest < Test::Unit::TestCase
should "have an empty list of collaborator emails if not set" do
assert_equal [], Requester.new.collaborator_emails
end
+
+ should "remove the requester from the collaborators (as Zendesk doesn't allow this)" do
+ requester = Requester.new(email: "requester@x.com", collaborator_emails: "a@b.com, requester@x.com, c@d.com")
+ assert_equal ["a@b.com", "c@d.com"], requester.collaborator_emails
+ end
end

0 comments on commit 4f35a51

Please sign in to comment.