Skip to content

Commit

Permalink
feat: Use email as fallback for User.full_name
Browse files Browse the repository at this point in the history
  • Loading branch information
sman591 committed May 29, 2019
1 parent 456b26a commit 80e06eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def last_name
end

def full_name
return "" if questionnaire.blank?
return email if questionnaire.blank?
questionnaire.full_name
end

Expand Down
6 changes: 3 additions & 3 deletions test/models/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ class UserTest < ActiveSupport::TestCase
assert_equal "Alpha Beta", questionnaire.user.full_name
end

should "return blank when no questionnaire exists" do
user = create(:user)
assert_equal "", user.full_name
should "return email when no questionnaire exists" do
user = create(:user, email: "foo@example.com")
assert_equal "foo@example.com", user.full_name
end
end

Expand Down

0 comments on commit 80e06eb

Please sign in to comment.