Skip to content
This repository has been archived by the owner on Apr 15, 2023. It is now read-only.

Commit

Permalink
Use the Users' full names in the link_to_profile helper. Closes #37
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Kreeftmeijer committed Oct 10, 2011
1 parent f928fe0 commit 7d5bd1a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ def avatar_url

def link_to_profile(user)
link_text = image_tag(user.gravatar_url(:size => 20, :default => avatar_url), :class => 'gravatar')
link_text << " " << user.login
link_to link_text, user_path(user), :name => user.login
link_text << " " << user.name
link_to link_text, user_path(user), :name => user.name
end

def clean_url(url)
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/contests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
end

scenario 'see the contest submitter' do
page.should have_link 'bob'
page.should have_link 'Bob'
body.should include 'href="/users/bob"'
body.should include 'avatar/1dae832a3c5ae2702f34ed50a40010e8.png'
end
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/login_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
scenario 'log in via Github' do
visit '/'
click_link 'log in via Github'
page.should have_content 'charlie'
page.should have_content 'Charlie'
end

scenario 'fail to log in using invalid credentials' do
Expand Down
8 changes: 6 additions & 2 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
describe ApplicationHelper do
describe "link_to_profile" do
before :each do
@user = stub(:login => 'charlie', :to_param => 'charlie', :gravatar_url => 'http://gravatar.org/profile.png')
@user = stub(
:name => 'Charlie',
:to_param => 'charlie',
:gravatar_url => 'http://gravatar.org/profile.png'
)
end

let(:output) { helper.link_to_profile(@user) }
Expand All @@ -14,7 +18,7 @@
end

it "should include the username" do
output.should include("charlie")
output.should include("Charlie")
end

it "should html escape the username" do
Expand Down

0 comments on commit 7d5bd1a

Please sign in to comment.