REFACTOR: Move option to return emails into the serializer

This makes more sense than having the guardian take an accessor.
The logic belongs in the Serializer, where the JSON is calculated.

Also removed some of the DRYness in the spec. It's fewer lines
and made it easier to test the option on the serializer.
This commit is contained in:
Robin Ward
2019-01-11 11:10:02 -05:00
parent f94c0283b2
commit dbe42068a2
4 changed files with 40 additions and 77 deletions

View File

@ -54,7 +54,6 @@ class Guardian
end
end
attr_accessor :can_see_emails
attr_reader :request
def initialize(user = nil, request = nil)
@ -381,10 +380,6 @@ class Guardian
)
end
def can_see_emails?
@can_see_emails
end
def can_export_entity?(entity)
return false unless @user
return true if is_admin?