diff --git a/app/models/user.rb b/app/models/user.rb index 7667d98cd..2c10f85c2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -56,7 +56,7 @@ def last_name end def full_name - return "" if questionnaire.blank? + return email if questionnaire.blank? questionnaire.full_name end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index e53b3c53b..610a162d1 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -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