Skip to content

Commit

Permalink
There's lots of stuff called url; I think link is a bit more descript…
Browse files Browse the repository at this point in the history
…ive for this method
  • Loading branch information
carols10cents committed Apr 1, 2012
1 parent b8afa35 commit fe4e059
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/decorators/author_decorator.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class AuthorDecorator < ApplicationDecorator
decorates :author

def website_url
def website_link
url = if model.website[0,7] == "http://" or model.website[0,8] == "https://"
model.website
else
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/show.haml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
.info
- unless @author.website.blank?
.website
= @author.website_url
= @author.website_link

%p.note= @author.bio

Expand Down
6 changes: 3 additions & 3 deletions test/decorators/author_decorator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
describe AuthorDecorator do
include TestHelper

describe '#website_url' do
describe '#website_link' do
before do
@author = AuthorDecorator.decorate(Fabricate(:author))
end

it 'returns link to authors website' do
assert_match 'http://example.com', @author.website_url
assert_match 'http://example.com', @author.website_link
end

it 'returns link to authors website when website is without http prefix' do
@author.website = 'test.com'
assert_match 'http://test.com', @author.website_url
assert_match 'http://test.com', @author.website_link
end
end
end

0 comments on commit fe4e059

Please sign in to comment.