Permalink
Browse files

use github username when full name is blank - closes #36

  • Loading branch information...
1 parent 24bcaec commit 4dee54c1914b0dfd25ac680a233ae14d4d18c199 @ryanb committed Aug 18, 2011
Showing with 6 additions and 2 deletions.
  1. +1 −1 app/models/user.rb
  2. +1 −1 app/views/users/show.html.erb
  3. +4 −0 spec/models/user_spec.rb
View
@@ -32,7 +32,7 @@ def generate_token(column)
end
def display_name
- name || github_username
+ name.present? ? name : github_username
end
def banned?
@@ -1,4 +1,4 @@
-<% title "#{@user.name}'s Profile" %>
+<% title "#{@user.display_name}'s Profile" %>
<div class="content">
<% if @user == current_user %>
View
@@ -30,4 +30,8 @@
user.reload.unsubscribe_token.should eq(token)
user.generated_unsubscribe_token.should eq(token)
end
+
+ it "uses github name as display name when original is blank" do
+ Factory(:user, :name => "", :github_username => "hank").display_name.should eq("hank")
+ end
end

0 comments on commit 4dee54c

Please sign in to comment.